In any cases where your program is longer than a few hundred lines, you will need to be able to run it through a debugger. Pascal programs compiled with GPC can be debugged via the GNU debugger dbg which we have installed on our Sun Fire system. However, the debugger is designed for C-code, and is rather kloncky if used with Pascal. But it is the only debugger available that works with GPC.
To be able to use the debuuger with your Pascal code, you have to include the -g option in your compilation. Since this option and optimization of the code (i.e. the -O options) are mutually exclusive, you will have to remove any -O directives from your compile command lines. Then you can start the debugger by typing "gdb name_of_executable". The debugger is operated by typing in commands such as run Start the program from the beginning stop Stop the program from executing break Insert a break at a given line of the code, or in a specific subroutine or function cont Continue from the present position in the code until the next break is encountered list List the code around the present break point print Show the value of a variable.
To be able to use the debuuger with your Pascal code, you have to include the -g option in your compilation. Since this option and optimization of the code (i.e. the -O options) are mutually exclusive, you will have to remove any -O directives from your compile command lines. Then you can start the debugger by typing "gdb name_of_executable". The debugger is operated by typing in commands such as run Start the program from the beginning stop Stop the program from executing break Insert a break at a given line of the code, or in a specific subroutine or function cont Continue from the present position in the code until the next break is encountered list List the code around the present break point print Show the value of a variable.
No comments:
Post a Comment