GDB_002fMI-File-Commands.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: GDB/MI File Commands</title>
  16. <meta name="description" content="Debugging with GDB: GDB/MI File Commands">
  17. <meta name="keywords" content="Debugging with GDB: GDB/MI File Commands">
  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="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI">
  26. <link href="GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation" rel="next" title="GDB/MI Target Manipulation">
  27. <link href="GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query" rel="previous" title="GDB/MI Symbol Query">
  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="GDB_002fMI-File-Commands"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation" accesskey="n" rel="next">GDB/MI Target Manipulation</a>, Previous: <a href="GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query" accesskey="p" rel="previous">GDB/MI Symbol Query</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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="GDB_002fMI-File-Commands-1"></a>
  65. <h3 class="section">27.19 <small>GDB/MI</small> File Commands</h3>
  66. <p>This section describes the GDB/MI commands to specify executable file names
  67. and to read in and obtain symbol table information.
  68. </p>
  69. <a name="The-_002dfile_002dexec_002dand_002dsymbols-Command"></a>
  70. <h4 class="subheading">The <code>-file-exec-and-symbols</code> Command</h4>
  71. <a name="index-_002dfile_002dexec_002dand_002dsymbols"></a>
  72. <a name="Synopsis-87"></a>
  73. <h4 class="subsubheading">Synopsis</h4>
  74. <div class="smallexample">
  75. <pre class="smallexample"> -file-exec-and-symbols <var>file</var>
  76. </pre></div>
  77. <p>Specify the executable file to be debugged. This file is the one from
  78. which the symbol table is also read. If no file is specified, the
  79. command clears the executable and symbol information. If breakpoints
  80. are set when using this command with no arguments, <small>GDB</small> will produce
  81. error messages. Otherwise, no output is produced, except a completion
  82. notification.
  83. </p>
  84. <a name="GDB-Command-69"></a>
  85. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  86. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>file</samp>&rsquo;.
  87. </p>
  88. <a name="Example-69"></a>
  89. <h4 class="subsubheading">Example</h4>
  90. <div class="smallexample">
  91. <pre class="smallexample">(gdb)
  92. -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  93. ^done
  94. (gdb)
  95. </pre></div>
  96. <a name="The-_002dfile_002dexec_002dfile-Command"></a>
  97. <h4 class="subheading">The <code>-file-exec-file</code> Command</h4>
  98. <a name="index-_002dfile_002dexec_002dfile"></a>
  99. <a name="Synopsis-88"></a>
  100. <h4 class="subsubheading">Synopsis</h4>
  101. <div class="smallexample">
  102. <pre class="smallexample"> -file-exec-file <var>file</var>
  103. </pre></div>
  104. <p>Specify the executable file to be debugged. Unlike
  105. &lsquo;<samp>-file-exec-and-symbols</samp>&rsquo;, the symbol table is <em>not</em> read
  106. from this file. If used without argument, <small>GDB</small> clears the information
  107. about the executable file. No output is produced, except a completion
  108. notification.
  109. </p>
  110. <a name="GDB-Command-70"></a>
  111. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  112. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>exec-file</samp>&rsquo;.
  113. </p>
  114. <a name="Example-70"></a>
  115. <h4 class="subsubheading">Example</h4>
  116. <div class="smallexample">
  117. <pre class="smallexample">(gdb)
  118. -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  119. ^done
  120. (gdb)
  121. </pre></div>
  122. <a name="The-_002dfile_002dlist_002dexec_002dsource_002dfile-Command"></a>
  123. <h4 class="subheading">The <code>-file-list-exec-source-file</code> Command</h4>
  124. <a name="index-_002dfile_002dlist_002dexec_002dsource_002dfile"></a>
  125. <a name="Synopsis-89"></a>
  126. <h4 class="subsubheading">Synopsis</h4>
  127. <div class="smallexample">
  128. <pre class="smallexample"> -file-list-exec-source-file
  129. </pre></div>
  130. <p>List the line number, the current source file, and the absolute path
  131. to the current source file for the current executable. The macro
  132. information field has a value of &lsquo;<samp>1</samp>&rsquo; or &lsquo;<samp>0</samp>&rsquo; depending on
  133. whether or not the file includes preprocessor macro information.
  134. </p>
  135. <a name="GDB-Command-71"></a>
  136. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  137. <p>The <small>GDB</small> equivalent is &lsquo;<samp>info source</samp>&rsquo;
  138. </p>
  139. <a name="Example-71"></a>
  140. <h4 class="subsubheading">Example</h4>
  141. <div class="smallexample">
  142. <pre class="smallexample">(gdb)
  143. 123-file-list-exec-source-file
  144. 123^done,line=&quot;1&quot;,file=&quot;foo.c&quot;,fullname=&quot;/home/bar/foo.c,macro-info=&quot;1&quot;
  145. (gdb)
  146. </pre></div>
  147. <a name="The-_002dfile_002dlist_002dexec_002dsource_002dfiles-Command"></a>
  148. <h4 class="subheading">The <code>-file-list-exec-source-files</code> Command</h4>
  149. <a name="index-_002dfile_002dlist_002dexec_002dsource_002dfiles"></a>
  150. <a name="Synopsis-90"></a>
  151. <h4 class="subsubheading">Synopsis</h4>
  152. <div class="smallexample">
  153. <pre class="smallexample"> -file-list-exec-source-files
  154. </pre></div>
  155. <p>List the source files for the current executable.
  156. </p>
  157. <p>It will always output both the filename and fullname (absolute file
  158. name) of a source file.
  159. </p>
  160. <a name="GDB-Command-72"></a>
  161. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  162. <p>The <small>GDB</small> equivalent is &lsquo;<samp>info sources</samp>&rsquo;.
  163. <code>gdbtk</code> has an analogous command &lsquo;<samp>gdb_listfiles</samp>&rsquo;.
  164. </p>
  165. <a name="Example-72"></a>
  166. <h4 class="subsubheading">Example</h4>
  167. <div class="smallexample">
  168. <pre class="smallexample">(gdb)
  169. -file-list-exec-source-files
  170. ^done,files=[
  171. {file=foo.c,fullname=/home/foo.c},
  172. {file=/home/bar.c,fullname=/home/bar.c},
  173. {file=gdb_could_not_find_fullpath.c}]
  174. (gdb)
  175. </pre></div>
  176. <a name="The-_002dfile_002dlist_002dshared_002dlibraries-Command"></a>
  177. <h4 class="subheading">The <code>-file-list-shared-libraries</code> Command</h4>
  178. <a name="index-_002dfile_002dlist_002dshared_002dlibraries"></a>
  179. <a name="Synopsis-91"></a>
  180. <h4 class="subsubheading">Synopsis</h4>
  181. <div class="smallexample">
  182. <pre class="smallexample"> -file-list-shared-libraries [ <var>regexp</var> ]
  183. </pre></div>
  184. <p>List the shared libraries in the program.
  185. With a regular expression <var>regexp</var>, only those libraries whose
  186. names match <var>regexp</var> are listed.
  187. </p>
  188. <a name="GDB-Command-73"></a>
  189. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  190. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>info shared</samp>&rsquo;. The fields
  191. have a similar meaning to the <code>=library-loaded</code> notification.
  192. The <code>ranges</code> field specifies the multiple segments belonging to this
  193. library. Each range has the following fields:
  194. </p>
  195. <dl compact="compact">
  196. <dt>&lsquo;<samp>from</samp>&rsquo;</dt>
  197. <dd><p>The address defining the inclusive lower bound of the segment.
  198. </p></dd>
  199. <dt>&lsquo;<samp>to</samp>&rsquo;</dt>
  200. <dd><p>The address defining the exclusive upper bound of the segment.
  201. </p></dd>
  202. </dl>
  203. <a name="Example-73"></a>
  204. <h4 class="subsubheading">Example</h4>
  205. <div class="smallexample">
  206. <pre class="smallexample">(gdb)
  207. -file-list-exec-source-files
  208. ^done,shared-libraries=[
  209. {id=&quot;/lib/libfoo.so&quot;,target-name=&quot;/lib/libfoo.so&quot;,host-name=&quot;/lib/libfoo.so&quot;,symbols-loaded=&quot;1&quot;,thread-group=&quot;i1&quot;,ranges=[{from=&quot;0x72815989&quot;,to=&quot;0x728162c0&quot;}]},
  210. {id=&quot;/lib/libbar.so&quot;,target-name=&quot;/lib/libbar.so&quot;,host-name=&quot;/lib/libbar.so&quot;,symbols-loaded=&quot;1&quot;,thread-group=&quot;i1&quot;,ranges=[{from=&quot;0x76ee48c0&quot;,to=&quot;0x76ee9160&quot;}]}]
  211. (gdb)
  212. </pre></div>
  213. <a name="The-_002dfile_002dsymbol_002dfile-Command"></a>
  214. <h4 class="subheading">The <code>-file-symbol-file</code> Command</h4>
  215. <a name="index-_002dfile_002dsymbol_002dfile"></a>
  216. <a name="Synopsis-92"></a>
  217. <h4 class="subsubheading">Synopsis</h4>
  218. <div class="smallexample">
  219. <pre class="smallexample"> -file-symbol-file <var>file</var>
  220. </pre></div>
  221. <p>Read symbol table info from the specified <var>file</var> argument. When
  222. used without arguments, clears <small>GDB</small>&rsquo;s symbol table info. No output is
  223. produced, except for a completion notification.
  224. </p>
  225. <a name="GDB-Command-74"></a>
  226. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  227. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>symbol-file</samp>&rsquo;.
  228. </p>
  229. <a name="Example-74"></a>
  230. <h4 class="subsubheading">Example</h4>
  231. <div class="smallexample">
  232. <pre class="smallexample">(gdb)
  233. -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
  234. ^done
  235. (gdb)
  236. </pre></div>
  237. <hr>
  238. <div class="header">
  239. <p>
  240. Next: <a href="GDB_002fMI-Target-Manipulation.html#GDB_002fMI-Target-Manipulation" accesskey="n" rel="next">GDB/MI Target Manipulation</a>, Previous: <a href="GDB_002fMI-Symbol-Query.html#GDB_002fMI-Symbol-Query" accesskey="p" rel="previous">GDB/MI Symbol Query</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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>
  241. </div>
  242. </body>
  243. </html>