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