gdb.info: Backtrace

Go forward to Selection
Go backward to Frames
Go up to Stack
Go to the top op gdb

Backtraces

A backtrace is a summary of how your program got where it is.  It shows
one line per frame, for many frames, starting with the currently
executing frame (frame zero), followed by its caller (frame one), and
on up the stack.
`backtrace'
`bt'
     Print a backtrace of the entire stack: one line per frame for all
     frames in the stack.
     You can stop the backtrace at any time by typing the system
     interrupt character, normally `C-c'.
`backtrace N'
`bt N'
     Similar, but print only the innermost N frames.
`backtrace -N'
`bt -N'
     Similar, but print only the outermost N frames.
   The names `where' and `info stack' (abbreviated `info s') are
additional aliases for `backtrace'.
   Each line in the backtrace shows the frame number and the function
name.  The program counter value is also shown--unless you use `set
print address off'.  The backtrace also shows the source file name and
line number, as well as the arguments to the function.  The program
counter value is omitted if it is at the beginning of the code for that
line number.
   Here is an example of a backtrace.  It was made with the command `bt
3', so it shows the innermost three frames.
     #0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
         at builtin.c:993
     #1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
     #2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
         at macro.c:71
     (More stack frames follow...)
The display for frame zero does not begin with a program counter value,
indicating that your program has stopped at the beginning of the code
for line `993' of `builtin.c'.
   Most programs have a standard user entry point--a place where system
libraries and startup code transition into user code.  For C this is
`main'.  When GDB finds the entry function in a backtrace it will
terminate the backtrace, to avoid tracing into highly system-specific
(and generally uninteresting) code.
   If you need to examine the startup code, or limit the number of
levels in a backtrace, you can change this behavior:
`set backtrace past-main'
`set backtrace past-main on'
     Backtraces will continue past the user entry point.
`set backtrace past-main off'
     Backtraces will stop when they encounter the user entry point.
     This is the default.
`show backtrace past-main'
     Display the current user entry point backtrace policy.
`set backtrace limit N'
`set backtrace limit 0'
     Limit the backtrace to N levels.  A value of zero means unlimited.
`show backtrace limit'
     Display the current limit on backtrace levels.