Next: Listing Tracepoints, Previous: Tracepoint Passcounts, Up: Set Tracepoints
actions
[num]actions
without bothering about its number). You specify the
actions themselves on the following lines, one action at a time, and
terminate the actions list with a line containing just end
. So
far, the only defined actions are collect
and
while-stepping
.
To remove all actions from a tracepoint, type `actions num' and follow it immediately with `end'.
(gdb) collect data // collect some data (gdb) while-stepping 5 // single-step 5 times, collect data (gdb) end // signals the end of actions.
In the following example, the action list begins with collect
commands indicating the things to be collected when the tracepoint is
hit. Then, in order to single-step and collect additional data
following the tracepoint, a while-stepping
command is used,
followed by the list of things to be collected while stepping. The
while-stepping
command is terminated by its own separate
end
command. Lastly, the action list is terminated by an
end
command.
(gdb) trace foo (gdb) actions Enter actions for tracepoint 1, one per line: > collect bar,baz > collect $regs > while-stepping 12 > collect $fp, $sp > end end
collect
expr1,
expr2, ...
$regs
$args
$locals
You can give several consecutive collect
commands, each one
with a single argument, or one collect
command with several
arguments separated by commas: the effect is the same.
The command info scope
(see info scope) is
particularly useful for figuring out what data to collect.
while-stepping
nwhile-stepping
command is
followed by the list of what to collect while stepping (followed by
its own end
command):
> while-stepping 12 > collect $regs, myglobal > end >
You may abbreviate while-stepping
as ws
or
stepping
.