The following documentation discusses the options for the debugging tools for the NEC VR4300 family of processors as well as the target command options and some special debugging commands.
To connect GDB to the DDB-VR4300 board start GDB with the ‘ddb’ target. DDB boards are little-endian and use the PMON monitor. GDB uses the MIPS remote debugging protocol to talk to this target via a serial port. Additionally, the ‘ddb’ target supports network downloading using the TFTP protocol.
To run a program on the DDB-VR4300 board, start up GDB with the name of your program as the argument. To connect to the DDB-VR4300 board, use the command ‘target ddb <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 can use the ‘load’ command to download it. You can then use all the usual GDB commands.
For example, the following sequence connects to the target board through a Unix serial port, and loads and runs a program called ‘prog’ through the debugger:
% mips64vr4300-elf-gdb
prog
GDB is free software and . . .
(gdb) target ddb /dev/ttyb
(gdb) load prog
(gdb) run
On PC platforms substitute the specific COM port:
C:\> gdb prog
GDB is free software and . . .
(gdb) target ddb com3
(gdb) load prog
(gdb) run
You can speed up loading of programs on the DDB board by installing a network card on the board and using TFTP (trivial file transfer protocol) to download programs to the board. You must first configure the DDB board manually for network use. PMON information is available via anonymous FTP from: ‘ftp.cygnus.com:/private/releng/PMON’
There is a README file there with the current information on PMON support at Cygnus Solutions as well as PMON documentation. This is a protected directory, therefore you must first ‘cd’ to it before you can browse it with the ‘ls’ or ‘dir’ commands.
target
ddb <hostname>:<portnumber>
On all GDB
Unix 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 ‘<hostname>:<portnumber>’.
target ddb <port> <remote-tftp-name>
target ddb <hostname>:<portnumber>
<remote-tftp-name>
Specify
a ‘<remote-tftp-name>’
in the target command to enable TFTP downloading in GDB. This name must
be in the format: ‘<host>:<filename>’.
Here ‘<host>’
is either the name or the IP address of the host system that is running
a TFTP server (typically your host Unix workstation). Here ‘<filename>’
is the name of a temporary file that GDB will create during downloading.
The directory containing the temporary file must be world-readable; the
‘/tmp’
directory is usually a good choice.
target ddb <port> <remote-tftp-name>
<local-tftp-name>
target ddb <hostname>:<portnumber>
<remote-tftp-name> <local-tftp-name>
You
can also specify an optional ‘<local-tftp-name>’,
which is a simple filename (without the ‘<host>’
prefix). This tells GDB the name of the temporary filename as seen by the
host machine that is running GDB. This is necessary only if the name of
the file as seen by the host machine is different from the name of that
same file as seen via TFTP from the target board. This might be the case
if the TFTP server is running on a different machine than the GDB host,
and has a different name for the same temporary file because of NFS mounting
or symbolic links.
The following input example is of a TFTP download. The host machine running the TFTP server has the IP address ‘192.168.1.1’. The temporary file that GDB will create for TFTP downloading is ‘/tmp/download.tmp’.
% mips64vr4300-elf-gdb prog
GDB is free software and . . .
(gdb) target ddb /dev/ttyb 192.168.1.1:/tmp/download.tmp}
(gdb) load prog
(gdb) run
In the next example both a remote TFTP name and a local TFTP are specified, because the TFTP server is running on a different machine, and has a different name for the same temporary file than the host machine that is running GDB. The name of the temporary file as seen by the TFTP server is ‘/mymachine/tmp/download.tmp’, but the name of that same file as seen by the host running GDB is ‘/tmp/download.tmp’.
% mips64vr4300-elf-gdb
prog
GDB is free software and . . .
(gdb) target ddb /dev/ttyb 192.168.1.1:/mymachine/tmp/download.tmp
/tmp/download.tmp
(gdb) load prog
(gdb) run
GDB also supports these special commands for MIPS targets:
set remotedebug num
show remotedebug
For
this to be useful, you must know something about the MIPS debugging protocol,
also called ‘rmtdbg’.
An informal description can be found in the GDB source files, specifically
in the file:
‘remote-mips.c’.
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 debugging
protocol, with the ‘set
timeout seconds’
command. The default is 5 seconds. Similarly, you can control the timeout
used while waiting for an acknowledgment of a packet with:
set retransmit-timeout
seconds
The default
is 3 seconds. You can inspect both values with
‘show timeout’
and ‘show retransmit-timeout’.
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.