First page Back Continue Last page Overview Graphics

Gdb: Basic commands


Annoyingly you can't just prepend gdb to the command line you run your program with.
So do: gdb seggy
and then at the gdb prompt type: run
(since we haven't got any arguments).
It will get a SEGV (i.e. It will segfault). Now type
'where'. Here you can see the call stack. You can use up repeatedly to move to the previous function. And you can print variables with print, and list source at that point.
Sometimes you suspect where it is going to fail and want to look at it first. So do: break func2
and : run
again. Look how it stops at the first call to func2.