• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>Target Commands - Debugging with GDB</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Debugging with GDB">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Targets.html#Targets" title="Targets">
9<link rel="prev" href="Active-Targets.html#Active-Targets" title="Active Targets">
10<link rel="next" href="Byte-Order.html#Byte-Order" title="Byte Order">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Free Software'' and ``Free Software Needs
19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
20and with the Back-Cover Texts as in (a) below.
21
22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
23this GNU Manual.  Buying copies from GNU Press supports the FSF in
24developing GNU and promoting software freedom.''
25-->
26<meta http-equiv="Content-Style-Type" content="text/css">
27<style type="text/css"><!--
28  pre.display { font-family:inherit }
29  pre.format  { font-family:inherit }
30  pre.smalldisplay { font-family:inherit; font-size:smaller }
31  pre.smallformat  { font-family:inherit; font-size:smaller }
32  pre.smallexample { font-size:smaller }
33  pre.smalllisp    { font-size:smaller }
34  span.sc    { font-variant:small-caps }
35  span.roman { font-family:serif; font-weight:normal; } 
36  span.sansserif { font-family:sans-serif; font-weight:normal; } 
37--></style>
38<link rel="stylesheet" type="text/css" href="../cs.css">
39</head>
40<body>
41<div class="node">
42<a name="Target-Commands"></a>
43<p>
44Next:&nbsp;<a rel="next" accesskey="n" href="Byte-Order.html#Byte-Order">Byte Order</a>,
45Previous:&nbsp;<a rel="previous" accesskey="p" href="Active-Targets.html#Active-Targets">Active Targets</a>,
46Up:&nbsp;<a rel="up" accesskey="u" href="Targets.html#Targets">Targets</a>
47<hr>
48</div>
49
50<h3 class="section">19.2 Commands for Managing Targets</h3>
51
52     <dl>
53<dt><code>target </code><var>type</var> <var>parameters</var><dd>Connects the <span class="sc">gdb</span> host environment to a target machine or
54process.  A target is typically a protocol for talking to debugging
55facilities.  You use the argument <var>type</var> to specify the type or
56protocol of the target machine.
57
58     <p>Further <var>parameters</var> are interpreted by the target protocol, but
59typically include things like device names or host names to connect
60with, process numbers, and baud rates.
61
62     <p>The <code>target</code> command does not repeat if you press &lt;RET&gt; again
63after executing the command.
64
65     <p><a name="index-help-target-1154"></a><br><dt><code>help target</code><dd>Displays the names of all targets available.  To display targets
66currently selected, use either <code>info target</code> or <code>info files</code>
67(see <a href="Files.html#Files">Commands to Specify Files</a>).
68
69     <br><dt><code>help target </code><var>name</var><dd>Describe a particular target, including any parameters necessary to
70select it.
71
72     <p><a name="index-set-gnutarget-1155"></a><br><dt><code>set gnutarget </code><var>args</var><dd><span class="sc">gdb</span> uses its own library BFD to read your files.  <span class="sc">gdb</span>
73knows whether it is reading an <dfn>executable</dfn>,
74a <dfn>core</dfn>, or a <dfn>.o</dfn> file; however, you can specify the file format
75with the <code>set gnutarget</code> command.  Unlike most <code>target</code> commands,
76with <code>gnutarget</code> the <code>target</code> refers to a program, not a machine.
77
78     <blockquote>
79<em>Warning:</em> To specify a file format with <code>set gnutarget</code>,
80you must know the actual BFD name. 
81</blockquote>
82
83     <p class="noindent">See <a href="Files.html#Files">Commands to Specify Files</a>.
84
85     <p><a name="index-show-gnutarget-1156"></a><br><dt><code>show gnutarget</code><dd>Use the <code>show gnutarget</code> command to display what file format
86<code>gnutarget</code> is set to read.  If you have not set <code>gnutarget</code>,
87<span class="sc">gdb</span> will determine the file format for each file automatically,
88and <code>show gnutarget</code> displays &lsquo;<samp><span class="samp">The current BFD target is "auto"</span></samp>&rsquo;. 
89</dl>
90
91   <p><a name="index-common-targets-1157"></a>Here are some common targets (available, or not, depending on the GDB
92configuration):
93
94     
95<a name="index-target-1158"></a>
96<dl><dt><code>target exec </code><var>program</var><dd><a name="index-executable-file-target-1159"></a>An executable file.  &lsquo;<samp><span class="samp">target exec </span><var>program</var></samp>&rsquo; is the same as
97&lsquo;<samp><span class="samp">exec-file </span><var>program</var></samp>&rsquo;.
98
99     <br><dt><code>target core </code><var>filename</var><dd><a name="index-core-dump-file-target-1160"></a>A core dump file.  &lsquo;<samp><span class="samp">target core </span><var>filename</var></samp>&rsquo; is the same as
100&lsquo;<samp><span class="samp">core-file </span><var>filename</var></samp>&rsquo;.
101
102     <br><dt><code>target remote </code><var>medium</var><dd><a name="index-remote-target-1161"></a>A remote system connected to <span class="sc">gdb</span> via a serial line or network
103connection.  This command tells <span class="sc">gdb</span> to use its own remote
104protocol over <var>medium</var> for debugging.  See <a href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>.
105
106     <p>For example, if you have a board connected to <samp><span class="file">/dev/ttya</span></samp> on the
107machine running <span class="sc">gdb</span>, you could say:
108
109     <pre class="smallexample">          target remote /dev/ttya
110</pre>
111     <p><code>target remote</code> supports the <code>load</code> command.  This is only
112useful if you have some other way of getting the stub to the target
113system, and you can put it somewhere in memory where it won't get
114clobbered by the download.
115
116     <br><dt><code>target sim </code><span class="roman">[</span><var>simargs</var><span class="roman">]</span><code> ...</code><dd><a name="index-built_002din-simulator-target-1162"></a>Builtin CPU simulator.  <span class="sc">gdb</span> includes simulators for most architectures. 
117In general,
118     <pre class="smallexample">                  target sim
119                  load
120                  run
121</pre>
122     <p class="noindent">works; however, you cannot assume that a specific memory map, device
123drivers, or even basic I/O is available, although some simulators do
124provide these.  For info about any processor-specific simulator details,
125see the appropriate section in <a href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>.
126
127   </dl>
128
129   <p>Different targets are available on different configurations of <span class="sc">gdb</span>;
130your configuration may have more or fewer targets.
131
132   <p>Many remote targets require you to download the executable's code once
133you've successfully established a connection.  You may wish to control
134various aspects of this process.
135
136     <dl>
137<dt><code>set hash</code><dd><a name="index-set-hash_0040r_007b_002c-for-remote-monitors_007d-1163"></a><a name="index-hash-mark-while-downloading-1164"></a>This command controls whether a hash mark &lsquo;<samp><span class="samp">#</span></samp>&rsquo; is displayed while
138downloading a file to the remote monitor.  If on, a hash mark is
139displayed after each S-record is successfully downloaded to the
140monitor.
141
142     <br><dt><code>show hash</code><dd><a name="index-show-hash_0040r_007b_002c-for-remote-monitors_007d-1165"></a>Show the current status of displaying the hash mark.
143
144     <br><dt><code>set debug monitor</code><dd><a name="index-set-debug-monitor-1166"></a><a name="index-display-remote-monitor-communications-1167"></a>Enable or disable display of communications messages between
145<span class="sc">gdb</span> and the remote monitor.
146
147     <br><dt><code>show debug monitor</code><dd><a name="index-show-debug-monitor-1168"></a>Show the current status of displaying communications between
148<span class="sc">gdb</span> and the remote monitor. 
149</dl>
150
151     
152<a name="index-load-_0040var_007bfilename_007d-1169"></a>
153<dl><dt><code>load </code><var>filename</var><code> [-verify]</code><dd><a name="load"></a>Depending on what remote debugging facilities are configured into
154<span class="sc">gdb</span>, the <code>load</code> command may be available.  Where it exists, it
155is meant to make <var>filename</var> (an executable) available for debugging
156on the remote system&mdash;by downloading, or dynamic linking, for example. 
157<code>load</code> also records the <var>filename</var> symbol table in <span class="sc">gdb</span>, like
158the <code>add-symbol-file</code> command.
159
160     <p>If your <span class="sc">gdb</span> does not have a <code>load</code> command, attempting to
161execute it gets the error message &ldquo;<code>You can't do that when your
162target is ...</code>&rdquo;
163
164     <p>The file is loaded at whatever address is specified in the executable. 
165For some object file formats, you can specify the load address when you
166link the program; for other formats, like a.out, the object file format
167specifies a fixed address. 
168<!-- FIXME! This would be a good place for an xref to the GNU linker doc. -->
169
170     <p>Depending on the remote side capabilities, <span class="sc">gdb</span> may be able to
171load programs into flash memory.
172
173     <p>The optional <code>-verify</code> flag enables verification of the data that was
174loaded.
175
176     <p><code>load</code> does not repeat if you press &lt;RET&gt; again after using it. 
177</dl>
178
179     
180<a name="index-flash_002derase-1170"></a>
181<dl><dt><code>flash-erase</code><dd><a name="flash_002derase"></a>Erases all known flash memory regions on the target.
182
183   </dl>
184
185   </body></html>
186
187