When debugging GPC 2.1 programs with GDB, I am unable to print the values of variables that are of the "standard" types. Variables of user-defined types appear to print OK. I am using the Chief's "i486-mingw32" port from:
http://www.gnu-pascal.de/contrib/chief/win32/mingw32/
...but I have observed the same problem in a Mingw version that I built myself.
Test case:
program gdbtest (output);
var i : integer; r : real; c : char; e : (enum1, enum2); s : 0..10; t : string (12);
begin i := 3; r := 3.14159; c := 'Q'; e := enum2; s := 4; t := 'test string';
writeln (i, r, c, s, t); end.
To reproduce:
D:>gpc -v Reading specs from /mingw/lib/gcc-lib/mingw32/2.95.3-6/specs gpc version 2.1 (20020510), based on 2.95.3-6 (mingw special)
D:>gpc -o gdbtest.exe -g gdbtest.pas
D:>gdb gdbtest.exe
GNU gdb 5.1.1 (mingw experimental) Copyright 2002 Free Software Foundation, Inc. [...] This GDB was configured as "mingw32"... (gdb) b gdbtest.pas:18 Breakpoint 1 at $4012c2: file gdbtest.pas, line 18. (gdb) r Starting program: D:/gdbtest.exe
Breakpoint 1, pascal_main_program () at gdbtest.pas:18 18 writeln (i, r, c, s, t); (gdb) p i $1 = void (gdb) p r $2 = void (gdb) p c $3 = void (gdb) p e $4 = Enum2 (gdb) p s $5 = 4 (gdb) p t $6 = 'test string' (gdb) c Continuing.
[program prints "3 3.141590000000000e+00Q4test string" as expected]
Note that the first three variables (of standard types "Integer", "Real", and "Char") print void values in the debugger. I have also tried this with GDB 4.18 and observe the same problem.
Could someone please confirm whether these results are reproducible across platforms or are specific to the ix86-mingw32 platform? Thanks!
-- Dave Bryan