3 <title>Debugging with GDB
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"Debugging with GDB">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"MIPS%20Embedded">MIPS Embedded
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"PA.html#PA">PA
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"M88K.html#M88K">M88K
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"Embedded-Processors.html#Embedded%20Processors">Embedded Processors
</a>
19 <h4 class=
"subsection">MIPS Embedded
</h4>
21 GDB can use the MIPS remote debugging protocol to talk to a
22 MIPS board attached to a serial line. This is available when
23 you configure GDB with
<code>--target=mips-idt-ecoff
</code>.
25 <p>Use these GDB commands to specify the connection to your target board:
28 <dt><code>target mips
</code><var>port
</var><code></code>
29 <dd>To run a program on the board, start up
<code>gdb
</code> with the
30 name of your program as the argument. To connect to the board, use the
31 command
<code>target mips
</code><var>port
</var><code></code>, where
<var>port
</var> is the name of
32 the serial port connected to the board. If the program has not already
33 been downloaded to the board, you may use the
<code>load
</code> command to
34 download it. You can then use all the usual GDB commands.
36 <p>For example, this sequence connects to the target board through a serial
37 port, and loads and runs a program called
<var>prog
</var> through the
40 <pre class=
"example"> host$ gdb
<var>prog
</var>
41 GDB is free software and ...
42 (gdb) target mips /dev/ttyb
43 (gdb) load
<var>prog
</var>
47 <br><dt><code>target mips
</code><var>hostname
</var><code>:
</code><var>portnumber
</var><code></code>
48 <dd>On some GDB host configurations, you can specify a TCP
49 connection (for instance, to a serial line managed by a terminal
50 concentrator) instead of a serial port, using the syntax
51 <code></code><var>hostname
</var><code>:
</code><var>portnumber
</var><code></code>.
53 <br><dt><code>target pmon
</code><var>port
</var><code></code>
56 <br><dt><code>target ddb
</code><var>port
</var><code></code>
57 <dd>NEC's DDB variant of PMON for Vr4300.
59 <br><dt><code>target lsi
</code><var>port
</var><code></code>
60 <dd>LSI variant of PMON.
62 <br><dt><code>target r3900
</code><var>dev
</var><code></code>
63 <dd>Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips.
65 <br><dt><code>target array
</code><var>dev
</var><code></code>
66 <dd>Array Tech LSI33K RAID controller board.
70 GDB also supports these special commands for MIPS targets:
73 <dt><code>set processor
</code><var>args
</var><code></code>
74 <dd><dt><code>show processor
</code>
75 <dd>Use the
<code>set processor
</code> command to set the type of MIPS
76 processor when you want to access processor-type-specific registers.
77 For example,
<code>set processor
</code><var>r3041
</var><code></code> tells GDB
78 to use the CPU registers appropriate for the
3041 chip.
79 Use the
<code>show processor
</code> command to see what MIPS processor GDB
80 is using. Use the
<code>info reg
</code> command to see what registers
83 <br><dt><code>set mipsfpu double
</code>
84 <dd><dt><code>set mipsfpu single
</code>
85 <dd><dt><code>set mipsfpu none
</code>
86 <dd><dt><code>show mipsfpu
</code>
87 <dd>If your target board does not support the MIPS floating point
88 coprocessor, you should use the command
<code>set mipsfpu none
</code> (if you
89 need this, you may wish to put the command in your GDB init
90 file). This tells GDB how to find the return value of
91 functions which return floating point values. It also allows
92 GDB to avoid saving the floating point registers when calling
93 functions on the board. If you are using a floating point coprocessor
94 with only single precision floating point support, as on the
<small>R4650
</small>
95 processor, use the command
<code>set mipsfpu single
</code>. The default
96 double precision floating point coprocessor may be selected using
97 <code>set mipsfpu double
</code>.
99 <p>In previous versions the only choices were double precision or no
100 floating point, so
<code>set mipsfpu on
</code> will select double precision
101 and
<code>set mipsfpu off
</code> will select no floating point.
103 <p>As usual, you can inquire about the
<code>mipsfpu
</code> variable with
104 <code>show mipsfpu
</code>.
106 <br><dt><code>set remotedebug
</code><var>n
</var><code></code>
107 <dd><dt><code>show remotedebug
</code>
108 <dd>You can see some debugging information about communications with the board
109 by setting the
<code>remotedebug
</code> variable. If you set it to
<code>1</code> using
110 <code>set remotedebug
1</code>, every packet is displayed. If you set it
111 to
<code>2</code>, every character is displayed. You can check the current value
112 at any time with the command
<code>show remotedebug
</code>.
114 <br><dt><code>set timeout
</code><var>seconds
</var><code></code>
115 <dd><dt><code>set retransmit-timeout
</code><var>seconds
</var><code></code>
116 <dd><dt><code>show timeout
</code>
117 <dd><dt><code>show retransmit-timeout
</code>
118 <dd>You can control the timeout used while waiting for a packet, in the MIPS
119 remote protocol, with the
<code>set timeout
</code><var>seconds
</var><code></code> command. The
120 default is
5 seconds. Similarly, you can control the timeout used while
121 waiting for an acknowledgement of a packet with the
<code>set
122 retransmit-timeout
</code><var>seconds
</var><code></code> command. The default is
3 seconds.
123 You can inspect both values with
<code>show timeout
</code> and
<code>show
124 retransmit-timeout
</code>. (These commands are
<em>only
</em> available when
125 GDB is configured for
<code>--target=mips-idt-ecoff
</code>.)
127 <p>The timeout set by
<code>set timeout
</code> does not apply when GDB
128 is waiting for your program to stop. In that case, GDB waits
129 forever because it has no way of knowing how long the program is going
130 to run before stopping.