Dear ListFolks,
I am unable to set breakpoints, and therefore unable to debug, GPC programs under GDB. The cause appears to be bad debugging information generated by GPC. For example, compiling:
program debug (output);
var i, j: integer;
begin i := 1; j := 2; writeln ('A Pascal test'); writeln ('Variable i is ', i); writeln ('Variable j is ', j) end.
with:
gpc -g -o debug.exe debug.pas
and starting GDB with:
gdb debug.exe
and then trying to set breakpoints, I see the following:
(gdb) break 6 Breakpoint 1 at $4011f2: file <implicit code>, line 6. (gdb) break 8 Note: breakpoint 1 also set at pc $4011f2. Breakpoint 2 at $4011f2: file <implicit code>, line 8. (gdb) break 10 Note: breakpoints 1 and 2 also set at pc $4011f2. Breakpoint 3 at $4011f2: file <implicit code>, line 10.
Note that all breakpoints reference the same address. Attempting to start the program gives:
(gdb) r Starting program: D:/debug.exe
Breakpoint 1, init_pascal_main_program () at <implicit code>:11 11 <implicit code>: No such file or directory. in <implicit code>
If I try running "objdump", I see the following:
objdump --debugging debug.exe
debug.exe: file format pei-i386
Bad stab: Datevalid:(0,21)=@s8;16;,0,8;Timevalid:(0,21),8,8; Year:(0,1),32,32;Month:(0,22)=r(0,1);0000000000001;0000000000014;,64,32; Day:(0,23)=r(0,1);0000000000001;0000000000037;,96,32; Dayofweek:(0,24)=r(0,1);0000000000000;0000000000006;,128,32; [...]
Running "objdump" on the object file yields a similar error report.
I've reproduced this on several PCs, as follows:
* OS: Win95, WinNT4, Win2K
* GPC versions: 20011222 (i486-pc-mingw32msvc, 2.95.3) 20020318 (i386-unknown-mingw32 -- the Chief's distro) 20020410 (i486-pc-mingw32msvc, 2.95.3) 20020410 (i686-pc-cygwin, 2.95.3)
* GDB versions: 4.18, 5.0, 5.1.1
Is this the same error that is listed in the "Known Bugs" section of the GPC manual as:
"...error in debug entries generated for objects" 8F990E3D9A6FD1118F3B0000F81EA1D84985D7@exchsa2.dsto.defence.gov.au
-- Dave Bryan