1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc. 4 5Permission is granted to copy, distribute and/or modify this document 6under the terms of the GNU Free Documentation License, Version 1.3 or 7any later version published by the Free Software Foundation; with the 8Invariant Sections being "Free Software" and "Free Software Needs 9Free Documentation", with the Front-Cover Texts being "A GNU Manual," 10and with the Back-Cover Texts as in (a) below. 11 12(a) The FSF's Back-Cover Text is: "You are free to copy and modify 13this GNU Manual. Buying copies from GNU Press supports the FSF in 14developing GNU and promoting software freedom." --> 15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 16<head> 17<title>Debugging with GDB: Trace Files</title> 18 19<meta name="description" content="Debugging with GDB: Trace Files"> 20<meta name="keywords" content="Debugging with GDB: Trace Files"> 21<meta name="resource-type" content="document"> 22<meta name="distribution" content="global"> 23<meta name="Generator" content="makeinfo"> 24<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 25<link href="index.html#Top" rel="start" title="Top"> 26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> 27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 28<link href="Tracepoints.html#Tracepoints" rel="up" title="Tracepoints"> 29<link href="Overlays.html#Overlays" rel="next" title="Overlays"> 30<link href="Tracepoint-Variables.html#Tracepoint-Variables" rel="previous" title="Tracepoint Variables"> 31<style type="text/css"> 32<!-- 33a.summary-letter {text-decoration: none} 34blockquote.smallquotation {font-size: smaller} 35div.display {margin-left: 3.2em} 36div.example {margin-left: 3.2em} 37div.indentedblock {margin-left: 3.2em} 38div.lisp {margin-left: 3.2em} 39div.smalldisplay {margin-left: 3.2em} 40div.smallexample {margin-left: 3.2em} 41div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 42div.smalllisp {margin-left: 3.2em} 43kbd {font-style:oblique} 44pre.display {font-family: inherit} 45pre.format {font-family: inherit} 46pre.menu-comment {font-family: serif} 47pre.menu-preformatted {font-family: serif} 48pre.smalldisplay {font-family: inherit; font-size: smaller} 49pre.smallexample {font-size: smaller} 50pre.smallformat {font-family: inherit; font-size: smaller} 51pre.smalllisp {font-size: smaller} 52span.nocodebreak {white-space:nowrap} 53span.nolinebreak {white-space:nowrap} 54span.roman {font-family:serif; font-weight:normal} 55span.sansserif {font-family:sans-serif; font-weight:normal} 56ul.no-bullet {list-style: none} 57--> 58</style> 59 60 61</head> 62 63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 64<a name="Trace-Files"></a> 65<div class="header"> 66<p> 67Previous: <a href="Tracepoint-Variables.html#Tracepoint-Variables" accesskey="p" rel="previous">Tracepoint Variables</a>, Up: <a href="Tracepoints.html#Tracepoints" accesskey="u" rel="up">Tracepoints</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 68</div> 69<hr> 70<a name="Using-Trace-Files"></a> 71<h3 class="section">13.4 Using Trace Files</h3> 72<a name="index-trace-files"></a> 73 74<p>In some situations, the target running a trace experiment may no 75longer be available; perhaps it crashed, or the hardware was needed 76for a different activity. To handle these cases, you can arrange to 77dump the trace data into a file, and later use that file as a source 78of trace data, via the <code>target tfile</code> command. 79</p> 80<dl compact="compact"> 81<dd> 82<a name="index-tsave"></a> 83</dd> 84<dt><code>tsave [ -r ] <var>filename</var></code></dt> 85<dt><code>tsave [-ctf] <var>dirname</var></code></dt> 86<dd><p>Save the trace data to <var>filename</var>. By default, this command 87assumes that <var>filename</var> refers to the host filesystem, so if 88necessary <small>GDB</small> will copy raw trace data up from the target and 89then save it. If the target supports it, you can also supply the 90optional argument <code>-r</code> (“remote”) to direct the target to save 91the data directly into <var>filename</var> in its own filesystem, which may be 92more efficient if the trace buffer is very large. (Note, however, that 93<code>target tfile</code> can only read from files accessible to the host.) 94By default, this command will save trace frame in tfile format. 95You can supply the optional argument <code>-ctf</code> to save data in CTF 96format. The <em>Common Trace Format</em> (CTF) is proposed as a trace format 97that can be shared by multiple debugging and tracing tools. Please go to 98‘<code>http://www.efficios.com/ctf</code>’ to get more information. 99</p> 100<a name="index-target-tfile"></a> 101<a name="index-tfile"></a> 102<a name="index-target-ctf"></a> 103<a name="index-ctf"></a> 104</dd> 105<dt><code>target tfile <var>filename</var></code></dt> 106<dt><code>target ctf <var>dirname</var></code></dt> 107<dd><p>Use the file named <var>filename</var> or directory named <var>dirname</var> as 108a source of trace data. Commands that examine data work as they do with 109a live target, but it is not possible to run any new trace experiments. 110<code>tstatus</code> will report the state of the trace run at the moment 111the data was saved, as well as the current trace frame you are examining. 112Both <var>filename</var> and <var>dirname</var> must be on a filesystem accessible to 113the host. 114</p> 115<div class="smallexample"> 116<pre class="smallexample">(gdb) target ctf ctf.ctf 117(gdb) tfind 118Found trace frame 0, tracepoint 2 11939 ++a; /* set tracepoint 1 here */ 120(gdb) tdump 121Data collected at tracepoint 2, trace frame 0: 122i = 0 123a = 0 124b = 1 '\001' 125c = {"123", "456", "789", "123", "456", "789"} 126d = {{{a = 1, b = 2}, {a = 3, b = 4}}, {{a = 5, b = 6}, {a = 7, b = 8}}} 127(gdb) p b 128$1 = 1 129</pre></div> 130 131</dd> 132</dl> 133 134<hr> 135<div class="header"> 136<p> 137Previous: <a href="Tracepoint-Variables.html#Tracepoint-Variables" accesskey="p" rel="previous">Tracepoint Variables</a>, Up: <a href="Tracepoints.html#Tracepoints" accesskey="u" rel="up">Tracepoints</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> 138</div> 139 140 141 142</body> 143</html> 144