tfind n
The basic command for selecting a trace snapshot from the buffer is
tfind n
, which finds trace snapshot number n,
counting from zero. If no argument n is given, the next
snapshot is selected.
Here are the various forms of using the tfind
command.
tfind start
tfind 0
(since 0 is the number of the first snapshot).
tfind none
tfind end
tfind
tfind -
tfind tracepoint num
tfind pc addr
tfind outside addr1, addr2
tfind range addr1, addr2
tfind line [file:]n
tfind line
repeatedly can appear to have the same effect as
stepping from line to line in a live debugging session.
The default arguments for the tfind
commands are specifically
designed to make it easy to scan through the trace buffer. For
instance, tfind
with no argument selects the next trace
snapshot, and tfind -
with no argument selects the previous
trace snapshot. So, by giving one tfind
command, and then
simply hitting RET repeatedly you can examine all the trace
snapshots in order. Or, by saying tfind -
and then hitting
RET repeatedly you can examine the snapshots in reverse order.
The tfind line
command with no argument selects the snapshot
for the next source line executed. The tfind pc
command with
no argument selects the next snapshot with the same program counter
(PC) as the current frame. The tfind tracepoint
command with
no argument selects the next trace snapshot collected by the same
tracepoint as the current one.
In addition to letting you scan through the trace buffer manually, these commands make it easy to construct scripts that scan through the trace buffer and print out whatever collected data you are interested in. Thus, if we want to examine the PC, FP, and SP registers from each trace frame in the buffer, we can say this:
() tfind start () while ($trace_frame != -1) > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \ $trace_frame, $pc, $sp, $fp > tfind > end Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44 Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44 Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44 Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44 Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44 Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44 Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44 Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44 Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44 Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44 Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
Or, if we want to examine the variable X
at each source line in
the buffer:
() tfind start () while ($trace_frame != -1) > printf "Frame %d, X == %d\n", $trace_frame, X > tfind line > end Frame 0, X = 1 Frame 7, X = 2 Frame 13, X = 255
Go to the first, previous, next, last section, table of contents.