Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

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 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

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.

set gnutarget args

{No value for ` <listitem>GDBN'} 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.

Refer to Section 17.1 Commands to specify files.

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 program.

target core filename

A core dump file. target core filename is the same as core-file filename.

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). Refer to Section 18.4 Remote debugging. 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. For info about any processor-specific simulator details, see the appropriate section in (refer to Section 20.3 Embedded Processors.

Some configurations may include these targets as well:

target nrom dev

NetROM ROM emulator. This target only supports downloading.

Different targets are available on different configurations of gdb; your configuration may have more or fewer targets.

Many remote targets require you to download the executable's code once you've successfully established a connection.

load filename

Depending on what remote debugging facilities are configured into gdb, the load command may be available. Where it exists, it is meant to make filename (an executable) available for debugging on the remote system--by downloading, or dynamic linking, for example. load also records the filename symbol table in gdb, like the add-symbol-file command.

If your gdb does not have a load command, attempting to execute it gets the error message "You can't do that when your target is …"

The file is loaded at whatever address is specified in the executable. For some object file formats, you can specify the load address when you link the program; for other formats, like a.out, the object file format specifies a fixed address.

load does not repeat if you press [RET] again after using it.

 
 
  Published under the terms of the GNU General Public License Design by Interspire