3 <title>Debugging with GDB
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"Debugging with GDB">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Backtrace">Backtrace
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Selection.html#Selection">Selection
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Frames.html#Frames">Frames
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"Stack.html#Stack">Stack
</a>
19 <h3 class=
"section">Backtraces
</h3>
21 <p>A backtrace is a summary of how your program got where it is. It shows one
22 line per frame, for many frames, starting with the currently executing
23 frame (frame zero), followed by its caller (frame one), and on up the
27 <dt><code>backtrace
</code>
28 <dd><dt><code>bt
</code>
29 <dd>Print a backtrace of the entire stack: one line per frame for all
32 <p>You can stop the backtrace at any time by typing the system interrupt
33 character, normally
<kbd>C-c
</kbd>.
35 <br><dt><code>backtrace
</code><var>n
</var><code></code>
36 <dd><dt><code>bt
</code><var>n
</var><code></code>
37 <dd>Similar, but print only the innermost
<var>n
</var> frames.
39 <br><dt><code>backtrace -
</code><var>n
</var><code></code>
40 <dd><dt><code>bt -
</code><var>n
</var><code></code>
41 <dd>Similar, but print only the outermost
<var>n
</var> frames.
44 <p>The names
<code>where
</code> and
<code>info stack
</code> (abbreviated
<code>info s
</code>)
45 are additional aliases for
<code>backtrace
</code>.
47 <p>Each line in the backtrace shows the frame number and the function name.
48 The program counter value is also shown--unless you use
<code>set
49 print address off
</code>. The backtrace also shows the source file name and
50 line number, as well as the arguments to the function. The program
51 counter value is omitted if it is at the beginning of the code for that
54 <p>Here is an example of a backtrace. It was made with the command
55 <code>bt
3</code>, so it shows the innermost three frames.
57 <pre class=
"smallexample"> #
0 m4_traceon (obs=
0x24eb0, argc=
1, argv=
0x2b8c8)
59 #
1 0x6e38 in expand_macro (sym=
0x2b600) at macro.c:
242
60 #
2 0x6840 in expand_token (obs=
0x0, t=
177664, td=
0xf7fffb08)
62 (More stack frames follow...)
65 <p>The display for frame zero does not begin with a program counter
66 value, indicating that your program has stopped at the beginning of the
67 code for line
<code>993</code> of
<code>builtin.c
</code>.