This section goes into details specific to particular embedded
target rdi dev
ARM Angel monitor, via RDI library interface to ADP protocol. You may
use this target to communicate with both boards running the Angel
monitor, or with the EmbeddedICE JTAG debug device.
target rdp dev
ARM Demon monitor.
20.3.2. Hitachi H8/300
target hms dev
A Hitachi SH, H8/300, or H8/500 board, attached via serial line to your host.
Use special commands device and speed to control the serial
line and the communications speed used.
target e7000 dev
E7000 emulator for Hitachi H8 and SH.
target sh3 dev, target sh3e dev
Hitachi SH-3 and SH-3E target systems.
When you select remote debugging to a Hitachi SH, H8/300, or H8/500
board, the load command downloads your program to the Hitachi
board and also opens it as the current executable target for
gdb on your host (like the file command).
gdb needs to know these things to talk to your
Hitachi SH, H8/300, or H8/500:
that you want to use target hms, the remote debugging interface
for Hitachi microprocessors, or target e7000, the in-circuit
emulator for the Hitachi SH and the Hitachi 300H. (target hms is
the default when gdb is configured specifically for the Hitachi SH,
H8/300, or H8/500.)
what serial device connects your host to your Hitachi board (the first
serial device available on your host is the default).
what speed to use over the serial device.
184.108.40.206. Connecting to Hitachi boards
Use the special gdb command device port if you
need to explicitly set the serial device. The default port is the
first available port on your host. This is only necessary on Unix
hosts, where it is typically something like /dev/ttya.
gdb has another special command to set the communications
speed: speed bps. This command also is only used from Unix
hosts; on DOS hosts, set the line speed as usual from outside gdb with
the DOS mode command (for instance,
mode com2:9600,n,8,1,p for a 9600bps connection).
The device and speed commands are available only when you
use a Unix host to debug your Hitachi microprocessor programs. If you
use a DOS host,
gdb depends on an auxiliary terminate-and-stay-resident program
called asynctsr to communicate with the development board
through a PC serial port. You must also use the DOS mode command
to set up the serial port on the DOS side.
The following sample session illustrates the steps needed to start a
program under gdb control on an H8/300. The example uses a
sample H8/300 program called t.x. The procedure is the same for
the Hitachi SH and the H8/500.
First hook up your development board. In this example, we use a
board attached to serial port COM2; if you use a different serial
port, substitute its name in the argument of the mode command.
When you call asynctsr, the auxiliary comms program used by the
debugger, you give it just the numeric part of the serial port's name;
for example, asyncstr 2 below runs asyncstr on
C:\H8300\TEST> asynctsr 2
C:\H8300\TEST> mode com2:9600,n,8,1,p
Resident portion of MODE loaded
COM2: 9600, n, 8, 1, p
Warning: We have noticed a bug in PC-NFS that conflicts with
asynctsr. If you also run PC-NFS on your DOS host, you may need to
disable it, or even boot without it, to use asynctsr to control
your development board.
Now that serial communications are set up, and the development board is
connected, you can start up gdb. Call gdb with
the name of your program as the argument. gdb prompts
you, as usual, with the prompt (gdb). Use two special
commands to begin your debugging session: target hms to specify
cross-debugging to the Hitachi board, and the load command to
download your program to the board. load displays the names of
the program's sections, and a * for each 2K of data downloaded.
(If you want to refresh gdb data on symbols or on the
executable file without downloading, use the gdb commands
file or symbol-file. These commands, and load
itself, are described in (refer to Section 17.1 Commands to specify files.)
(eg-C:\H8300\TEST) gdb t.x
gdb is free software and you are welcome to distribute copies
of it under certain conditions; type "show copying" to see
There is absolutely no warranty for gdb; type "show warranty"
gdb 2003-07-22-cvs, Copyright 1992 Free Software Foundation, Inc...
(gdb) target hms
Connected to remote H8/300 HMS system.
(gdb) load t.x
.text : 0x8000 .. 0xabde ***********
.data : 0xabde .. 0xad30 *
.stack : 0xf000 .. 0xf014 *
At this point, you're ready to run or debug your program. From here on,
you can use all the usual gdb commands. The break command
sets breakpoints; the run command starts your program;
print or x display data; the continue command
resumes execution after stopping at a breakpoint. You can use the
help command at any time to find out more about gdb commands.
Remember, however, that operating system facilities aren't
available on your development board; for example, if your program hangs,
you can't send an interrupt--but you can press the reset switch!
Use the reset button on the development board
to interrupt your program (don't use ctl-C on the DOS host--it has
no way to pass an interrupt signal to the development board); and
to return to the gdb command prompt after your program finishes
normally. The communications protocol provides no other way for gdb
to detect program completion.
In either case, gdb sees the effect of a reset on the
development board as a "normal exit" of your program.
220.127.116.11. Using the E7000 in-circuit emulator
You can use the E7000 in-circuit emulator to develop code for either the
Hitachi SH or the H8/300H. Use one of these forms of the target
e7000 command to connect gdb to your E7000:
target e7000 portspeed
Use this form if your E7000 is connected to a serial port. The
port argument identifies what serial port to use (for example,
com2). The third argument is the line speed in bits per second
(for example, 9600).
target e7000 hostname
If your E7000 is installed as a host on a TCP/IP network, you can just
specify its hostname; gdb uses telnet to connect.
18.104.22.168. Special gdb commands for Hitachi micros
Some gdb commands are available only for the H8/300:
set machine h8300, set machine h8300h
Condition gdb for one of the two variants of the H8/300
architecture with set machine. You can use show machine
to check which variant is currently in effect.
set memory mod, show memory
Specify which H8/500 memory model (mod) you are using with
set memory; check which memory model is in effect with show
memory. The accepted values for mod are small,
big, medium, and compact.
20.3.4. Mitsubishi M32R/D
target m32r dev
Mitsubishi M32R/D ROM monitor.
The Motorola m68k configuration includes ColdFire support, and
target command for the following ROM monitors.
target abug dev
ABug ROM monitor for M68K.
target cpu32bug dev
CPU32BUG monitor, running on a CPU32 (M68K) board.
target dbug dev
dBUG ROM monitor for Motorola ColdFire.
target est dev
EST-300 ICE monitor, running on a CPU32 (M68K) board.
target rom68k dev
ROM 68K monitor, running on an M68K IDP board.
target rombug dev
ROMBUG ROM monitor for OS/9000.
20.3.6. MIPS Embedded
gdb can use the MIPS remote debugging protocol to talk to a
MIPS board attached to a serial line. This is available when
you configure gdb with -target=mips-idt-ecoff.
Use these gdb commands to specify the connection to your target board:
target mips port
To run a program on the board, start up gdb with the
name of your program as the argument. To connect to the board, use the
command target mips port, where port is the name of
the serial port connected to the board. If the program has not already
been downloaded to the board, you may use the load command to
download it. You can then use all the usual gdb commands.
For example, this sequence connects to the target board through a serial
port, and loads and runs a program called prog through the
host$ gdb prog
gdb is free software and …
(gdb) target mips /dev/ttyb
(gdb) load prog
target mips hostname:portnumber
On some gdb host configurations, you can specify a TCP
connection (for instance, to a serial line managed by a terminal
concentrator) instead of a serial port, using the syntax
target pmon port
PMON ROM monitor.
target ddb port
NEC's DDB variant of PMON for Vr4300.
target lsi port
LSI variant of PMON.
target r3900 dev
Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips.
target array dev
Array Tech LSI33K RAID controller board.
gdb also supports these special commands for MIPS targets:
set processor args, show processor
Use the set processor command to set the type of MIPS
processor when you want to access processor-type-specific registers.
For example, set processor r3041 tells gdb
to use the CPU registers appropriate for the 3041 chip.
Use the show processor command to see what MIPS processor gdb
is using. Use the info reg command to see what registers
gdb is using.
set mipsfpu double, set mipsfpu single, set mipsfpu none, show mipsfpu
If your target board does not support the MIPS floating point
coprocessor, you should use the command set mipsfpu none (if you
need this, you may wish to put the command in your gdb init
file). This tells gdb how to find the return value of
functions which return floating point values. It also allows
gdb to avoid saving the floating point registers when calling
functions on the board. If you are using a floating point coprocessor
with only single precision floating point support, as on the r4650
processor, use the command set mipsfpu single. The default
double precision floating point coprocessor may be selected using
set mipsfpu double.
In previous versions the only choices were double precision or no
floating point, so set mipsfpu on will select double precision
and set mipsfpu off will select no floating point.
As usual, you can inquire about the mipsfpu variable with
set remotedebug n, show remotedebug
You can see some debugging information about communications with the board
by setting the remotedebug variable. If you set it to 1 using
set remotedebug 1, every packet is displayed. If you set it
to 2, every character is displayed. You can check the current value
at any time with the command show remotedebug.
set timeout seconds, set retransmit-timeout seconds, show timeout, show retransmit-timeout
You can control the timeout used while waiting for a packet, in the MIPS
remote protocol, with the set timeout seconds command. The
default is 5 seconds. Similarly, you can control the timeout used while
waiting for an acknowledgement of a packet with the set
retransmit-timeout seconds command. The default is 3 seconds.
You can inspect both values with show timeout and show
retransmit-timeout. (These commands are only available when
gdb is configured for -target=mips-idt-ecoff.)
The timeout set by set timeout does not apply when gdb
is waiting for your program to stop. In that case, gdb waits
forever because it has no way of knowing how long the program is going
to run before stopping.
20.3.7. OpenRISC 1000
See OR1k Architecture document (www.opencores.org) for more information
about platform and commands.
target jtag jtag://host:port
Connects to remote JTAG server.
JTAG remote server can be either an or1ksim or JTAG server,
connected via parallel port to the board.
Example: target jtag jtag://localhost:9999
If connected to or1ksim OpenRISC 1000 Architectural
Simulator, proprietary commands can be executed.
info or1k spr
Displays spr groups.
info or1k spr group, info or1k spr groupno
Displays register names in selected group.
info or1k spr groupregister, info or1k spr register, info or1k spr groupnoregisterno, info or1k spr registerno
Some implementations of OpenRISC 1000 Architecture also have hardware trace.
It is very similar to gdb trace, except it does not interfere with normal
program execution and is thus much faster. Hardware breakpoints/watchpoint
triggers can be set using:
Load effective address/data
Store effective address/data
Access effective address ($SEA or $LEA) or data ($SDATA/$LDATA)
When triggered, it can capture low level data, like: PC, LSEA,
LDATA, SDATA, READSPR, WRITESPR, INSTR.
Set hardware watchpoint on combination of Load/Store Effecive Address(es)
or Data. For example:
Display information about current HW trace configuration.
htrace trigger conditional
Set starting criteria for HW trace.
htrace qualifier conditional
Set acquisition qualifier for HW trace.
htrace stop conditional
Set HW trace stopping criteria.
htrace record [data]*
Selects the data to be recorded, when qualifier is met and HW trace was
Enables/disables the HW trace.
htrace rewind [filename]
Clears currently recorded trace data.
If filename is specified, new trace file is made and any newly collected data
will be written there.
htrace print [start [len]]
Prints trace buffer, using current record configuration.
htrace mode continuous
Set continuous trace mode.
htrace mode suspend
Set suspend trace mode.
target dink32 dev
DINK32 ROM monitor.
target ppcbug dev
target ppcbug1 dev
PPCBUG ROM monitor for PowerPC.
target sds dev
SDS monitor, running on a PowerPC board (such as Motorola's ADS).
20.3.9. HP PA Embedded
target op50n dev
OP50N monitor, running on an OKI HPPA board.
target w89k dev
W89K monitor, running on a Winbond HPPA board.
20.3.10. Hitachi SH
target hms dev
A Hitachi SH board attached via serial line to your host. Use special
commands device and speed to control the serial line and
the communications speed used.
target e7000 dev
E7000 emulator for Hitachi SH.
target sh3 dev, target sh3e dev
Hitachi SH-3 and SH-3E target systems.
20.3.11. Tsqware Sparclet
gdb enables developers to debug tasks running on
Sparclet targets from a Unix host.
gdb uses code that runs on
both the Unix host and on the Sparclet target. The program
gdb is installed and executed on the Unix host.
gdb supports the option remotetimeout.
This option is set by the user, and args represents the number of
seconds gdb waits for responses.
When compiling for debugging, include the options -g to get debug
information and -Ttext to relocate the program to where you wish to
load it on the target. You may also want to add the options -n or
-N in order to reduce the size of the sections. Example:
You can use objdump to verify that the addresses are what you intended:
sparclet-aout-objdump --headers --syms prog
Once you have set
your Unix execution search path to find gdb, you are ready to
run gdb. From your Unix host, run gdb
(or sparclet-aout-gdb, depending on your installation).
gdb comes up showing the prompt:
22.214.171.124. Setting file to debug
The gdb command file lets you choose with program to debug.
(gdbslet) file prog
gdb then attempts to read the symbol table of prog.
the file by searching the directories listed in the command search
If the file was compiled with debug information (option "-g"), source
files will be searched as well.
the source files by searching the directories listed in the directory search
path (refer to Section 6.4 Your program's environment).
If it fails
to find a file, it displays a message such as:
prog: No such file or directory.
When this happens, add the appropriate directories to the search paths with
the gdb commands path and dir, and execute the
target command again.
126.96.36.199. Connecting to Sparclet
The gdb command target lets you connect to a Sparclet target.
To connect to a target on serial port "ttya", type:
(gdbslet) target sparclet /dev/ttya
Remote target sparclet connected to /dev/ttya
main () at ../prog.c:3
gdb displays messages like these:
Connected to ttya.
188.8.131.52. Sparclet download
Once connected to the Sparclet target,
you can use the gdb
load command to download the file from the host to the target.
The file name and load offset should be given as arguments to the load
Since the file format is aout, the program must be loaded to the starting
address. You can use objdump to find out what this value is. The load
offset is an offset which is added to the VMA (virtual memory address)
of each of the file's sections.
For instance, if the program
prog was linked to text address 0x1201000, with data at 0x12010160
and bss at 0x12010170, in gdb, type:
If the code is loaded at a different address then what the program was linked
to, you may need to use the section and add-symbol-file commands
to tell gdb where to map the symbol table.
184.108.40.206. Running and debugging
You can now begin debugging the task using gdb's execution control
commands, b, step, run, etc. See the gdb
manual for the list of commands.
(gdbslet) b main
Breakpoint 1 at 0x12010000: file prog.c, line 3.
Starting program: prog
Breakpoint 1, main (argc=1, argv=0xeffff21c) at prog.c:3
3 char *symarg = 0;
4 char *execarg = "hello!";
20.3.12. Fujitsu Sparclite
target sparclite dev
Fujitsu sparclite boards, used only for the purpose of loading.
You must use an additional command to debug the program.
For example: target remote dev using gdb standard
20.3.13. Tandem ST2000
gdb may be used with a Tandem ST2000 phone switch, running Tandem's
To connect your ST2000 to the host system, see the manufacturer's
manual. Once the ST2000 is physically attached, you can run:
target st2000 devspeed
to establish it as your debugging environment. dev is normally
the name of a serial device, such as /dev/ttya, connected to the
ST2000 via a serial line. You can instead specify dev as a TCP
connection (for example, to a serial line attached via a terminal
concentrator) using the syntax hostname:portnumber.
The load and attach commands are not defined for
this target; you must load your program into the ST2000 as you normally
would for standalone operation. gdb reads debugging information
(such as symbols) from a separate, debugging version of the program
available on your host computer.
These auxiliary gdb commands are available to help you with the ST2000
Send a command to the STDBUG monitor. See the manufacturer's
manual for available commands.
Connect the controlling terminal to the STDBUG command monitor. When
you are done interacting with STDBUG, typing either of two character
sequences gets you back to the gdb command prompt:
[RET]~. (Return, followed by tilde and period) or
[RET]~[C-d] (Return, followed by tilde and control-D).
20.3.14. Zilog Z8000
When configured for debugging Zilog Z8000 targets, gdb includes
a Z8000 simulator.
For the Z8000 family, target sim simulates either the Z8002 (the
unsegmented variant of the Z8000 architecture) or the Z8001 (the
segmented variant). The simulator recognizes which architecture is
appropriate by inspecting the object code.
target sim args
Debug programs on a simulated CPU. If the simulator supports setup
options, specify them via args.
After specifying this target, you can debug programs for the simulated
CPU in the same style as programs for your host computer; use the
file command to load a new program image, the run command
to run your program, and so on.
As well as making available all the usual machine registers
(refer to Section 10.10 Registers), the Z8000 simulator provides three
additional items of information as specially named registers:
Counts clock-ticks in the simulator.
Counts instructions run in the simulator.
Execution time in 60ths of a second.
You can refer to these values in gdb expressions with the usual
conventions; for example, b fputc if $cycles>5000 sets a
conditional breakpoint that suspends only after at least 5000
simulated clock ticks.