13 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. For
13.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, for example, to 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 the contents of the program
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
13.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 device |
13.1 Active targets 133