5.2 Displaying a backtrace
The debugger can also show the function calls and arguments up to the
current point of execution--this is called a stack backtrace
and is displayed with the command backtrace
:
(gdb) backtrace
#0 0x080483ed in foo (p=0x0) at null.c:13
#1 0x080483d9 in main () at null.c:7
In this case, the backtrace shows that the crash occurred at line 13
after the function foo
was called from main
with an argument of
p=0x0
at line 7 in 'null.c'. It is possible to move to
different levels in the stack trace, and examine their variables, using
the debugger commands up
and down
.