Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

277 Zeilen
12KB

  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>Target Commands (Debugging with GDB)</title>
  17. <meta name="description" content="Target Commands (Debugging with GDB)">
  18. <meta name="keywords" content="Target Commands (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="Targets.html#Targets" rel="up" title="Targets">
  26. <link href="Byte-Order.html#Byte-Order" rel="next" title="Byte Order">
  27. <link href="Active-Targets.html#Active-Targets" rel="prev" title="Active Targets">
  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="Target-Commands"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Byte-Order.html#Byte-Order" accesskey="n" rel="next">Byte Order</a>, Previous: <a href="Active-Targets.html#Active-Targets" accesskey="p" rel="prev">Active Targets</a>, Up: <a href="Targets.html#Targets" accesskey="u" rel="up">Targets</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="Commands-for-Managing-Targets"></a>
  64. <h3 class="section">19.2 Commands for Managing Targets</h3>
  65. <dl compact="compact">
  66. <dt><code>target <var>type</var> <var>parameters</var></code></dt>
  67. <dd><p>Connects the <small>GDB</small> host environment to a target machine or
  68. process. A target is typically a protocol for talking to debugging
  69. facilities. You use the argument <var>type</var> to specify the type or
  70. protocol of the target machine.
  71. </p>
  72. <p>Further <var>parameters</var> are interpreted by the target protocol, but
  73. typically include things like device names or host names to connect
  74. with, process numbers, and baud rates.
  75. </p>
  76. <p>The <code>target</code> command does not repeat if you press <tt class="key">RET</tt> again
  77. after executing the command.
  78. </p>
  79. <a name="index-help-target"></a>
  80. </dd>
  81. <dt><code>help target</code></dt>
  82. <dd><p>Displays the names of all targets available. To display targets
  83. currently selected, use either <code>info target</code> or <code>info files</code>
  84. (see <a href="Files.html#Files">Commands to Specify Files</a>).
  85. </p>
  86. </dd>
  87. <dt><code>help target <var>name</var></code></dt>
  88. <dd><p>Describe a particular target, including any parameters necessary to
  89. select it.
  90. </p>
  91. <a name="index-set-gnutarget"></a>
  92. </dd>
  93. <dt><code>set gnutarget <var>args</var></code></dt>
  94. <dd><p><small>GDB</small> uses its own library BFD to read your files. <small>GDB</small>
  95. knows whether it is reading an <em>executable</em>,
  96. a <em>core</em>, or a <em>.o</em> file; however, you can specify the file format
  97. with the <code>set gnutarget</code> command. Unlike most <code>target</code> commands,
  98. with <code>gnutarget</code> the <code>target</code> refers to a program, not a machine.
  99. </p>
  100. <blockquote>
  101. <p><em>Warning:</em> To specify a file format with <code>set gnutarget</code>,
  102. you must know the actual BFD name.
  103. </p></blockquote>
  104. <p>See <a href="Files.html#Files">Commands to Specify Files</a>.
  105. </p>
  106. <a name="index-show-gnutarget"></a>
  107. </dd>
  108. <dt><code>show gnutarget</code></dt>
  109. <dd><p>Use the <code>show gnutarget</code> command to display what file format
  110. <code>gnutarget</code> is set to read. If you have not set <code>gnutarget</code>,
  111. <small>GDB</small> will determine the file format for each file automatically,
  112. and <code>show gnutarget</code> displays &lsquo;<samp>The current BFD target is &quot;auto&quot;</samp>&rsquo;.
  113. </p></dd>
  114. </dl>
  115. <a name="index-common-targets"></a>
  116. <p>Here are some common targets (available, or not, depending on the GDB
  117. configuration):
  118. </p>
  119. <dl compact="compact">
  120. <dd><a name="index-target"></a>
  121. </dd>
  122. <dt><code>target exec <var>program</var></code></dt>
  123. <dd><a name="index-executable-file-target"></a>
  124. <p>An executable file. &lsquo;<samp>target exec <var>program</var></samp>&rsquo; is the same as
  125. &lsquo;<samp>exec-file <var>program</var></samp>&rsquo;.
  126. </p>
  127. </dd>
  128. <dt><code>target core <var>filename</var></code></dt>
  129. <dd><a name="index-core-dump-file-target"></a>
  130. <p>A core dump file. &lsquo;<samp>target core <var>filename</var></samp>&rsquo; is the same as
  131. &lsquo;<samp>core-file <var>filename</var></samp>&rsquo;.
  132. </p>
  133. </dd>
  134. <dt><code>target remote <var>medium</var></code></dt>
  135. <dd><a name="index-remote-target"></a>
  136. <p>A remote system connected to <small>GDB</small> via a serial line or network
  137. connection. This command tells <small>GDB</small> to use its own remote
  138. protocol over <var>medium</var> for debugging. See <a href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>.
  139. </p>
  140. <p>For example, if you have a board connected to <samp>/dev/ttya</samp> on the
  141. machine running <small>GDB</small>, you could say:
  142. </p>
  143. <div class="smallexample">
  144. <pre class="smallexample">target remote /dev/ttya
  145. </pre></div>
  146. <p><code>target remote</code> supports the <code>load</code> command. This is only
  147. useful if you have some other way of getting the stub to the target
  148. system, and you can put it somewhere in memory where it won&rsquo;t get
  149. clobbered by the download.
  150. </p>
  151. </dd>
  152. <dt><code>target sim <span class="roman">[</span><var>simargs</var><span class="roman">]</span> &hellip;</code></dt>
  153. <dd><a name="index-built_002din-simulator-target"></a>
  154. <p>Builtin CPU simulator. <small>GDB</small> includes simulators for most architectures.
  155. In general,
  156. </p><div class="smallexample">
  157. <pre class="smallexample"> target sim
  158. load
  159. run
  160. </pre></div>
  161. <p>works; however, you cannot assume that a specific memory map, device
  162. drivers, or even basic I/O is available, although some simulators do
  163. provide these. For info about any processor-specific simulator details,
  164. see the appropriate section in <a href="Embedded-Processors.html#Embedded-Processors">Embedded
  165. Processors</a>.
  166. </p>
  167. </dd>
  168. <dt><code>target native</code></dt>
  169. <dd><a name="index-native-target"></a>
  170. <p>Setup for local/native process debugging. Useful to make the
  171. <code>run</code> command spawn native processes (likewise <code>attach</code>,
  172. etc.) even when <code>set auto-connect-native-target</code> is <code>off</code>
  173. (see <a href="Starting.html#set-auto_002dconnect_002dnative_002dtarget">set auto-connect-native-target</a>).
  174. </p>
  175. </dd>
  176. </dl>
  177. <p>Different targets are available on different configurations of <small>GDB</small>;
  178. your configuration may have more or fewer targets.
  179. </p>
  180. <p>Many remote targets require you to download the executable&rsquo;s code once
  181. you&rsquo;ve successfully established a connection. You may wish to control
  182. various aspects of this process.
  183. </p>
  184. <dl compact="compact">
  185. <dt><code>set hash</code></dt>
  186. <dd><a name="index-set-hash_002c-for-remote-monitors"></a>
  187. <a name="index-hash-mark-while-downloading"></a>
  188. <p>This command controls whether a hash mark &lsquo;<samp>#</samp>&rsquo; is displayed while
  189. downloading a file to the remote monitor. If on, a hash mark is
  190. displayed after each S-record is successfully downloaded to the
  191. monitor.
  192. </p>
  193. </dd>
  194. <dt><code>show hash</code></dt>
  195. <dd><a name="index-show-hash_002c-for-remote-monitors"></a>
  196. <p>Show the current status of displaying the hash mark.
  197. </p>
  198. </dd>
  199. <dt><code>set debug monitor</code></dt>
  200. <dd><a name="index-set-debug-monitor"></a>
  201. <a name="index-display-remote-monitor-communications"></a>
  202. <p>Enable or disable display of communications messages between
  203. <small>GDB</small> and the remote monitor.
  204. </p>
  205. </dd>
  206. <dt><code>show debug monitor</code></dt>
  207. <dd><a name="index-show-debug-monitor"></a>
  208. <p>Show the current status of displaying communications between
  209. <small>GDB</small> and the remote monitor.
  210. </p></dd>
  211. </dl>
  212. <dl compact="compact">
  213. <dd>
  214. <a name="index-load-filename-offset"></a>
  215. </dd>
  216. <dt><code>load <var>filename</var> <var>offset</var></code></dt>
  217. <dd><a name="load"></a><p>Depending on what remote debugging facilities are configured into
  218. <small>GDB</small>, the <code>load</code> command may be available. Where it exists, it
  219. is meant to make <var>filename</var> (an executable) available for debugging
  220. on the remote system&mdash;by downloading, or dynamic linking, for example.
  221. <code>load</code> also records the <var>filename</var> symbol table in <small>GDB</small>, like
  222. the <code>add-symbol-file</code> command.
  223. </p>
  224. <p>If your <small>GDB</small> does not have a <code>load</code> command, attempting to
  225. execute it gets the error message &ldquo;<code>You can't do that when your
  226. target is &hellip;</code>&rdquo;
  227. </p>
  228. <p>The file is loaded at whatever address is specified in the executable.
  229. For some object file formats, you can specify the load address when you
  230. link the program; for other formats, like a.out, the object file format
  231. specifies a fixed address.
  232. </p>
  233. <p>It is also possible to tell <small>GDB</small> to load the executable file at a
  234. specific offset described by the optional argument <var>offset</var>. When
  235. <var>offset</var> is provided, <var>filename</var> must also be provided.
  236. </p>
  237. <p>Depending on the remote side capabilities, <small>GDB</small> may be able to
  238. load programs into flash memory.
  239. </p>
  240. <p><code>load</code> does not repeat if you press <tt class="key">RET</tt> again after using it.
  241. </p></dd>
  242. </dl>
  243. <dl compact="compact">
  244. <dd>
  245. <a name="index-flash_002derase"></a>
  246. </dd>
  247. <dt><code>flash-erase</code></dt>
  248. <dd><a name="flash_002derase"></a>
  249. <p>Erases all known flash memory regions on the target.
  250. </p>
  251. </dd>
  252. </dl>
  253. <hr>
  254. <div class="header">
  255. <p>
  256. Next: <a href="Byte-Order.html#Byte-Order" accesskey="n" rel="next">Byte Order</a>, Previous: <a href="Active-Targets.html#Active-Targets" accesskey="p" rel="prev">Active Targets</a>, Up: <a href="Targets.html#Targets" accesskey="u" rel="up">Targets</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>
  257. </div>
  258. </body>
  259. </html>