Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Target-Commands.html
blob849f6f94d574010880a16c254e5424e382952bd6
1 <html lang="en">
2 <head>
3 <title>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.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Target%20Commands">Target Commands</a>,
13 Next:<a rel="next" accesskey="n" href="Byte-Order.html#Byte%20Order">Byte Order</a>,
14 Previous:<a rel="previous" accesskey="p" href="Active-Targets.html#Active%20Targets">Active Targets</a>,
15 Up:<a rel="up" accesskey="u" href="Targets.html#Targets">Targets</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Commands for managing targets</h3>
21 <dl>
22 <dt><code>target </code><var>type</var><code> </code><var>parameters</var><code></code>
23 <dd>Connects the GDB host environment to a target machine or
24 process. A target is typically a protocol for talking to debugging
25 facilities. You use the argument <var>type</var> to specify the type or
26 protocol of the target machine.
28 <p>Further <var>parameters</var> are interpreted by the target protocol, but
29 typically include things like device names or host names to connect
30 with, process numbers, and baud rates.
32 <p>The <code>target</code> command does not repeat if you press &lt;RET&gt; again
33 after executing the command.
35 <br><dt><code>help target</code>
36 <dd>Displays the names of all targets available. To display targets
37 currently selected, use either <code>info target</code> or <code>info files</code>
38 (see <a href="Files.html#Files">Commands to specify files</a>).
40 <br><dt><code>help target </code><var>name</var><code></code>
41 <dd>Describe a particular target, including any parameters necessary to
42 select it.
44 <br><dt><code>set gnutarget </code><var>args</var><code></code>
45 <dd>GDB uses its own library BFD to read your files. GDB
46 knows whether it is reading an <dfn>executable</dfn>,
47 a <dfn>core</dfn>, or a <dfn>.o</dfn> file; however, you can specify the file format
48 with the <code>set gnutarget</code> command. Unlike most <code>target</code> commands,
49 with <code>gnutarget</code> the <code>target</code> refers to a program, not a machine.
51 <blockquote>
52 <em>Warning:</em> To specify a file format with <code>set gnutarget</code>,
53 you must know the actual BFD name.
54 </blockquote>
56 <p>See <a href="Files.html#Files">Commands to specify files</a>.
58 <br><dt><code>show gnutarget</code>
59 <dd>Use the <code>show gnutarget</code> command to display what file format
60 <code>gnutarget</code> is set to read. If you have not set <code>gnutarget</code>,
61 GDB will determine the file format for each file automatically,
62 and <code>show gnutarget</code> displays <code>The current BDF target is "auto"</code>.
63 </dl>
65 <p>Here are some common targets (available, or not, depending on the GDB
66 configuration):
68 <dl>
69 <dt><code>target exec </code><var>program</var><code></code>
70 <dd>An executable file. <code>target exec </code><var>program</var><code></code> is the same as
71 <code>exec-file </code><var>program</var><code></code>.
73 <br><dt><code>target core </code><var>filename</var><code></code>
74 <dd>A core dump file. <code>target core </code><var>filename</var><code></code> is the same as
75 <code>core-file </code><var>filename</var><code></code>.
77 <br><dt><code>target remote </code><var>dev</var><code></code>
78 <dd>Remote serial target in GDB-specific protocol. The argument <var>dev</var>
79 specifies what serial device to use for the connection (e.g.
80 <code>/dev/ttya</code>). See <a href="Remote.html#Remote">Remote debugging</a>. <code>target remote</code>
81 supports the <code>load</code> command. This is only useful if you have
82 some other way of getting the stub to the target system, and you can put
83 it somewhere in memory where it won't get clobbered by the download.
85 <br><dt><code>target sim</code>
86 <dd>Builtin CPU simulator. GDB includes simulators for most architectures.
87 In general,
88 <pre class="example"> target sim
89 load
90 run
91 </pre>
93 <p>works; however, you cannot assume that a specific memory map, device
94 drivers, or even basic I/O is available, although some simulators do
95 provide these. For info about any processor-specific simulator details,
96 see the appropriate section in <a href="Embedded-Processors.html#Embedded%20Processors">Embedded Processors</a>.
98 </dl>
100 <p>Some configurations may include these targets as well:
102 <dl>
104 <br><dt><code>target nrom </code><var>dev</var><code></code>
105 <dd>NetROM ROM emulator. This target only supports downloading.
107 </dl>
109 <p>Different targets are available on different configurations of GDB;
110 your configuration may have more or fewer targets.
112 <p>Many remote targets require you to download the executable's code
113 once you've successfully established a connection.
115 <dl>
117 <br><dt><code>load </code><var>filename</var><code></code>
118 <dd>Depending on what remote debugging facilities are configured into
119 GDB, the <code>load</code> command may be available. Where it exists, it
120 is meant to make <var>filename</var> (an executable) available for debugging
121 on the remote system--by downloading, or dynamic linking, for example.
122 <code>load</code> also records the <var>filename</var> symbol table in GDB, like
123 the <code>add-symbol-file</code> command.
125 <p>If your GDB does not have a <code>load</code> command, attempting to
126 execute it gets the error message "<code>You can't do that when your
127 target is ...</code>"
129 <p>The file is loaded at whatever address is specified in the executable.
130 For some object file formats, you can specify the load address when you
131 link the program; for other formats, like a.out, the object file format
132 specifies a fixed address.
134 <p><code>load</code> does not repeat if you press &lt;RET&gt; again after using it.
135 </dl>
137 </body></html>