I have a script written in Pascal. I would to debug it in this way: stop at every line, dump values of all variables in memory and go to the next line. Is it possible to do it with gdb or some other open-source tool for Linux?
Compile file with option -g:
fpc/gpc -g file.pas
Run gdb for this file:
gdb file
Set all of needed variables:
display first_var
display second_var
...
Start debugging:
start
By pressing s you can continue to the next line.
Yes it is possible to use the gdb debugger on Pascal programs, provided your Pascal compiler is giving DWARF debug information. If using GNU Pascal (i.e. gpc) you want to pass the -g option when invoking gpc. If you use Free Pascal, it also accepts the -g option to fpc.
Once you compiled your Pascal program with debugging information, you need to learn how to use GNU gdb. You probably want the display, step, next, break, print, frame, cont commands (to gdb) and some more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With