Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

208 rindas
8.8KB

  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>tfind (Debugging with GDB)</title>
  17. <meta name="description" content="tfind (Debugging with GDB)">
  18. <meta name="keywords" content="tfind (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="Analyze-Collected-Data.html#Analyze-Collected-Data" rel="up" title="Analyze Collected Data">
  26. <link href="tdump.html#tdump" rel="next" title="tdump">
  27. <link href="Analyze-Collected-Data.html#Analyze-Collected-Data" rel="prev" title="Analyze Collected Data">
  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="tfind"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="tdump.html#tdump" accesskey="n" rel="next">tdump</a>, Up: <a href="Analyze-Collected-Data.html#Analyze-Collected-Data" accesskey="u" rel="up">Analyze Collected Data</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="tfind-n"></a>
  64. <h4 class="subsection">13.2.1 <code>tfind <var>n</var></code></h4>
  65. <a name="index-tfind"></a>
  66. <a name="index-select-trace-snapshot"></a>
  67. <a name="index-find-trace-snapshot"></a>
  68. <p>The basic command for selecting a trace snapshot from the buffer is
  69. <code>tfind <var>n</var></code>, which finds trace snapshot number <var>n</var>,
  70. counting from zero. If no argument <var>n</var> is given, the next
  71. snapshot is selected.
  72. </p>
  73. <p>Here are the various forms of using the <code>tfind</code> command.
  74. </p>
  75. <dl compact="compact">
  76. <dt><code>tfind start</code></dt>
  77. <dd><p>Find the first snapshot in the buffer. This is a synonym for
  78. <code>tfind 0</code> (since 0 is the number of the first snapshot).
  79. </p>
  80. </dd>
  81. <dt><code>tfind none</code></dt>
  82. <dd><p>Stop debugging trace snapshots, resume <em>live</em> debugging.
  83. </p>
  84. </dd>
  85. <dt><code>tfind end</code></dt>
  86. <dd><p>Same as &lsquo;<samp>tfind none</samp>&rsquo;.
  87. </p>
  88. </dd>
  89. <dt><code>tfind</code></dt>
  90. <dd><p>No argument means find the next trace snapshot or find the first
  91. one if no trace snapshot is selected.
  92. </p>
  93. </dd>
  94. <dt><code>tfind -</code></dt>
  95. <dd><p>Find the previous trace snapshot before the current one. This permits
  96. retracing earlier steps.
  97. </p>
  98. </dd>
  99. <dt><code>tfind tracepoint <var>num</var></code></dt>
  100. <dd><p>Find the next snapshot associated with tracepoint <var>num</var>. Search
  101. proceeds forward from the last examined trace snapshot. If no
  102. argument <var>num</var> is given, it means find the next snapshot collected
  103. for the same tracepoint as the current snapshot.
  104. </p>
  105. </dd>
  106. <dt><code>tfind pc <var>addr</var></code></dt>
  107. <dd><p>Find the next snapshot associated with the value <var>addr</var> of the
  108. program counter. Search proceeds forward from the last examined trace
  109. snapshot. If no argument <var>addr</var> is given, it means find the next
  110. snapshot with the same value of PC as the current snapshot.
  111. </p>
  112. </dd>
  113. <dt><code>tfind outside <var>addr1</var>, <var>addr2</var></code></dt>
  114. <dd><p>Find the next snapshot whose PC is outside the given range of
  115. addresses (exclusive).
  116. </p>
  117. </dd>
  118. <dt><code>tfind range <var>addr1</var>, <var>addr2</var></code></dt>
  119. <dd><p>Find the next snapshot whose PC is between <var>addr1</var> and
  120. <var>addr2</var> (inclusive).
  121. </p>
  122. </dd>
  123. <dt><code>tfind line <span class="roman">[</span><var>file</var>:<span class="roman">]</span><var>n</var></code></dt>
  124. <dd><p>Find the next snapshot associated with the source line <var>n</var>. If
  125. the optional argument <var>file</var> is given, refer to line <var>n</var> in
  126. that source file. Search proceeds forward from the last examined
  127. trace snapshot. If no argument <var>n</var> is given, it means find the
  128. next line other than the one currently being examined; thus saying
  129. <code>tfind line</code> repeatedly can appear to have the same effect as
  130. stepping from line to line in a <em>live</em> debugging session.
  131. </p></dd>
  132. </dl>
  133. <p>The default arguments for the <code>tfind</code> commands are specifically
  134. designed to make it easy to scan through the trace buffer. For
  135. instance, <code>tfind</code> with no argument selects the next trace
  136. snapshot, and <code>tfind -</code> with no argument selects the previous
  137. trace snapshot. So, by giving one <code>tfind</code> command, and then
  138. simply hitting <tt class="key">RET</tt> repeatedly you can examine all the trace
  139. snapshots in order. Or, by saying <code>tfind -</code> and then hitting
  140. <tt class="key">RET</tt> repeatedly you can examine the snapshots in reverse order.
  141. The <code>tfind line</code> command with no argument selects the snapshot
  142. for the next source line executed. The <code>tfind pc</code> command with
  143. no argument selects the next snapshot with the same program counter
  144. (PC) as the current frame. The <code>tfind tracepoint</code> command with
  145. no argument selects the next trace snapshot collected by the same
  146. tracepoint as the current one.
  147. </p>
  148. <p>In addition to letting you scan through the trace buffer manually,
  149. these commands make it easy to construct <small>GDB</small> scripts that
  150. scan through the trace buffer and print out whatever collected data
  151. you are interested in. Thus, if we want to examine the PC, FP, and SP
  152. registers from each trace frame in the buffer, we can say this:
  153. </p>
  154. <div class="smallexample">
  155. <pre class="smallexample">(gdb) <b>tfind start</b>
  156. (gdb) <b>while ($trace_frame != -1)</b>
  157. &gt; printf &quot;Frame %d, PC = %08X, SP = %08X, FP = %08X\n&quot;, \
  158. $trace_frame, $pc, $sp, $fp
  159. &gt; tfind
  160. &gt; end
  161. Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44
  162. Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44
  163. Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44
  164. Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44
  165. Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44
  166. Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44
  167. Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44
  168. Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44
  169. Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44
  170. Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44
  171. Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
  172. </pre></div>
  173. <p>Or, if we want to examine the variable <code>X</code> at each source line in
  174. the buffer:
  175. </p>
  176. <div class="smallexample">
  177. <pre class="smallexample">(gdb) <b>tfind start</b>
  178. (gdb) <b>while ($trace_frame != -1)</b>
  179. &gt; printf &quot;Frame %d, X == %d\n&quot;, $trace_frame, X
  180. &gt; tfind line
  181. &gt; end
  182. Frame 0, X = 1
  183. Frame 7, X = 2
  184. Frame 13, X = 255
  185. </pre></div>
  186. <hr>
  187. <div class="header">
  188. <p>
  189. Next: <a href="tdump.html#tdump" accesskey="n" rel="next">tdump</a>, Up: <a href="Analyze-Collected-Data.html#Analyze-Collected-Data" accesskey="u" rel="up">Analyze Collected Data</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>
  190. </div>
  191. </body>
  192. </html>