next up previous contents
Next: Using gdb to debug Up: Debugging your Programs Previous: Debugging your Programs

Compiling your program with debugger support

First of all, you must be sure that the compiler is compiled with debugging support. Unfortunately, there is no way to check this at run time, except by trying to compile a program with debugging support.

To compile a program with debugging support, just specify the -g option on the command-line, as follows:

ppc386 -g hello.pp
This will generate debugging information in the executable from your program. You will notice that the size of the executable increases substantially because of thisgif.

Note that the above will only generate debug information for the code that has been generated when compiling hello.pp. This means that if you used some units (the system unit, for instance) which were not compiled with debugging support, no debugging support will be available for the code in these units.

There are 2 solutions for this problem.

  1. Recompile all units manually with the -g option.
  2. Specify the 'build' option (-B) when compiling with debugging support. This will recompile all units, and insert debugging information in each of the units.
The second option may have undesirable side effects. It may be that some units aren't found, or compile incorrectly due to missing conditionals, etc..

If all went well, the executable now contains the necessary information with which you can debug it using gnu gdb.



Michael Van Canneyt
Thu Sep 10 13:56:17 CEST 1998