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">
12 Node:
<a name=
"Active%20Targets">Active Targets
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Target-Commands.html#Target%20Commands">Target Commands
</a>,
14 Up:
<a rel=
"up" accesskey=
"u" href=
"Targets.html#Targets">Targets
</a>
18 <h3 class=
"section">Active targets
</h3>
20 <p>There are three classes of targets: processes, core files, and
21 executable files. GDB can work concurrently on up to three
22 active targets, one in each class. This allows you to (for example)
23 start a process and inspect its activity without abandoning your work on
26 <p>For example, if you execute
<code>gdb a.out
</code>, then the executable file
27 <code>a.out
</code> is the only active target. If you designate a core file as
28 well--presumably from a prior run that crashed and coredumped--then
29 GDB has two active targets and uses them in tandem, looking
30 first in the corefile target, then in the executable file, to satisfy
31 requests for memory addresses. (Typically, these two classes of target
32 are complementary, since core files contain only a program's
33 read-write memory--variables and so on--plus machine status, while
34 executable files contain only the program text and initialized data.)
36 <p>When you type
<code>run
</code>, your executable file becomes an active process
37 target as well. When a process target is active, all GDB
38 commands requesting memory addresses refer to that target; addresses in
39 an active core file or executable file target are obscured while the
40 process target is active.
42 <p>Use the
<code>core-file
</code> and
<code>exec-file
</code> commands to select a new
43 core file or executable target (see
<a href=
"Files.html#Files">Commands to specify files
</a>). To specify as a target a process that is already running, use
44 the
<code>attach
</code> command (see
<a href=
"Attach.html#Attach">Debugging an already-running process
</a>).