Adriaan van Os wrote:
As part of the OS X port, I try to make GPC part of Apple's ProjectBuilder, a GUI integrated development enviroment running on top of tools like JAM, GCC and GDB. There is a screen shot of how it will look at <www.microbizz.nl/gpcscreen01.png>.
I had expected debugging GNU Pascal programs (with Project Builder) to work, bit it didn't. After a late night session I found that stepping and breaking actually do (!) work. It was just that the Pascal source on the screen and the current-line indicator didn't reflect it ....
Stephen Bespalko (from the Mac OS X Ada team) advised me to try the GDB command line, so (in another late night session) I found:
(gdb) info source Current source file is /SourceCache/Csu/Csu-45/crt.c [instead of pentomino.pas] Compilation directory is /SourceCache/Csu/Csu-45/ Source language is c. Compiled with stabs debugging format. Does not include preprocessor macro info.
(gdb) info sources Source files for which symbols have been read in:
/Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/init.pas, <implicit code>, /Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/numtodec.pas, ../../gpc-3.2.1-patch/gcc/libgcc2.c, /Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/sets.pas, /Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/move.pas, /Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/file.c, /Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/rts-va.c, ../../include/stdarg.h, start.s, /SourceCache/Csu/Csu-45/crt.c, tconfig.h, ...<snip>... /Users/adriaan/gnu/gpc-3.2.1-patch/gcc/p/rts/rts.c, /SourceCache/Csu/Csu-45/crt.c
So, the problem seems to be that GDB sees /SourceCache/Csu/Csu-45/crt.c as the source code instead of ./pentomino.pas. The promising point is that debugging Pascal code in listed runtime units (like init.pas) seemed to work perfectly.
I don't know exactly what's going on. Doesn't it work when you explicitly give the source file name (e.g., `break pentomino.pas:42')?
One thing that might be relevant is that GPC gives the code automatically generated after the main program a pseudo file name `<implicit code>' (see start_dummy_file_name() in parse.y).
That might not be really good, but is there a better way to tell the debugger that some code is not part of any source file?.
Before GPC did this, the effect was that execution seemed to start at the end of the main program which was a little, well, "unintuitive" ... ;-)
But, again, I'm not sure if this is relevant to your problems at all ...
Frank