File-Options.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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-2019 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 5.2, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: File Options</title>
  16. <meta name="description" content="Debugging with GDB: File Options">
  17. <meta name="keywords" content="Debugging with GDB: File Options">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Invoking-GDB.html#Invoking-GDB" rel="up" title="Invoking GDB">
  26. <link href="Mode-Options.html#Mode-Options" rel="next" title="Mode Options">
  27. <link href="Invoking-GDB.html#Invoking-GDB" rel="prev" title="Invoking GDB">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="File-Options"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Mode-Options.html#Mode-Options" accesskey="n" rel="next">Mode Options</a>, Up: <a href="Invoking-GDB.html#Invoking-GDB" accesskey="u" rel="up">Invoking 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>
  62. </div>
  63. <hr>
  64. <a name="Choosing-Files"></a>
  65. <h4 class="subsection">2.1.1 Choosing Files</h4>
  66. <p>When <small>GDB</small> starts, it reads any arguments other than options as
  67. specifying an executable file and core file (or process ID). This is
  68. the same as if the arguments were specified by the &lsquo;<samp>-se</samp>&rsquo; and
  69. &lsquo;<samp>-c</samp>&rsquo; (or &lsquo;<samp>-p</samp>&rsquo;) options respectively. (<small>GDB</small> reads the
  70. first argument that does not have an associated option flag as
  71. equivalent to the &lsquo;<samp>-se</samp>&rsquo; option followed by that argument; and the
  72. second argument that does not have an associated option flag, if any, as
  73. equivalent to the &lsquo;<samp>-c</samp>&rsquo;/&lsquo;<samp>-p</samp>&rsquo; option followed by that argument.)
  74. If the second argument begins with a decimal digit, <small>GDB</small> will
  75. first attempt to attach to it as a process, and if that fails, attempt
  76. to open it as a corefile. If you have a corefile whose name begins with
  77. a digit, you can prevent <small>GDB</small> from treating it as a pid by
  78. prefixing it with <samp>./</samp>, e.g. <samp>./12345</samp>.
  79. </p>
  80. <p>If <small>GDB</small> has not been configured to included core file support,
  81. such as for most embedded targets, then it will complain about a second
  82. argument and ignore it.
  83. </p>
  84. <p>Many options have both long and short forms; both are shown in the
  85. following list. <small>GDB</small> also recognizes the long forms if you truncate
  86. them, so long as enough of the option is present to be unambiguous.
  87. (If you prefer, you can flag option arguments with &lsquo;<samp>--</samp>&rsquo; rather
  88. than &lsquo;<samp>-</samp>&rsquo;, though we illustrate the more usual convention.)
  89. </p>
  90. <dl compact="compact">
  91. <dt><code>-symbols <var>file</var></code></dt>
  92. <dt><code>-s <var>file</var></code></dt>
  93. <dd><a name="index-_002d_002dsymbols"></a>
  94. <a name="index-_002ds"></a>
  95. <p>Read symbol table from file <var>file</var>.
  96. </p>
  97. </dd>
  98. <dt><code>-exec <var>file</var></code></dt>
  99. <dt><code>-e <var>file</var></code></dt>
  100. <dd><a name="index-_002d_002dexec"></a>
  101. <a name="index-_002de"></a>
  102. <p>Use file <var>file</var> as the executable file to execute when appropriate,
  103. and for examining pure data in conjunction with a core dump.
  104. </p>
  105. </dd>
  106. <dt><code>-se <var>file</var></code></dt>
  107. <dd><a name="index-_002d_002dse"></a>
  108. <p>Read symbol table from file <var>file</var> and use it as the executable
  109. file.
  110. </p>
  111. </dd>
  112. <dt><code>-core <var>file</var></code></dt>
  113. <dt><code>-c <var>file</var></code></dt>
  114. <dd><a name="index-_002d_002dcore"></a>
  115. <a name="index-_002dc"></a>
  116. <p>Use file <var>file</var> as a core dump to examine.
  117. </p>
  118. </dd>
  119. <dt><code>-pid <var>number</var></code></dt>
  120. <dt><code>-p <var>number</var></code></dt>
  121. <dd><a name="index-_002d_002dpid"></a>
  122. <a name="index-_002dp"></a>
  123. <p>Connect to process ID <var>number</var>, as with the <code>attach</code> command.
  124. </p>
  125. </dd>
  126. <dt><code>-command <var>file</var></code></dt>
  127. <dt><code>-x <var>file</var></code></dt>
  128. <dd><a name="index-_002d_002dcommand"></a>
  129. <a name="index-_002dx"></a>
  130. <p>Execute commands from file <var>file</var>. The contents of this file is
  131. evaluated exactly as the <code>source</code> command would.
  132. See <a href="Command-Files.html#Command-Files">Command files</a>.
  133. </p>
  134. </dd>
  135. <dt><code>-eval-command <var>command</var></code></dt>
  136. <dt><code>-ex <var>command</var></code></dt>
  137. <dd><a name="index-_002d_002deval_002dcommand"></a>
  138. <a name="index-_002dex"></a>
  139. <p>Execute a single <small>GDB</small> command.
  140. </p>
  141. <p>This option may be used multiple times to call multiple commands. It may
  142. also be interleaved with &lsquo;<samp>-command</samp>&rsquo; as required.
  143. </p>
  144. <div class="smallexample">
  145. <pre class="smallexample">gdb -ex 'target sim' -ex 'load' \
  146. -x setbreakpoints -ex 'run' a.out
  147. </pre></div>
  148. </dd>
  149. <dt><code>-init-command <var>file</var></code></dt>
  150. <dt><code>-ix <var>file</var></code></dt>
  151. <dd><a name="index-_002d_002dinit_002dcommand"></a>
  152. <a name="index-_002dix"></a>
  153. <p>Execute commands from file <var>file</var> before loading the inferior (but
  154. after loading gdbinit files).
  155. See <a href="Startup.html#Startup">Startup</a>.
  156. </p>
  157. </dd>
  158. <dt><code>-init-eval-command <var>command</var></code></dt>
  159. <dt><code>-iex <var>command</var></code></dt>
  160. <dd><a name="index-_002d_002dinit_002deval_002dcommand"></a>
  161. <a name="index-_002diex"></a>
  162. <p>Execute a single <small>GDB</small> command before loading the inferior (but
  163. after loading gdbinit files).
  164. See <a href="Startup.html#Startup">Startup</a>.
  165. </p>
  166. </dd>
  167. <dt><code>-directory <var>directory</var></code></dt>
  168. <dt><code>-d <var>directory</var></code></dt>
  169. <dd><a name="index-_002d_002ddirectory"></a>
  170. <a name="index-_002dd"></a>
  171. <p>Add <var>directory</var> to the path to search for source and script files.
  172. </p>
  173. </dd>
  174. <dt><code>-r</code></dt>
  175. <dt><code>-readnow</code></dt>
  176. <dd><a name="index-_002d_002dreadnow"></a>
  177. <a name="index-_002dr"></a>
  178. <p>Read each symbol file&rsquo;s entire symbol table immediately, rather than
  179. the default, which is to read it incrementally as it is needed.
  180. This makes startup slower, but makes future operations faster.
  181. </p>
  182. </dd>
  183. <dt><code>--readnever</code></dt>
  184. <dd><a name="g_t_002d_002dreadnever"></a><a name="index-_002d_002dreadnever_002c-command_002dline-option"></a>
  185. <p>Do not read each symbol file&rsquo;s symbolic debug information. This makes
  186. startup faster but at the expense of not being able to perform
  187. symbolic debugging. DWARF unwind information is also not read,
  188. meaning backtraces may become incomplete or inaccurate. One use of
  189. this is when a user simply wants to do the following sequence: attach,
  190. dump core, detach. Loading the debugging information in this case is
  191. an unnecessary cause of delay.
  192. </p></dd>
  193. </dl>
  194. <hr>
  195. <div class="header">
  196. <p>
  197. Next: <a href="Mode-Options.html#Mode-Options" accesskey="n" rel="next">Mode Options</a>, Up: <a href="Invoking-GDB.html#Invoking-GDB" accesskey="u" rel="up">Invoking 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>
  198. </div>
  199. </body>
  200. </html>