Next: , Previous: Optimization, Up: Borland Pascal

7.8 Debugging

The command line option -g specifies generation of debugging information for GDB, the GNU debugger. GDB comes with its own documentation. Currently, GDB does not understand Pascal syntax, so you should be familiar with C expressions if you want to use it.

See also “Notes for debugging” in the “Programming” chapter; see Notes for Debugging.

Sometimes it is nice to have a look at the assembler output of the compiler. You can do this in a debugger or disassembler (which is the only way to do it in BP), but you can also tell GPC to produce assembler code directly: When you specify the -S command line option, GPC produces an .s file instead of an .o file. The .s file contains assembler source for your program. More about this in the next section.