Debugging with GDB: Trace Files |
---|
Previous: Tracepoint Variables, Up: Tracepoints [Contents][Index]
In some situations, the target running a trace experiment may no
longer be available; perhaps it crashed, or the hardware was needed
for a different activity. To handle these cases, you can arrange to
dump the trace data into a file, and later use that file as a source
of trace data, via the target tfile
command.
tsave [ -r ] filename
tsave [-ctf] dirname
Save the trace data to filename. By default, this command
assumes that filename refers to the host filesystem, so if
necessary GDB will copy raw trace data up from the target and
then save it. If the target supports it, you can also supply the
optional argument -r
(“remote”) to direct the target to save
the data directly into filename in its own filesystem, which may be
more efficient if the trace buffer is very large. (Note, however, that
target tfile
can only read from files accessible to the host.)
By default, this command will save trace frame in tfile format.
You can supply the optional argument -ctf
to save data in CTF
format. The Common Trace Format (CTF) is proposed as a trace format
that can be shared by multiple debugging and tracing tools. Please go to
‘http://www.efficios.com/ctf
’ to get more information.
target tfile filename
target ctf dirname
Use the file named filename or directory named dirname as
a source of trace data. Commands that examine data work as they do with
a live target, but it is not possible to run any new trace experiments.
tstatus
will report the state of the trace run at the moment
the data was saved, as well as the current trace frame you are examining.
Both filename and dirname must be on a filesystem accessible to
the host.
(gdb) target ctf ctf.ctf (gdb) tfind Found trace frame 0, tracepoint 2 39 ++a; /* set tracepoint 1 here */ (gdb) tdump Data collected at tracepoint 2, trace frame 0: i = 0 a = 0 b = 1 '\001' c = {"123", "456", "789", "123", "456", "789"} d = {{{a = 1, b = 2}, {a = 3, b = 4}}, {{a = 5, b = 6}, {a = 7, b = 8}}} (gdb) p b $1 = 1
Previous: Tracepoint Variables, Up: Tracepoints [Contents][Index]