What is the right way to use pgdbg?

I know this is not a good question to ask, but that is the question that I kept asking when I read the PGI documentation to learn how to use the debugger. The documentation is detailed, I think. But, frankly speaking, it is not an ideal one for a beginner who doesn’t have experience with any kind of debugger.

I don’t expect the question above to be answered here. So let me change to two other specific ones. I am trying to use the command line interface.

  1. In the course of debugging, can we put several commands together in a script file, and then execute the file, instead of keying the commands every time? If yes, then how? Note that I am not talking about the debugger initialization file.

  2. Is there any way to recall a command in history and execute it? I tried the arrow keys, they don’t work.


  1. You can put commands in a file and either pass it as an argument with option -s when you invoke pgdbg or you can call it using command script in pgdbg.


1.1) pgdbg -s mycmds a.out # pass as argument

1.2) pgdbg> script mycmds # execute command in file mycmds

  1. Type history to list the previous commands you enter and type ! to repeat the command in history list. Note that this only works with the command you type in. It will not work with commands you put in a file in (1) above. By default the history should be on. If not, you can type in pgdbg:

pgdbg> pgienv history on

to make sure it is on.