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.

241 rinda
11KB

  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>Command History (Debugging with GDB)</title>
  17. <meta name="description" content="Command History (Debugging with GDB)">
  18. <meta name="keywords" content="Command History (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="Controlling-GDB.html#Controlling-GDB" rel="up" title="Controlling GDB">
  26. <link href="Screen-Size.html#Screen-Size" rel="next" title="Screen Size">
  27. <link href="Editing.html#Editing" rel="prev" title="Editing">
  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="Command-History"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Screen-Size.html#Screen-Size" accesskey="n" rel="next">Screen Size</a>, Previous: <a href="Editing.html#Editing" accesskey="p" rel="prev">Editing</a>, Up: <a href="Controlling-GDB.html#Controlling-GDB" accesskey="u" rel="up">Controlling GDB</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="Command-History-1"></a>
  64. <h3 class="section">22.3 Command History</h3>
  65. <a name="index-command-history"></a>
  66. <p><small>GDB</small> can keep track of the commands you type during your
  67. debugging sessions, so that you can be certain of precisely what
  68. happened. Use these commands to manage the <small>GDB</small> command
  69. history facility.
  70. </p>
  71. <p><small>GDB</small> uses the <small>GNU</small> History library, a part of the Readline
  72. package, to provide the history facility.
  73. See <a href="Using-History-Interactively.html#Using-History-Interactively">Using History Interactively</a>,
  74. for the detailed description of the History library.
  75. </p>
  76. <p>To issue a command to <small>GDB</small> without affecting certain aspects of
  77. the state which is seen by users, prefix it with &lsquo;<samp>server </samp>&rsquo;
  78. (see <a href="Server-Prefix.html#Server-Prefix">Server Prefix</a>). This
  79. means that this command will not affect the command history, nor will it
  80. affect <small>GDB</small>&rsquo;s notion of which command to repeat if <tt class="key">RET</tt> is
  81. pressed on a line by itself.
  82. </p>
  83. <a name="index-server_002c-command-prefix"></a>
  84. <p>The server prefix does not affect the recording of values into the value
  85. history; to print a value without recording it into the value history,
  86. use the <code>output</code> command instead of the <code>print</code> command.
  87. </p>
  88. <p>Here is the description of <small>GDB</small> commands related to command
  89. history.
  90. </p>
  91. <dl compact="compact">
  92. <dd><a name="index-history-substitution"></a>
  93. <a name="index-history-file"></a>
  94. <a name="index-set-history-filename"></a>
  95. <a name="index-GDBHISTFILE_002c-environment-variable"></a>
  96. </dd>
  97. <dt><code>set history filename <span class="roman">[</span><var>fname</var><span class="roman">]</span></code></dt>
  98. <dd><p>Set the name of the <small>GDB</small> command history file to <var>fname</var>.
  99. This is the file where <small>GDB</small> reads an initial command history
  100. list, and where it writes the command history from this session when it
  101. exits. You can access this list through history expansion or through
  102. the history command editing characters listed below. This file defaults
  103. to the value of the environment variable <code>GDBHISTFILE</code>, or to
  104. <samp>./.gdb_history</samp> (<samp>./_gdb_history</samp> on MS-DOS) if this variable
  105. is not set.
  106. </p>
  107. <p>The <code>GDBHISTFILE</code> environment variable is read after processing
  108. any <small>GDB</small> initialization files (see <a href="Startup.html#Startup">Startup</a>) and after
  109. processing any commands passed using command line options (for
  110. example, <code>-ex</code>).
  111. </p>
  112. <p>If the <var>fname</var> argument is not given, or if the <code>GDBHISTFILE</code>
  113. is the empty string then <small>GDB</small> will neither try to load an
  114. existing history file, nor will it try to save the history on exit.
  115. </p>
  116. <a name="index-save-command-history"></a>
  117. <a name="index-set-history-save"></a>
  118. </dd>
  119. <dt><code>set history save</code></dt>
  120. <dt><code>set history save on</code></dt>
  121. <dd><p>Record command history in a file, whose name may be specified with the
  122. <code>set history filename</code> command. By default, this option is
  123. disabled. The command history will be recorded when <small>GDB</small>
  124. exits. If <code>set history filename</code> is set to the empty string then
  125. history saving is disabled, even when <code>set history save</code> is
  126. <code>on</code>.
  127. </p>
  128. </dd>
  129. <dt><code>set history save off</code></dt>
  130. <dd><p>Don&rsquo;t record the command history into the file specified by <code>set
  131. history filename</code> when <small>GDB</small> exits.
  132. </p>
  133. <a name="index-history-size"></a>
  134. <a name="index-set-history-size"></a>
  135. <a name="index-GDBHISTSIZE_002c-environment-variable"></a>
  136. </dd>
  137. <dt><code>set history size <var>size</var></code></dt>
  138. <dt><code>set history size unlimited</code></dt>
  139. <dd><p>Set the number of commands which <small>GDB</small> keeps in its history list.
  140. This defaults to the value of the environment variable <code>GDBHISTSIZE</code>, or
  141. to 256 if this variable is not set. Non-numeric values of <code>GDBHISTSIZE</code>
  142. are ignored. If <var>size</var> is <code>unlimited</code> or if <code>GDBHISTSIZE</code> is
  143. either a negative number or the empty string, then the number of commands
  144. <small>GDB</small> keeps in the history list is unlimited.
  145. </p>
  146. <p>The <code>GDBHISTSIZE</code> environment variable is read after processing
  147. any <small>GDB</small> initialization files (see <a href="Startup.html#Startup">Startup</a>) and after
  148. processing any commands passed using command line options (for
  149. example, <code>-ex</code>).
  150. </p>
  151. <a name="index-remove-duplicate-history"></a>
  152. <a name="index-set-history-remove_002dduplicates"></a>
  153. </dd>
  154. <dt><code>set history remove-duplicates <var>count</var></code></dt>
  155. <dt><code>set history remove-duplicates unlimited</code></dt>
  156. <dd><p>Control the removal of duplicate history entries in the command history list.
  157. If <var>count</var> is non-zero, <small>GDB</small> will look back at the last <var>count</var>
  158. history entries and remove the first entry that is a duplicate of the current
  159. entry being added to the command history list. If <var>count</var> is
  160. <code>unlimited</code> then this lookbehind is unbounded. If <var>count</var> is 0, then
  161. removal of duplicate history entries is disabled.
  162. </p>
  163. <p>Only history entries added during the current session are considered for
  164. removal. This option is set to 0 by default.
  165. </p>
  166. </dd>
  167. </dl>
  168. <p>History expansion assigns special meaning to the character <kbd>!</kbd>.
  169. See <a href="Event-Designators.html#Event-Designators">Event Designators</a>,
  170. for more details.
  171. </p>
  172. <a name="index-history-expansion_002c-turn-on_002foff"></a>
  173. <p>Since <kbd>!</kbd> is also the logical not operator in C, history expansion
  174. is off by default. If you decide to enable history expansion with the
  175. <code>set history expansion on</code> command, you may sometimes need to
  176. follow <kbd>!</kbd> (when it is used as logical not, in an expression) with
  177. a space or a tab to prevent it from being expanded. The readline
  178. history facilities do not attempt substitution on the strings
  179. <kbd>!=</kbd> and <kbd>!(</kbd>, even when history expansion is enabled.
  180. </p>
  181. <p>The commands to control history expansion are:
  182. </p>
  183. <dl compact="compact">
  184. <dt><code>set history expansion on</code></dt>
  185. <dt><code>set history expansion</code></dt>
  186. <dd><a name="index-set-history-expansion"></a>
  187. <p>Enable history expansion. History expansion is off by default.
  188. </p>
  189. </dd>
  190. <dt><code>set history expansion off</code></dt>
  191. <dd><p>Disable history expansion.
  192. </p>
  193. <a name="index-show-history"></a>
  194. </dd>
  195. <dt><code>show history</code></dt>
  196. <dt><code>show history filename</code></dt>
  197. <dt><code>show history save</code></dt>
  198. <dt><code>show history size</code></dt>
  199. <dt><code>show history expansion</code></dt>
  200. <dd><p>These commands display the state of the <small>GDB</small> history parameters.
  201. <code>show history</code> by itself displays all four states.
  202. </p></dd>
  203. </dl>
  204. <dl compact="compact">
  205. <dd><a name="index-show-commands"></a>
  206. <a name="index-show-last-commands"></a>
  207. <a name="index-display-command-history"></a>
  208. </dd>
  209. <dt><code>show commands</code></dt>
  210. <dd><p>Display the last ten commands in the command history.
  211. </p>
  212. </dd>
  213. <dt><code>show commands <var>n</var></code></dt>
  214. <dd><p>Print ten commands centered on command number <var>n</var>.
  215. </p>
  216. </dd>
  217. <dt><code>show commands +</code></dt>
  218. <dd><p>Print ten commands just after the commands last printed.
  219. </p></dd>
  220. </dl>
  221. <hr>
  222. <div class="header">
  223. <p>
  224. Next: <a href="Screen-Size.html#Screen-Size" accesskey="n" rel="next">Screen Size</a>, Previous: <a href="Editing.html#Editing" accesskey="p" rel="prev">Editing</a>, Up: <a href="Controlling-GDB.html#Controlling-GDB" accesskey="u" rel="up">Controlling GDB</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>
  225. </div>
  226. </body>
  227. </html>