To compile a program with debugging support, just specify the -g option on the command-line, as follows:
fpc -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 this1 .
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.
The second option may have undesirable side e ects. 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.