Node: Debugger, Next: Libraries, Previous: Components, Up: Installing GPC

#### How do I debug my Pascal programs?

To debug your programs, (a) GNU Pascal must be able to generate executables with debug info for your platform, and (b) you must have a debugger which understands this.

- If `gpc -g -o hello hello.p` says:

                gpc: -g not supported for this platform

  then GPC is unable to generate debugging info. Usually, installing `gas` (part of GNU binutils) instead of your system's assembler can overcome this. When you configure the GCC used for GPC, specify `--with-gnu-as`, and possibly `--with-gnu-ld` and/or `--with-stabs`. More information can be found in the `INSTALL` file in the GNU CC source directory.
- Your system's debugger may not understand the debug info generated by GNU tools. In this case, installing `gdb` may help.

The bottom line: if you can debug GCC compiled programs, you should be able to do this with GPC too.

The GNU debugger (`gdb`) currently does not have a “Pascal” mode, so it is unable to display certain Pascal structures etc. When debugging, please note that the Initial Letter In Each Identifier Is In Upper Case And The Rest Are In Lower Case. If you want to display variable `foo` in the debugger, type `show Foo` or `display Foo` instead.

Although `gdb` is an excellent debugger, it's user interface is not everybody's preference. If you like to debug under X11, please refer to the comp.windows.x FAQ: “Where can I get an X-based debugger?” at:
http://www.faqs.org/faqs/x-faq/part6/section-2.html

Some useful frontends include: XXGDB, tGDB and XWPE. See:
http://www.ee.ryerson.ca:8080/~elf/xapps/Q-IV.html

Very nice, but resource consuming is the Motif based DDD:
http://sol.ibr.cs.tu-bs.de/softech/ddd/

Furthermore, RHIDE (see IDE) contains built-in debugging suport, similar to the IDE of BP.