You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

681 lines
29KB

  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>Process Record and Replay (Debugging with GDB)</title>
  17. <meta name="description" content="Process Record and Replay (Debugging with GDB)">
  18. <meta name="keywords" content="Process Record and Replay (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="index.html#Top" rel="up" title="Top">
  26. <link href="Stack.html#Stack" rel="next" title="Stack">
  27. <link href="Reverse-Execution.html#Reverse-Execution" rel="prev" title="Reverse Execution">
  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="Process-Record-and-Replay"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Stack.html#Stack" accesskey="n" rel="next">Stack</a>, Previous: <a href="Reverse-Execution.html#Reverse-Execution" accesskey="p" rel="prev">Reverse Execution</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</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="Recording-Inferior_0027s-Execution-and-Replaying-It"></a>
  64. <h2 class="chapter">7 Recording Inferior&rsquo;s Execution and Replaying It</h2>
  65. <a name="index-process-record-and-replay"></a>
  66. <a name="index-recording-inferior_0027s-execution-and-replaying-it"></a>
  67. <p>On some platforms, <small>GDB</small> provides a special <em>process record
  68. and replay</em> target that can record a log of the process execution, and
  69. replay it later with both forward and reverse execution commands.
  70. </p>
  71. <a name="index-replay-mode"></a>
  72. <p>When this target is in use, if the execution log includes the record
  73. for the next instruction, <small>GDB</small> will debug in <em>replay
  74. mode</em>. In the replay mode, the inferior does not really execute code
  75. instructions. Instead, all the events that normally happen during
  76. code execution are taken from the execution log. While code is not
  77. really executed in replay mode, the values of registers (including the
  78. program counter register) and the memory of the inferior are still
  79. changed as they normally would. Their contents are taken from the
  80. execution log.
  81. </p>
  82. <a name="index-record-mode"></a>
  83. <p>If the record for the next instruction is not in the execution log,
  84. <small>GDB</small> will debug in <em>record mode</em>. In this mode, the
  85. inferior executes normally, and <small>GDB</small> records the execution log
  86. for future replay.
  87. </p>
  88. <p>The process record and replay target supports reverse execution
  89. (see <a href="Reverse-Execution.html#Reverse-Execution">Reverse Execution</a>), even if the platform on which the
  90. inferior runs does not. However, the reverse execution is limited in
  91. this case by the range of the instructions recorded in the execution
  92. log. In other words, reverse execution on platforms that don&rsquo;t
  93. support it directly can only be done in the replay mode.
  94. </p>
  95. <p>When debugging in the reverse direction, <small>GDB</small> will work in
  96. replay mode as long as the execution log includes the record for the
  97. previous instruction; otherwise, it will work in record mode, if the
  98. platform supports reverse execution, or stop if not.
  99. </p>
  100. <p>Currently, process record and replay is supported on ARM, Aarch64,
  101. Moxie, PowerPC, PowerPC64, S/390, and x86 (i386/amd64) running
  102. GNU/Linux. Process record and replay can be used both when native
  103. debugging, and when remote debugging via <code>gdbserver</code>.
  104. </p>
  105. <p>For architecture environments that support process record and replay,
  106. <small>GDB</small> provides the following commands:
  107. </p>
  108. <dl compact="compact">
  109. <dd><a name="index-target-record"></a>
  110. <a name="index-target-record_002dfull"></a>
  111. <a name="index-target-record_002dbtrace"></a>
  112. <a name="index-record"></a>
  113. <a name="index-record-full"></a>
  114. <a name="index-record-btrace"></a>
  115. <a name="index-record-btrace-bts"></a>
  116. <a name="index-record-btrace-pt"></a>
  117. <a name="index-record-bts"></a>
  118. <a name="index-record-pt"></a>
  119. <a name="index-rec"></a>
  120. <a name="index-rec-full"></a>
  121. <a name="index-rec-btrace"></a>
  122. <a name="index-rec-btrace-bts"></a>
  123. <a name="index-rec-btrace-pt"></a>
  124. <a name="index-rec-bts"></a>
  125. <a name="index-rec-pt"></a>
  126. </dd>
  127. <dt><code>record <var>method</var></code></dt>
  128. <dd><p>This command starts the process record and replay target. The
  129. recording method can be specified as parameter. Without a parameter
  130. the command uses the <code>full</code> recording method. The following
  131. recording methods are available:
  132. </p>
  133. <dl compact="compact">
  134. <dt><code>full</code></dt>
  135. <dd><p>Full record/replay recording using <small>GDB</small>&rsquo;s software record and
  136. replay implementation. This method allows replaying and reverse
  137. execution.
  138. </p>
  139. </dd>
  140. <dt><code>btrace <var>format</var></code></dt>
  141. <dd><p>Hardware-supported instruction recording, supported on Intel
  142. processors. This method does not record data. Further, the data is
  143. collected in a ring buffer so old data will be overwritten when the
  144. buffer is full. It allows limited reverse execution. Variables and
  145. registers are not available during reverse execution. In remote
  146. debugging, recording continues on disconnect. Recorded data can be
  147. inspected after reconnecting. The recording may be stopped using
  148. <code>record stop</code>.
  149. </p>
  150. <p>The recording format can be specified as parameter. Without a parameter
  151. the command chooses the recording format. The following recording
  152. formats are available:
  153. </p>
  154. <dl compact="compact">
  155. <dt><code>bts</code></dt>
  156. <dd><a name="index-branch-trace-store"></a>
  157. <p>Use the <em>Branch Trace Store</em> (<acronym>BTS</acronym>) recording format. In
  158. this format, the processor stores a from/to record for each executed
  159. branch in the btrace ring buffer.
  160. </p>
  161. </dd>
  162. <dt><code>pt</code></dt>
  163. <dd><a name="index-Intel-Processor-Trace"></a>
  164. <p>Use the <em>Intel Processor Trace</em> recording format. In this
  165. format, the processor stores the execution trace in a compressed form
  166. that is afterwards decoded by <small>GDB</small>.
  167. </p>
  168. <p>The trace can be recorded with very low overhead. The compressed
  169. trace format also allows small trace buffers to already contain a big
  170. number of instructions compared to <acronym>BTS</acronym>.
  171. </p>
  172. <p>Decoding the recorded execution trace, on the other hand, is more
  173. expensive than decoding <acronym>BTS</acronym> trace. This is mostly due to the
  174. increased number of instructions to process. You should increase the
  175. buffer-size with care.
  176. </p></dd>
  177. </dl>
  178. <p>Not all recording formats may be available on all processors.
  179. </p></dd>
  180. </dl>
  181. <p>The process record and replay target can only debug a process that is
  182. already running. Therefore, you need first to start the process with
  183. the <kbd>run</kbd> or <kbd>start</kbd> commands, and then start the recording
  184. with the <kbd>record <var>method</var></kbd> command.
  185. </p>
  186. <a name="index-displaced-stepping_002c-and-process-record-and-replay"></a>
  187. <p>Displaced stepping (see <a href="Maintenance-Commands.html#Maintenance-Commands">displaced stepping</a>)
  188. will be automatically disabled when process record and replay target
  189. is started. That&rsquo;s because the process record and replay target
  190. doesn&rsquo;t support displaced stepping.
  191. </p>
  192. <a name="index-non_002dstop-mode_002c-and-process-record-and-replay"></a>
  193. <a name="index-asynchronous-execution_002c-and-process-record-and-replay"></a>
  194. <p>If the inferior is in the non-stop mode (see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>) or in
  195. the asynchronous execution mode (see <a href="Background-Execution.html#Background-Execution">Background Execution</a>), not
  196. all recording methods are available. The <code>full</code> recording method
  197. does not support these two modes.
  198. </p>
  199. <a name="index-record-stop"></a>
  200. <a name="index-rec-s"></a>
  201. </dd>
  202. <dt><code>record stop</code></dt>
  203. <dd><p>Stop the process record and replay target. When process record and
  204. replay target stops, the entire execution log will be deleted and the
  205. inferior will either be terminated, or will remain in its final state.
  206. </p>
  207. <p>When you stop the process record and replay target in record mode (at
  208. the end of the execution log), the inferior will be stopped at the
  209. next instruction that would have been recorded. In other words, if
  210. you record for a while and then stop recording, the inferior process
  211. will be left in the same state as if the recording never happened.
  212. </p>
  213. <p>On the other hand, if the process record and replay target is stopped
  214. while in replay mode (that is, not at the end of the execution log,
  215. but at some earlier point), the inferior process will become &ldquo;live&rdquo;
  216. at that earlier state, and it will then be possible to continue the
  217. usual &ldquo;live&rdquo; debugging of the process from that state.
  218. </p>
  219. <p>When the inferior process exits, or <small>GDB</small> detaches from it,
  220. process record and replay target will automatically stop itself.
  221. </p>
  222. <a name="index-record-goto"></a>
  223. </dd>
  224. <dt><code>record goto</code></dt>
  225. <dd><p>Go to a specific location in the execution log. There are several
  226. ways to specify the location to go to:
  227. </p>
  228. <dl compact="compact">
  229. <dt><code>record goto begin</code></dt>
  230. <dt><code>record goto start</code></dt>
  231. <dd><p>Go to the beginning of the execution log.
  232. </p>
  233. </dd>
  234. <dt><code>record goto end</code></dt>
  235. <dd><p>Go to the end of the execution log.
  236. </p>
  237. </dd>
  238. <dt><code>record goto <var>n</var></code></dt>
  239. <dd><p>Go to instruction number <var>n</var> in the execution log.
  240. </p></dd>
  241. </dl>
  242. <a name="index-record-save"></a>
  243. </dd>
  244. <dt><code>record save <var>filename</var></code></dt>
  245. <dd><p>Save the execution log to a file <samp><var>filename</var></samp>.
  246. Default filename is <samp>gdb_record.<var>process_id</var></samp>, where
  247. <var>process_id</var> is the process ID of the inferior.
  248. </p>
  249. <p>This command may not be available for all recording methods.
  250. </p>
  251. <a name="index-record-restore"></a>
  252. </dd>
  253. <dt><code>record restore <var>filename</var></code></dt>
  254. <dd><p>Restore the execution log from a file <samp><var>filename</var></samp>.
  255. File must have been created with <code>record save</code>.
  256. </p>
  257. <a name="index-set-record-full"></a>
  258. </dd>
  259. <dt><code>set record full insn-number-max <var>limit</var></code></dt>
  260. <dt><code>set record full insn-number-max unlimited</code></dt>
  261. <dd><p>Set the limit of instructions to be recorded for the <code>full</code>
  262. recording method. Default value is 200000.
  263. </p>
  264. <p>If <var>limit</var> is a positive number, then <small>GDB</small> will start
  265. deleting instructions from the log once the number of the record
  266. instructions becomes greater than <var>limit</var>. For every new recorded
  267. instruction, <small>GDB</small> will delete the earliest recorded
  268. instruction to keep the number of recorded instructions at the limit.
  269. (Since deleting recorded instructions loses information, <small>GDB</small>
  270. lets you control what happens when the limit is reached, by means of
  271. the <code>stop-at-limit</code> option, described below.)
  272. </p>
  273. <p>If <var>limit</var> is <code>unlimited</code> or zero, <small>GDB</small> will never
  274. delete recorded instructions from the execution log. The number of
  275. recorded instructions is limited only by the available memory.
  276. </p>
  277. <a name="index-show-record-full"></a>
  278. </dd>
  279. <dt><code>show record full insn-number-max</code></dt>
  280. <dd><p>Show the limit of instructions to be recorded with the <code>full</code>
  281. recording method.
  282. </p>
  283. </dd>
  284. <dt><code>set record full stop-at-limit</code></dt>
  285. <dd><p>Control the behavior of the <code>full</code> recording method when the
  286. number of recorded instructions reaches the limit. If ON (the
  287. default), <small>GDB</small> will stop when the limit is reached for the
  288. first time and ask you whether you want to stop the inferior or
  289. continue running it and recording the execution log. If you decide
  290. to continue recording, each new recorded instruction will cause the
  291. oldest one to be deleted.
  292. </p>
  293. <p>If this option is OFF, <small>GDB</small> will automatically delete the
  294. oldest record to make room for each new one, without asking.
  295. </p>
  296. </dd>
  297. <dt><code>show record full stop-at-limit</code></dt>
  298. <dd><p>Show the current setting of <code>stop-at-limit</code>.
  299. </p>
  300. </dd>
  301. <dt><code>set record full memory-query</code></dt>
  302. <dd><p>Control the behavior when <small>GDB</small> is unable to record memory
  303. changes caused by an instruction for the <code>full</code> recording method.
  304. If ON, <small>GDB</small> will query whether to stop the inferior in that
  305. case.
  306. </p>
  307. <p>If this option is OFF (the default), <small>GDB</small> will automatically
  308. ignore the effect of such instructions on memory. Later, when
  309. <small>GDB</small> replays this execution log, it will mark the log of this
  310. instruction as not accessible, and it will not affect the replay
  311. results.
  312. </p>
  313. </dd>
  314. <dt><code>show record full memory-query</code></dt>
  315. <dd><p>Show the current setting of <code>memory-query</code>.
  316. </p>
  317. <a name="index-set-record-btrace"></a>
  318. <p>The <code>btrace</code> record target does not trace data. As a
  319. convenience, when replaying, <small>GDB</small> reads read-only memory off
  320. the live program directly, assuming that the addresses of the
  321. read-only areas don&rsquo;t change. This for example makes it possible to
  322. disassemble code while replaying, but not to print variables.
  323. In some cases, being able to inspect variables might be useful.
  324. You can use the following command for that:
  325. </p>
  326. </dd>
  327. <dt><code>set record btrace replay-memory-access</code></dt>
  328. <dd><p>Control the behavior of the <code>btrace</code> recording method when
  329. accessing memory during replay. If <code>read-only</code> (the default),
  330. <small>GDB</small> will only allow accesses to read-only memory.
  331. If <code>read-write</code>, <small>GDB</small> will allow accesses to read-only
  332. and to read-write memory. Beware that the accessed memory corresponds
  333. to the live target and not necessarily to the current replay
  334. position.
  335. </p>
  336. </dd>
  337. <dt><code>set record btrace cpu <var>identifier</var></code></dt>
  338. <dd><p>Set the processor to be used for enabling workarounds for processor
  339. errata when decoding the trace.
  340. </p>
  341. <p>Processor errata are defects in processor operation, caused by its
  342. design or manufacture. They can cause a trace not to match the
  343. specification. This, in turn, may cause trace decode to fail.
  344. <small>GDB</small> can detect erroneous trace packets and correct them, thus
  345. avoiding the decoding failures. These corrections are known as
  346. <em>errata workarounds</em>, and are enabled based on the processor on
  347. which the trace was recorded.
  348. </p>
  349. <p>By default, <small>GDB</small> attempts to detect the processor
  350. automatically, and apply the necessary workarounds for it. However,
  351. you may need to specify the processor if <small>GDB</small> does not yet
  352. support it. This command allows you to do that, and also allows to
  353. disable the workarounds.
  354. </p>
  355. <p>The argument <var>identifier</var> identifies the <small>CPU</small> and is of the
  356. form: <code><var>vendor</var>:<var>processor identifier</var></code>. In addition,
  357. there are two special identifiers, <code>none</code> and <code>auto</code>
  358. (default).
  359. </p>
  360. <p>The following vendor identifiers and corresponding processor
  361. identifiers are currently supported:
  362. </p>
  363. <table>
  364. <tr><td width="10%"><code>intel</code></td><td width="90%"><var>family</var>/<var>model</var>[/<var>stepping</var>]</td></tr>
  365. </table>
  366. <p>On GNU/Linux systems, the processor <var>family</var>, <var>model</var>, and
  367. <var>stepping</var> can be obtained from <code>/proc/cpuinfo</code>.
  368. </p>
  369. <p>If <var>identifier</var> is <code>auto</code>, enable errata workarounds for the
  370. processor on which the trace was recorded. If <var>identifier</var> is
  371. <code>none</code>, errata workarounds are disabled.
  372. </p>
  373. <p>For example, when using an old <small>GDB</small> on a new system, decode
  374. may fail because <small>GDB</small> does not support the new processor. It
  375. often suffices to specify an older processor that <small>GDB</small>
  376. supports.
  377. </p>
  378. <div class="smallexample">
  379. <pre class="smallexample">(gdb) info record
  380. Active record target: record-btrace
  381. Recording format: Intel Processor Trace.
  382. Buffer size: 16kB.
  383. Failed to configure the Intel Processor Trace decoder: unknown cpu.
  384. (gdb) set record btrace cpu intel:6/158
  385. (gdb) info record
  386. Active record target: record-btrace
  387. Recording format: Intel Processor Trace.
  388. Buffer size: 16kB.
  389. Recorded 84872 instructions in 3189 functions (0 gaps) for thread 1 (...).
  390. </pre></div>
  391. <a name="index-show-record-btrace"></a>
  392. </dd>
  393. <dt><code>show record btrace replay-memory-access</code></dt>
  394. <dd><p>Show the current setting of <code>replay-memory-access</code>.
  395. </p>
  396. </dd>
  397. <dt><code>show record btrace cpu</code></dt>
  398. <dd><p>Show the processor to be used for enabling trace decode errata
  399. workarounds.
  400. </p>
  401. <a name="index-set-record-btrace-bts"></a>
  402. </dd>
  403. <dt><code>set record btrace bts buffer-size <var>size</var></code></dt>
  404. <dt><code>set record btrace bts buffer-size unlimited</code></dt>
  405. <dd><p>Set the requested ring buffer size for branch tracing in <acronym>BTS</acronym>
  406. format. Default is 64KB.
  407. </p>
  408. <p>If <var>size</var> is a positive number, then <small>GDB</small> will try to
  409. allocate a buffer of at least <var>size</var> bytes for each new thread
  410. that uses the btrace recording method and the <acronym>BTS</acronym> format.
  411. The actually obtained buffer size may differ from the requested
  412. <var>size</var>. Use the <code>info record</code> command to see the actual
  413. buffer size for each thread that uses the btrace recording method and
  414. the <acronym>BTS</acronym> format.
  415. </p>
  416. <p>If <var>limit</var> is <code>unlimited</code> or zero, <small>GDB</small> will try to
  417. allocate a buffer of 4MB.
  418. </p>
  419. <p>Bigger buffers mean longer traces. On the other hand, <small>GDB</small> will
  420. also need longer to process the branch trace data before it can be used.
  421. </p>
  422. </dd>
  423. <dt><code>show record btrace bts buffer-size <var>size</var></code></dt>
  424. <dd><p>Show the current setting of the requested ring buffer size for branch
  425. tracing in <acronym>BTS</acronym> format.
  426. </p>
  427. <a name="index-set-record-btrace-pt"></a>
  428. </dd>
  429. <dt><code>set record btrace pt buffer-size <var>size</var></code></dt>
  430. <dt><code>set record btrace pt buffer-size unlimited</code></dt>
  431. <dd><p>Set the requested ring buffer size for branch tracing in Intel
  432. Processor Trace format. Default is 16KB.
  433. </p>
  434. <p>If <var>size</var> is a positive number, then <small>GDB</small> will try to
  435. allocate a buffer of at least <var>size</var> bytes for each new thread
  436. that uses the btrace recording method and the Intel Processor Trace
  437. format. The actually obtained buffer size may differ from the
  438. requested <var>size</var>. Use the <code>info record</code> command to see the
  439. actual buffer size for each thread.
  440. </p>
  441. <p>If <var>limit</var> is <code>unlimited</code> or zero, <small>GDB</small> will try to
  442. allocate a buffer of 4MB.
  443. </p>
  444. <p>Bigger buffers mean longer traces. On the other hand, <small>GDB</small> will
  445. also need longer to process the branch trace data before it can be used.
  446. </p>
  447. </dd>
  448. <dt><code>show record btrace pt buffer-size <var>size</var></code></dt>
  449. <dd><p>Show the current setting of the requested ring buffer size for branch
  450. tracing in Intel Processor Trace format.
  451. </p>
  452. <a name="index-info-record"></a>
  453. </dd>
  454. <dt><code>info record</code></dt>
  455. <dd><p>Show various statistics about the recording depending on the recording
  456. method:
  457. </p>
  458. <dl compact="compact">
  459. <dt><code>full</code></dt>
  460. <dd><p>For the <code>full</code> recording method, it shows the state of process
  461. record and its in-memory execution log buffer, including:
  462. </p>
  463. <ul>
  464. <li> Whether in record mode or replay mode.
  465. </li><li> Lowest recorded instruction number (counting from when the current execution log started recording instructions).
  466. </li><li> Highest recorded instruction number.
  467. </li><li> Current instruction about to be replayed (if in replay mode).
  468. </li><li> Number of instructions contained in the execution log.
  469. </li><li> Maximum number of instructions that may be contained in the execution log.
  470. </li></ul>
  471. </dd>
  472. <dt><code>btrace</code></dt>
  473. <dd><p>For the <code>btrace</code> recording method, it shows:
  474. </p>
  475. <ul>
  476. <li> Recording format.
  477. </li><li> Number of instructions that have been recorded.
  478. </li><li> Number of blocks of sequential control-flow formed by the recorded
  479. instructions.
  480. </li><li> Whether in record mode or replay mode.
  481. </li></ul>
  482. <p>For the <code>bts</code> recording format, it also shows:
  483. </p><ul>
  484. <li> Size of the perf ring buffer.
  485. </li></ul>
  486. <p>For the <code>pt</code> recording format, it also shows:
  487. </p><ul>
  488. <li> Size of the perf ring buffer.
  489. </li></ul>
  490. </dd>
  491. </dl>
  492. <a name="index-record-delete"></a>
  493. <a name="index-rec-del"></a>
  494. </dd>
  495. <dt><code>record delete</code></dt>
  496. <dd><p>When record target runs in replay mode (&ldquo;in the past&rdquo;), delete the
  497. subsequent execution log and begin to record a new execution log starting
  498. from the current address. This means you will abandon the previously
  499. recorded &ldquo;future&rdquo; and begin recording a new &ldquo;future&rdquo;.
  500. </p>
  501. <a name="index-record-instruction_002dhistory"></a>
  502. <a name="index-rec-instruction_002dhistory"></a>
  503. </dd>
  504. <dt><code>record instruction-history</code></dt>
  505. <dd><p>Disassembles instructions from the recorded execution log. By
  506. default, ten instructions are disassembled. This can be changed using
  507. the <code>set record instruction-history-size</code> command. Instructions
  508. are printed in execution order.
  509. </p>
  510. <p>It can also print mixed source+disassembly if you specify the the
  511. <code>/m</code> or <code>/s</code> modifier, and print the raw instructions in hex
  512. as well as in symbolic form by specifying the <code>/r</code> modifier.
  513. </p>
  514. <p>The current position marker is printed for the instruction at the
  515. current program counter value. This instruction can appear multiple
  516. times in the trace and the current position marker will be printed
  517. every time. To omit the current position marker, specify the
  518. <code>/p</code> modifier.
  519. </p>
  520. <p>To better align the printed instructions when the trace contains
  521. instructions from more than one function, the function name may be
  522. omitted by specifying the <code>/f</code> modifier.
  523. </p>
  524. <p>Speculatively executed instructions are prefixed with &lsquo;<samp>?</samp>&rsquo;. This
  525. feature is not available for all recording formats.
  526. </p>
  527. <p>There are several ways to specify what part of the execution log to
  528. disassemble:
  529. </p>
  530. <dl compact="compact">
  531. <dt><code>record instruction-history <var>insn</var></code></dt>
  532. <dd><p>Disassembles ten instructions starting from instruction number
  533. <var>insn</var>.
  534. </p>
  535. </dd>
  536. <dt><code>record instruction-history <var>insn</var>, +/-<var>n</var></code></dt>
  537. <dd><p>Disassembles <var>n</var> instructions around instruction number
  538. <var>insn</var>. If <var>n</var> is preceded with <code>+</code>, disassembles
  539. <var>n</var> instructions after instruction number <var>insn</var>. If
  540. <var>n</var> is preceded with <code>-</code>, disassembles <var>n</var>
  541. instructions before instruction number <var>insn</var>.
  542. </p>
  543. </dd>
  544. <dt><code>record instruction-history</code></dt>
  545. <dd><p>Disassembles ten more instructions after the last disassembly.
  546. </p>
  547. </dd>
  548. <dt><code>record instruction-history -</code></dt>
  549. <dd><p>Disassembles ten more instructions before the last disassembly.
  550. </p>
  551. </dd>
  552. <dt><code>record instruction-history <var>begin</var>, <var>end</var></code></dt>
  553. <dd><p>Disassembles instructions beginning with instruction number
  554. <var>begin</var> until instruction number <var>end</var>. The instruction
  555. number <var>end</var> is included.
  556. </p></dd>
  557. </dl>
  558. <p>This command may not be available for all recording methods.
  559. </p>
  560. <a name="index-set-record"></a>
  561. </dd>
  562. <dt><code>set record instruction-history-size <var>size</var></code></dt>
  563. <dt><code>set record instruction-history-size unlimited</code></dt>
  564. <dd><p>Define how many instructions to disassemble in the <code>record
  565. instruction-history</code> command. The default value is 10.
  566. A <var>size</var> of <code>unlimited</code> means unlimited instructions.
  567. </p>
  568. <a name="index-show-record"></a>
  569. </dd>
  570. <dt><code>show record instruction-history-size</code></dt>
  571. <dd><p>Show how many instructions to disassemble in the <code>record
  572. instruction-history</code> command.
  573. </p>
  574. <a name="index-record-function_002dcall_002dhistory"></a>
  575. <a name="index-rec-function_002dcall_002dhistory"></a>
  576. </dd>
  577. <dt><code>record function-call-history</code></dt>
  578. <dd><p>Prints the execution history at function granularity. It prints one
  579. line for each sequence of instructions that belong to the same
  580. function giving the name of that function, the source lines
  581. for this instruction sequence (if the <code>/l</code> modifier is
  582. specified), and the instructions numbers that form the sequence (if
  583. the <code>/i</code> modifier is specified). The function names are indented
  584. to reflect the call stack depth if the <code>/c</code> modifier is
  585. specified. The <code>/l</code>, <code>/i</code>, and <code>/c</code> modifiers can be
  586. given together.
  587. </p>
  588. <div class="smallexample">
  589. <pre class="smallexample">(gdb) <b>list 1, 10</b>
  590. 1 void foo (void)
  591. 2 {
  592. 3 }
  593. 4
  594. 5 void bar (void)
  595. 6 {
  596. 7 ...
  597. 8 foo ();
  598. 9 ...
  599. 10 }
  600. (gdb) <b>record function-call-history /ilc</b>
  601. 1 bar inst 1,4 at foo.c:6,8
  602. 2 foo inst 5,10 at foo.c:2,3
  603. 3 bar inst 11,13 at foo.c:9,10
  604. </pre></div>
  605. <p>By default, ten lines are printed. This can be changed using the
  606. <code>set record function-call-history-size</code> command. Functions are
  607. printed in execution order. There are several ways to specify what
  608. to print:
  609. </p>
  610. <dl compact="compact">
  611. <dt><code>record function-call-history <var>func</var></code></dt>
  612. <dd><p>Prints ten functions starting from function number <var>func</var>.
  613. </p>
  614. </dd>
  615. <dt><code>record function-call-history <var>func</var>, +/-<var>n</var></code></dt>
  616. <dd><p>Prints <var>n</var> functions around function number <var>func</var>. If
  617. <var>n</var> is preceded with <code>+</code>, prints <var>n</var> functions after
  618. function number <var>func</var>. If <var>n</var> is preceded with <code>-</code>,
  619. prints <var>n</var> functions before function number <var>func</var>.
  620. </p>
  621. </dd>
  622. <dt><code>record function-call-history</code></dt>
  623. <dd><p>Prints ten more functions after the last ten-line print.
  624. </p>
  625. </dd>
  626. <dt><code>record function-call-history -</code></dt>
  627. <dd><p>Prints ten more functions before the last ten-line print.
  628. </p>
  629. </dd>
  630. <dt><code>record function-call-history <var>begin</var>, <var>end</var></code></dt>
  631. <dd><p>Prints functions beginning with function number <var>begin</var> until
  632. function number <var>end</var>. The function number <var>end</var> is included.
  633. </p></dd>
  634. </dl>
  635. <p>This command may not be available for all recording methods.
  636. </p>
  637. </dd>
  638. <dt><code>set record function-call-history-size <var>size</var></code></dt>
  639. <dt><code>set record function-call-history-size unlimited</code></dt>
  640. <dd><p>Define how many lines to print in the
  641. <code>record function-call-history</code> command. The default value is 10.
  642. A size of <code>unlimited</code> means unlimited lines.
  643. </p>
  644. </dd>
  645. <dt><code>show record function-call-history-size</code></dt>
  646. <dd><p>Show how many lines to print in the
  647. <code>record function-call-history</code> command.
  648. </p></dd>
  649. </dl>
  650. <hr>
  651. <div class="header">
  652. <p>
  653. Next: <a href="Stack.html#Stack" accesskey="n" rel="next">Stack</a>, Previous: <a href="Reverse-Execution.html#Reverse-Execution" accesskey="p" rel="prev">Reverse Execution</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</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>
  654. </div>
  655. </body>
  656. </html>