Debugging with GDB (February 2008)

Table Of Contents
110 Debugging with GDB
help target
Displays the names of all targets available. To display targets currently selected,
use either info target or info files (see Section 12.1 [Commands to specify
files], page 103).
help target name
Describe a particular target, including any parameters necessary to select it.
set gnutarget args
GDB uses its own library BFD to read your files. GDB knows whether it is
reading an executable, a core, or a .o file; however, you can specify the file
format with the set gnutarget command. Unlike most target commands,
with gnutarget the target refers to a program, not a machine.
Warning: To specify a file format with set gnutarget, you must
know the actual BFD name.
See Section 12.1 [Commands to specify files], page 103.
show gnutarget
Use the show gnutarget command to display what file format gnutarget is set
to read. If you have not set gnutarget, GDB will determine the file format for
each file automatically, and show gnutarget displays The current BDF target
is "auto"’.
Here are some common targets (available, or not, depending on the GDB configuration):
target exec program
An executable file. target exec program is the same as exec-file pro-
gram ’.
target core filename
A core dump file. target core filename is the same as core-file file-
name ’.
target remote dev
Remote serial target in GDB-specific protocol. The argument dev specifies
what serial device to use for the connection (e.g. /dev/ttya’). target remote
supports the load command. This is only useful if you have some other way of
getting the stub to the target system, and you can put it somewhere in memory
where it won’t get clobbered by the download.
target sim
Builtin CPU simulator. GDB includes simulators for most architectures. In
general,
target sim
load
run
works; however, you cannot assume that a specific memory map, device drivers,
or even basic I/O is available, although some simulators do provide these.
Some configurations may include these targets as well: