On Feb 27, 2006, at 10:48 PM, lanceboyle@qwest.net wrote:
my program doesn't call anything like readline
Oops--sorry. It indeed does call a readline. However, that problem notwithstanding, the debugger continues to behave oddly. After the debugger loads, my program takes about 10 seconds before anything appears to happen with it. Then, stepping in/out/over is unreliable, with the "program counter" (the red arrow that indicates which line is about to be executed) pointing to the wrong line.
Jerry
lanceboyle@qwest.net wrote:
lanceboyle@qwest.net wrote:
my program doesn't call anything like readline
Oops--sorry. It indeed does call a readline. However, that problem notwithstanding, the debugger continues to behave oddly. After the debugger loads, my program takes about 10 seconds before anything appears to happen with it. Then, stepping in/out/over is unreliable, with the "program counter" (the red arrow that indicates which line is about to be executed) pointing to the wrong line.
This is a known problem (in the parser, I believe) - the line may be wrong by a one line offset. The same applies to error messages and warnings.
What would cause this kind of output from the debugger? All of the files that are said to be unable to have their symbols read [bottom paste] seem to be in the right place on my disk. When I run under the graphical debugger on OS X, breakpoints in the main program are ignored and the call stack is all blank lines except for level 7 which is denoted as ?? (two question marks). When I try a backtrace in the regular debugger (noob alert), I get, among others,
#4 $000420c8 in _p_Read_Line (F=$1df000) at /Users/adriaan/gnu/gpc/gpc344d2/gcc-3.4.4/gcc/p/rts/files.pas:2297
which is indicated as being called from my program, except that my program doesn't call anything like readline and why is there an indication that there is something interesting at /Users/adriann/ ? My program sort of hangs at this point, but indeed it continues if I press Return.
Debugging is far from perfect, to put it mildly. Also, this is a difficult subject, because there are several components involved
• problems in gpc • problems in gdb • problems in gpc support in gdb • problems in Mac OS X • problems in Xcode • Apple making ABI and other changes with every OS and Xcode release (in other words, they constantly release immature stuff and then have to "fix" that later)
So, I can only say what does work (I hope)
• in Xcode be sure to run the "Debug" executable (see the "Active Executable" popup menu) • in Xcode, set a break somewhere at the first lines of the main program • in Xcode, open the Debugger console window and type "bt <return>" or "bt full <return>" on a crash or break • run the program from the Finder and click the "Report…" button for a crash report with a backtrace or click the "Attach debugger…" button and then type "bt <return>" or "bt full <return>" for a backtrace • put writeln's in your source code (...)
Here's the intial debugger output:
[Session started at 2006-02-27 22:03:49 -0700.] GNU gdb 2003-01-28-cvs (Tue Jan 6 00:06:50 GMT 2004) Loading program into debugger… Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-apple-darwin7.2.0". tty /dev/ttyp2 warning: Unable to read symbols from "/usr/lib/libSystem.B.dylib". warning: Unable to read symbols from "/usr/lib/libSystem.B.dylib"; skipping.
Probably, you don't need to debug system libraries, so you can ignore this most of the time. If you do need it, you try to link to the debug version of the system lib. However, that can be difficult, because the link order on the command line is important (add -v to gpc to see the normal link order and what libraries are linked in). The following may work in a simple case: gp hello.pas -nostdlib -lcrt1.o -lSystem_debug -lgcc
Program loaded. run [Switching to process 20707 local thread 0xf03] Running… warning: Unable to read symbols from "/System/Library/Frameworks/Accelerate.framework/Versions/A/ Frameworks/vecLib.framework/Versions/A/vecLib". warning: Unable to read symbols from "/System/Library/Frameworks/Accelerate.framework/Versions/A/ Frameworks/vecLib.framework/Versions/A/vecLib"; skipping. warning: Unable to read symbols from "/System/Library/Frameworks/Accelerate.framework/Versions/A/ Frameworks/vecLib.framework/Versions/A/libvMisc.dylib". warning: Unable to read symbols from "/System/Library/Frameworks/Accelerate.framework/Versions/A/ Frameworks/vecLib.framework/Versions/A/libvMisc.dylib"; skipping.
See above. To link to the debug version of a framework, directly link to the debug version of the dynamic library of the framework (so replace e.g. "-Wl,-framework,Carbon" by "/System/Library/Frameworks/Carbon.framework/Carbon_debug").
warning: Unable to read symbols from "/usr/lib/libstdc++.6.dylib". warning: Unable to read symbols from "/usr/lib/libstdc++.6.dylib"; skipping.
Same as above.
Regards,
Adriaan van Os
Thanks for your comments, Adriaan.
Jerry