Chapter 18.
Specifying a Debugging Target
A
target
is the execution environment occupied by your program.
Often, gdb runs in the same host environment as your program; in that case, the debugging target is
specified as a side effect when you use the
file
or
core
commands. When you need more flexibility--
for example, running gdb on a physically separate host, or controlling a standalone system over a serial
port or a realtime system over a TCP/IP connection--you can use the
target
command to specify one
of the target types configured for gdb (refer to Section 18.2
Commands for managing targets
).
18.1. Active targets
There are three classes of targets: processes, core files, and executable files. gdb can work concurrently
on up to three active targets, one in each class. This allows you to (for example) start a process and
inspect its activity without abandoning your work on a core file.
For example, if you execute
gdb a.out
, then the executable file
a.out
is the only active target. If
you designate a core file as well--presumably from a prior run that crashed and coredumped--then
gdb has two active targets and uses them in tandem, looking first in the corefile target, then in the
executable file, to satisfy requests for memory addresses. (Typically, these two classes of target are
complementary, since core files contain only a program’s read-write memory--variables and so on--
plus machine status, while executable files contain only the program text and initialized data.)
When you type
run
, your executable file becomes an active process target as well. When a process
target is active, all gdb commands requesting memory addresses refer to that target; addresses in an
active core file or executable file target are obscured while the process target is active.
Use the
core-file
and
exec-file
commands to select a new core file or executable target (refer to
Section 17.1
Commands to specify files
). To specify as a target a process that is already running, use
the
attach
command (refer to Section 6.7
Debugging an already-running process
).
18.2. Commands for managing targets
target
type parameters
Connects the gdb host environment to a target machine or process. A target is typically a protocol
for talking to debugging facilities. You use the argument
type
to specify the type or protocol of
the target machine.
Further
parameters
are interpreted by the target protocol, but typically include things like de-
vice names or host names to connect with, process numbers, and baud rates.
The
target
command does not repeat if you press [RET] again after executing the command.
help target
Displays the names of all targets available. To display targets currently selected, use either
info
target
or
info files
(refer to Section 17.1
Commands to specify files
).
help target
name
Describe a particular target, including any parameters necessary to select it.
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......