Specifying A Debugging Target; Active Targets; Commands For Managing Targets - Red Hat ENTERPRISE LINUX 3 - DEBUGGING WITH GDB Manual

Debugging with gdb
Hide thumbs Also See for ENTERPRISE LINUX 3 - DEBUGGING WITH GDB:
Table of Contents

Advertisement

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
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
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
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
, your executable file becomes an active process target as well. When a process
run
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
Section 17.1 Commands to specify files). To specify as a target a process that is already running, use
the
command (refer to Section 6.7 Debugging an already-running process).
attach

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
the target machine.
Further
parameters
vice names or host names to connect with, process numbers, and baud rates.
The
command does not repeat if you press [RET] again after executing the command.
target
help target
Displays the names of all targets available. To display targets currently selected, use either
or
target
info files
help target
name
Describe a particular target, including any parameters necessary to select it.

Specifying a Debugging Target

, then the executable file
gdb a.out
and
commands to select a new core file or executable target (refer to
exec-file
are interpreted by the target protocol, but typically include things like de-
(refer to Section 17.1 Commands to specify files).
or
commands. When you need more flexibility--
file
core
type
Chapter 18.
command to specify one
target
is the only active target. If
a.out
to specify the type or protocol of
info

Advertisement

Table of Contents
loading

Table of Contents