[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
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
(see section Commands for Managing Targets).
It is possible to build GDB for several different target architectures. When GDB is built like that, you can choose one of the available architectures with the set architecture command.
set architecture arch
"auto"
, in addition to one of the
supported architectures.
show architecture
set processor
processor
These are alias commands for, respectively, set architecture
and show architecture
.
16.1 Active Targets Active targets 16.2 Commands for Managing Targets Commands for managing targets 16.3 Choosing Target Byte Order Choosing target byte order
[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
There are three subjects 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 subjects 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 (see section Commands to Specify Files). To specify as a target a process that is already running, use
the attach
command (see section Debugging an Already-running Process).
[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
target type
parameters
Further parameters are interpreted by the target protocol, but typically include things like device 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
info target
or info files
(see section Commands to Specify Files).
help target name
set gnutarget args
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 Commands to Specify Files.
show gnutarget
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 program'.
target core filename
A core dump file. `target core filename' is the same as `core-file filename'.
target remote medium
A remote system connected to GDB via a serial line or network connection. This command tells GDB to use its own remote protocol over medium for debugging. See section 17. Debugging Remote Programs.
For example, if you have a board connected to `/devlab/ttya' on the machine running GDB, you could say:
target remote /devlab/ttya |
target sim load run |
[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
Some types of processors, such as the MIPS, PowerPC, and Renesas SH, offer the ability to run either big-endian or little-endian byte orders. Usually the executable or symbol will include a bit to designate the endian-ness, and you will not need to worry about which to use. However, you may still find it useful to adjust GDB's idea of processor endian-ness manually.
set endian big
set endian little
set endian auto
show endian
Note that these commands merely adjust interpretation of symbolic data on the host, and that they have absolutely no effect on the target system.
[ <<] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
These pages are maintained by the GDB developers.
Copyright Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
This document was generated by GDB Administrator on March, 27 2008 using texi2html