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=
"Create%20and%20Delete%20Tracepoints">Create and Delete Tracepoints
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Enable-and-Disable-Tracepoints.html#Enable%20and%20Disable%20Tracepoints">Enable and Disable Tracepoints
</a>,
14 Up:
<a rel=
"up" accesskey=
"u" href=
"Set-Tracepoints.html#Set%20Tracepoints">Set Tracepoints
</a>
18 <h4 class=
"subsection">Create and Delete Tracepoints
</h4>
21 <dt><code>trace
</code>
22 <dd>The
<code>trace
</code> command is very similar to the
<code>break
</code> command.
23 Its argument can be a source line, a function name, or an address in
24 the target program. See
<a href=
"Set-Breaks.html#Set%20Breaks">Set Breaks
</a>. The
<code>trace
</code> command
25 defines a tracepoint, which is a point in the target program where the
26 debugger will briefly stop, collect some data, and then allow the
27 program to continue. Setting a tracepoint or changing its commands
28 doesn't take effect until the next
<code>tstart
</code> command; thus, you
29 cannot change the tracepoint attributes once a trace experiment is
32 <p>Here are some examples of using the
<code>trace
</code> command:
34 <pre class=
"smallexample"> (gdb)
<b>trace foo.c:
121</b> // a source file and line number
36 (gdb)
<b>trace +
2</b> //
2 lines forward
38 (gdb)
<b>trace my_function
</b> // first source line of function
40 (gdb)
<b>trace *my_function
</b> // EXACT start address of function
42 (gdb)
<b>trace *
0x2117c4</b> // an address
45 <p>You can abbreviate
<code>trace
</code> as
<code>tr
</code>.
47 <p>The convenience variable
<code>$tpnum
</code> records the tracepoint number
48 of the most recently set tracepoint.
50 <br><dt><code>delete tracepoint
</code>[
<code></code><var>num
</var><code></code>]
<code></code>
51 <dd>Permanently delete one or more tracepoints. With no argument, the
52 default is to delete all tracepoints.
56 <pre class=
"smallexample"> (gdb)
<b>delete trace
1 2 3</b> // remove three tracepoints
58 (gdb)
<b>delete trace
</b> // remove all tracepoints
61 <p>You can abbreviate this command as
<code>del tr
</code>.