I had just download the gpc-20010409 package, and followed the instructions to build it and installed. All things looks like well, but I can't debug any program, even like this:
------------------------------------------------------------- program hello;
begin writeln('Hello world'); end. -------------------------------------------------------------
I compiled it with `gpc -g -o hello hello.pas', and then issue `gdb hello'. The following is the output from gdb.
------------------------------------------------------------- GNU gdb 4.18 Copyright 1998 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 "i586-pc-linux-gnu"... (gdb) l 1 <implicit code>: No such file or directory. (gdb) l 1 in <implicit code> --------------------------------------------------------------
I'm using a TurboLinux chinese version 6.0, with gcc-2.95.2, binutils 2.9.1.0.25. I also tryed with gcc-2.95.3, gpc-2001331 but failed too. But when I got the suse's version `gpc.rpm' and installed it, move `/usr/lib/gcc-lib/i486-suse-linux/2.95.2/*' to `/usr/lib/gcc-lib/i586-pc-linux/2.95.2/' and change `/usr/lib/gcc-lib/i486-suse-linux/2.95.2' to be a symbolic link. It does work!
Why?
Clark Kent wrote:
I had just download the gpc-20010409 package, and followed the instructions to build it and installed. All things looks like well, but I can't debug any program, even like this:
program hello;
begin writeln('Hello world'); end.
I compiled it with `gpc -g -o hello hello.pas', and then issue `gdb hello'. The following is the output from gdb.
GNU gdb 4.18 Copyright 1998 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 "i586-pc-linux-gnu"... (gdb) l 1 <implicit code>: No such file or directory. (gdb) l 1 in <implicit code>
The problem is that startup of Pascal programs is a little different from C (because there are explicit and automatic initializers etc.). Try the following instructions (you can put them in your .gdbinit). Then `l' should work. (Note, they may change in some future GPC version ...)
break init_pascal_main_program run break pascal_main_program break '_p_runfinalizers' cont
Frank