Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Tracepoint-Actions.html
blob6afacfad9f3ab357449dd3533edd7c81a233c2e6
1 <html lang="en">
2 <head>
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">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Tracepoint%20Actions">Tracepoint Actions</a>,
13 Next:<a rel="next" accesskey="n" href="Listing-Tracepoints.html#Listing%20Tracepoints">Listing Tracepoints</a>,
14 Previous:<a rel="previous" accesskey="p" href="Tracepoint-Passcounts.html#Tracepoint%20Passcounts">Tracepoint Passcounts</a>,
15 Up:<a rel="up" accesskey="u" href="Set-Tracepoints.html#Set%20Tracepoints">Set Tracepoints</a>
16 <hr><br>
17 </div>
19 <h4 class="subsection">Tracepoint Action Lists</h4>
21 <dl>
22 <dt><code>actions </code>[<code></code><var>num</var><code></code>]<code></code>
23 <dd>This command will prompt for a list of actions to be taken when the
24 tracepoint is hit. If the tracepoint number <var>num</var> is not
25 specified, this command sets the actions for the one that was most
26 recently defined (so that you can define a tracepoint and then say
27 <code>actions</code> without bothering about its number). You specify the
28 actions themselves on the following lines, one action at a time, and
29 terminate the actions list with a line containing just <code>end</code>. So
30 far, the only defined actions are <code>collect</code> and
31 <code>while-stepping</code>.
33 <p>To remove all actions from a tracepoint, type <code>actions </code><var>num</var><code></code>
34 and follow it immediately with <code>end</code>.
36 <pre class="smallexample"> (gdb) <b>collect </b><var>data</var><b></b> // collect some data
38 (gdb) <b>while-stepping 5</b> // single-step 5 times, collect data
40 (gdb) <b>end</b> // signals the end of actions.
41 </pre>
43 <p>In the following example, the action list begins with <code>collect</code>
44 commands indicating the things to be collected when the tracepoint is
45 hit. Then, in order to single-step and collect additional data
46 following the tracepoint, a <code>while-stepping</code> command is used,
47 followed by the list of things to be collected while stepping. The
48 <code>while-stepping</code> command is terminated by its own separate
49 <code>end</code> command. Lastly, the action list is terminated by an
50 <code>end</code> command.
52 <pre class="smallexample"> (gdb) <b>trace foo</b>
53 (gdb) <b>actions</b>
54 Enter actions for tracepoint 1, one per line:
55 &gt; collect bar,baz
56 &gt; collect $regs
57 &gt; while-stepping 12
58 &gt; collect $fp, $sp
59 &gt; end
60 end
61 </pre>
63 <br><dt><code>collect </code><var>expr1</var><code>, </code><var>expr2</var><code>, ...</code>
64 <dd>Collect values of the given expressions when the tracepoint is hit.
65 This command accepts a comma-separated list of any valid expressions.
66 In addition to global, static, or local variables, the following
67 special arguments are supported:
69 <dl>
70 <dt><code>$regs</code>
71 <dd>collect all registers
73 <br><dt><code>$args</code>
74 <dd>collect all function arguments
76 <br><dt><code>$locals</code>
77 <dd>collect all local variables.
78 </dl>
80 <p>You can give several consecutive <code>collect</code> commands, each one
81 with a single argument, or one <code>collect</code> command with several
82 arguments separated by commas: the effect is the same.
84 <p>The command <code>info scope</code> (see <a href="Symbols.html#Symbols">info scope</a>) is
85 particularly useful for figuring out what data to collect.
87 <br><dt><code>while-stepping </code><var>n</var><code></code>
88 <dd>Perform <var>n</var> single-step traces after the tracepoint, collecting
89 new data at each step. The <code>while-stepping</code> command is
90 followed by the list of what to collect while stepping (followed by
91 its own <code>end</code> command):
93 <pre class="smallexample"> &gt; while-stepping 12
94 &gt; collect $regs, myglobal
95 &gt; end
96 &gt;
97 </pre>
99 <p>You may abbreviate <code>while-stepping</code> as <code>ws</code> or
100 <code>stepping</code>.
101 </dl>
103 </body></html>