Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

269 lines
12KB

  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-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Starting and Stopping Trace Experiments (Debugging with GDB)</title>
  17. <meta name="description" content="Starting and Stopping Trace Experiments (Debugging with GDB)">
  18. <meta name="keywords" content="Starting and Stopping Trace Experiments (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Set-Tracepoints.html#Set-Tracepoints" rel="up" title="Set Tracepoints">
  26. <link href="Tracepoint-Restrictions.html#Tracepoint-Restrictions" rel="next" title="Tracepoint Restrictions">
  27. <link href="Listing-Static-Tracepoint-Markers.html#Listing-Static-Tracepoint-Markers" rel="prev" title="Listing Static Tracepoint Markers">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Starting-and-Stopping-Trace-Experiments"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Tracepoint-Restrictions.html#Tracepoint-Restrictions" accesskey="n" rel="next">Tracepoint Restrictions</a>, Previous: <a href="Listing-Static-Tracepoint-Markers.html#Listing-Static-Tracepoint-Markers" accesskey="p" rel="prev">Listing Static Tracepoint Markers</a>, Up: <a href="Set-Tracepoints.html#Set-Tracepoints" accesskey="u" rel="up">Set Tracepoints</a> &nbsp; [<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>
  61. </div>
  62. <hr>
  63. <a name="Starting-and-Stopping-Trace-Experiments-1"></a>
  64. <h4 class="subsection">13.1.9 Starting and Stopping Trace Experiments</h4>
  65. <dl compact="compact">
  66. <dd><a name="index-tstart-_005b-notes-_005d"></a>
  67. <a name="index-start-a-new-trace-experiment"></a>
  68. <a name="index-collected-data-discarded"></a>
  69. </dd>
  70. <dt><code>tstart</code></dt>
  71. <dd><p>This command starts the trace experiment, and begins collecting data.
  72. It has the side effect of discarding all the data collected in the
  73. trace buffer during the previous trace experiment. If any arguments
  74. are supplied, they are taken as a note and stored with the trace
  75. experiment&rsquo;s state. The notes may be arbitrary text, and are
  76. especially useful with disconnected tracing in a multi-user context;
  77. the notes can explain what the trace is doing, supply user contact
  78. information, and so forth.
  79. </p>
  80. <a name="index-tstop-_005b-notes-_005d"></a>
  81. <a name="index-stop-a-running-trace-experiment"></a>
  82. </dd>
  83. <dt><code>tstop</code></dt>
  84. <dd><p>This command stops the trace experiment. If any arguments are
  85. supplied, they are recorded with the experiment as a note. This is
  86. useful if you are stopping a trace started by someone else, for
  87. instance if the trace is interfering with the system&rsquo;s behavior and
  88. needs to be stopped quickly.
  89. </p>
  90. <p><strong>Note</strong>: a trace experiment and data collection may stop
  91. automatically if any tracepoint&rsquo;s passcount is reached
  92. (see <a href="Tracepoint-Passcounts.html#Tracepoint-Passcounts">Tracepoint Passcounts</a>), or if the trace buffer becomes full.
  93. </p>
  94. <a name="index-tstatus"></a>
  95. <a name="index-status-of-trace-data-collection"></a>
  96. <a name="index-trace-experiment_002c-status-of"></a>
  97. </dd>
  98. <dt><code>tstatus</code></dt>
  99. <dd><p>This command displays the status of the current trace data
  100. collection.
  101. </p></dd>
  102. </dl>
  103. <p>Here is an example of the commands we described so far:
  104. </p>
  105. <div class="smallexample">
  106. <pre class="smallexample">(gdb) <b>trace gdb_c_test</b>
  107. (gdb) <b>actions</b>
  108. Enter actions for tracepoint #1, one per line.
  109. &gt; collect $regs,$locals,$args
  110. &gt; while-stepping 11
  111. &gt; collect $regs
  112. &gt; end
  113. &gt; end
  114. (gdb) <b>tstart</b>
  115. [time passes &hellip;]
  116. (gdb) <b>tstop</b>
  117. </pre></div>
  118. <a name="disconnected-tracing"></a><a name="index-disconnected-tracing"></a>
  119. <p>You can choose to continue running the trace experiment even if
  120. <small>GDB</small> disconnects from the target, voluntarily or
  121. involuntarily. For commands such as <code>detach</code>, the debugger will
  122. ask what you want to do with the trace. But for unexpected
  123. terminations (<small>GDB</small> crash, network outage), it would be
  124. unfortunate to lose hard-won trace data, so the variable
  125. <code>disconnected-tracing</code> lets you decide whether the trace should
  126. continue running without <small>GDB</small>.
  127. </p>
  128. <dl compact="compact">
  129. <dt><code>set disconnected-tracing on</code></dt>
  130. <dt><code>set disconnected-tracing off</code></dt>
  131. <dd><a name="index-set-disconnected_002dtracing"></a>
  132. <p>Choose whether a tracing run should continue to run if <small>GDB</small>
  133. has disconnected from the target. Note that <code>detach</code> or
  134. <code>quit</code> will ask you directly what to do about a running trace no
  135. matter what this variable&rsquo;s setting, so the variable is mainly useful
  136. for handling unexpected situations, such as loss of the network.
  137. </p>
  138. </dd>
  139. <dt><code>show disconnected-tracing</code></dt>
  140. <dd><a name="index-show-disconnected_002dtracing"></a>
  141. <p>Show the current choice for disconnected tracing.
  142. </p>
  143. </dd>
  144. </dl>
  145. <p>When you reconnect to the target, the trace experiment may or may not
  146. still be running; it might have filled the trace buffer in the
  147. meantime, or stopped for one of the other reasons. If it is running,
  148. it will continue after reconnection.
  149. </p>
  150. <p>Upon reconnection, the target will upload information about the
  151. tracepoints in effect. <small>GDB</small> will then compare that
  152. information to the set of tracepoints currently defined, and attempt
  153. to match them up, allowing for the possibility that the numbers may
  154. have changed due to creation and deletion in the meantime. If one of
  155. the target&rsquo;s tracepoints does not match any in <small>GDB</small>, the
  156. debugger will create a new tracepoint, so that you have a number with
  157. which to specify that tracepoint. This matching-up process is
  158. necessarily heuristic, and it may result in useless tracepoints being
  159. created; you may simply delete them if they are of no use.
  160. </p>
  161. <a name="index-circular-trace-buffer"></a>
  162. <p>If your target agent supports a <em>circular trace buffer</em>, then you
  163. can run a trace experiment indefinitely without filling the trace
  164. buffer; when space runs out, the agent deletes already-collected trace
  165. frames, oldest first, until there is enough room to continue
  166. collecting. This is especially useful if your tracepoints are being
  167. hit too often, and your trace gets terminated prematurely because the
  168. buffer is full. To ask for a circular trace buffer, simply set
  169. &lsquo;<samp>circular-trace-buffer</samp>&rsquo; to on. You can set this at any time,
  170. including during tracing; if the agent can do it, it will change
  171. buffer handling on the fly, otherwise it will not take effect until
  172. the next run.
  173. </p>
  174. <dl compact="compact">
  175. <dt><code>set circular-trace-buffer on</code></dt>
  176. <dt><code>set circular-trace-buffer off</code></dt>
  177. <dd><a name="index-set-circular_002dtrace_002dbuffer"></a>
  178. <p>Choose whether a tracing run should use a linear or circular buffer
  179. for trace data. A linear buffer will not lose any trace data, but may
  180. fill up prematurely, while a circular buffer will discard old trace
  181. data, but it will have always room for the latest tracepoint hits.
  182. </p>
  183. </dd>
  184. <dt><code>show circular-trace-buffer</code></dt>
  185. <dd><a name="index-show-circular_002dtrace_002dbuffer"></a>
  186. <p>Show the current choice for the trace buffer. Note that this may not
  187. match the agent&rsquo;s current buffer handling, nor is it guaranteed to
  188. match the setting that might have been in effect during a past run,
  189. for instance if you are looking at frames from a trace file.
  190. </p>
  191. </dd>
  192. </dl>
  193. <dl compact="compact">
  194. <dt><code>set trace-buffer-size <var>n</var></code></dt>
  195. <dt><code>set trace-buffer-size unlimited</code></dt>
  196. <dd><a name="index-set-trace_002dbuffer_002dsize"></a>
  197. <p>Request that the target use a trace buffer of <var>n</var> bytes. Not all
  198. targets will honor the request; they may have a compiled-in size for
  199. the trace buffer, or some other limitation. Set to a value of
  200. <code>unlimited</code> or <code>-1</code> to let the target use whatever size it
  201. likes. This is also the default.
  202. </p>
  203. </dd>
  204. <dt><code>show trace-buffer-size</code></dt>
  205. <dd><a name="index-show-trace_002dbuffer_002dsize"></a>
  206. <p>Show the current requested size for the trace buffer. Note that this
  207. will only match the actual size if the target supports size-setting,
  208. and was able to handle the requested size. For instance, if the
  209. target can only change buffer size between runs, this variable will
  210. not reflect the change until the next run starts. Use <code>tstatus</code>
  211. to get a report of the actual buffer size.
  212. </p></dd>
  213. </dl>
  214. <dl compact="compact">
  215. <dt><code>set trace-user <var>text</var></code></dt>
  216. <dd><a name="index-set-trace_002duser"></a>
  217. </dd>
  218. <dt><code>show trace-user</code></dt>
  219. <dd><a name="index-show-trace_002duser"></a>
  220. </dd>
  221. <dt><code>set trace-notes <var>text</var></code></dt>
  222. <dd><a name="index-set-trace_002dnotes"></a>
  223. <p>Set the trace run&rsquo;s notes.
  224. </p>
  225. </dd>
  226. <dt><code>show trace-notes</code></dt>
  227. <dd><a name="index-show-trace_002dnotes"></a>
  228. <p>Show the trace run&rsquo;s notes.
  229. </p>
  230. </dd>
  231. <dt><code>set trace-stop-notes <var>text</var></code></dt>
  232. <dd><a name="index-set-trace_002dstop_002dnotes"></a>
  233. <p>Set the trace run&rsquo;s stop notes. The handling of the note is as for
  234. <code>tstop</code> arguments; the set command is convenient way to fix a
  235. stop note that is mistaken or incomplete.
  236. </p>
  237. </dd>
  238. <dt><code>show trace-stop-notes</code></dt>
  239. <dd><a name="index-show-trace_002dstop_002dnotes"></a>
  240. <p>Show the trace run&rsquo;s stop notes.
  241. </p>
  242. </dd>
  243. </dl>
  244. <hr>
  245. <div class="header">
  246. <p>
  247. Next: <a href="Tracepoint-Restrictions.html#Tracepoint-Restrictions" accesskey="n" rel="next">Tracepoint Restrictions</a>, Previous: <a href="Listing-Static-Tracepoint-Markers.html#Listing-Static-Tracepoint-Markers" accesskey="p" rel="prev">Listing Static Tracepoint Markers</a>, Up: <a href="Set-Tracepoints.html#Set-Tracepoints" accesskey="u" rel="up">Set Tracepoints</a> &nbsp; [<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>
  248. </div>
  249. </body>
  250. </html>