1 |
106 |
markom |
This is ./gdb.info, produced by Makeinfo version 3.12f from gdb.texinfo.
|
2 |
|
|
|
3 |
|
|
INFO-DIR-SECTION Programming & development tools.
|
4 |
|
|
START-INFO-DIR-ENTRY
|
5 |
|
|
* Gdb: (gdb). The GNU debugger.
|
6 |
|
|
END-INFO-DIR-ENTRY
|
7 |
|
|
|
8 |
|
|
This file documents the GNU debugger GDB.
|
9 |
|
|
|
10 |
|
|
This is the Eighth Edition, March 2000, of `Debugging with GDB: the
|
11 |
|
|
GNU Source-Level Debugger' for GDB Version 5.0.
|
12 |
|
|
|
13 |
|
|
Copyright (C) 1988-2000 Free Software Foundation, Inc.
|
14 |
|
|
|
15 |
|
|
Permission is granted to make and distribute verbatim copies of this
|
16 |
|
|
manual provided the copyright notice and this permission notice are
|
17 |
|
|
preserved on all copies.
|
18 |
|
|
|
19 |
|
|
Permission is granted to copy and distribute modified versions of
|
20 |
|
|
this manual under the conditions for verbatim copying, provided also
|
21 |
|
|
that the entire resulting derived work is distributed under the terms
|
22 |
|
|
of a permission notice identical to this one.
|
23 |
|
|
|
24 |
|
|
Permission is granted to copy and distribute translations of this
|
25 |
|
|
manual into another language, under the above conditions for modified
|
26 |
|
|
versions.
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Targets, Up: Top
|
30 |
|
|
|
31 |
|
|
Configuration-Specific Information
|
32 |
|
|
**********************************
|
33 |
|
|
|
34 |
|
|
While nearly all GDB commands are available for all native and cross
|
35 |
|
|
versions of the debugger, there are some exceptions. This chapter
|
36 |
|
|
describes things that are only available in certain configurations.
|
37 |
|
|
|
38 |
|
|
There are three major categories of configurations: native
|
39 |
|
|
configurations, where the host and target are the same, embedded
|
40 |
|
|
operating system configurations, which are usually the same for several
|
41 |
|
|
different processor architectures, and bare embedded processors, which
|
42 |
|
|
are quite different from each other.
|
43 |
|
|
|
44 |
|
|
* Menu:
|
45 |
|
|
|
46 |
|
|
* Native::
|
47 |
|
|
* Embedded OS::
|
48 |
|
|
* Embedded Processors::
|
49 |
|
|
* Architectures::
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations
|
53 |
|
|
|
54 |
|
|
Native
|
55 |
|
|
======
|
56 |
|
|
|
57 |
|
|
This section describes details specific to particular native
|
58 |
|
|
configurations.
|
59 |
|
|
|
60 |
|
|
* Menu:
|
61 |
|
|
|
62 |
|
|
* HP-UX:: HP-UX
|
63 |
|
|
* SVR4 Process Information:: SVR4 process information
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
File: gdb.info, Node: HP-UX, Next: SVR4 Process Information, Up: Native
|
67 |
|
|
|
68 |
|
|
HP-UX
|
69 |
|
|
-----
|
70 |
|
|
|
71 |
|
|
On HP-UX systems, if you refer to a function or variable name that
|
72 |
|
|
begins with a dollar sign, GDB searches for a user or system name
|
73 |
|
|
first, before it searches for a convenience variable.
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
File: gdb.info, Node: SVR4 Process Information, Prev: HP-UX, Up: Native
|
77 |
|
|
|
78 |
|
|
SVR4 process information
|
79 |
|
|
------------------------
|
80 |
|
|
|
81 |
|
|
Many versions of SVR4 provide a facility called `/proc' that can be
|
82 |
|
|
used to examine the image of a running process using file-system
|
83 |
|
|
subroutines. If GDB is configured for an operating system with this
|
84 |
|
|
facility, the command `info proc' is available to report on several
|
85 |
|
|
kinds of information about the process running your program. `info
|
86 |
|
|
proc' works only on SVR4 systems that include the `procfs' code. This
|
87 |
|
|
includes OSF/1 (Digital Unix), Solaris, Irix, and Unixware, but not
|
88 |
|
|
HP-UX or Linux, for example.
|
89 |
|
|
|
90 |
|
|
`info proc'
|
91 |
|
|
Summarize available information about the process.
|
92 |
|
|
|
93 |
|
|
`info proc mappings'
|
94 |
|
|
Report on the address ranges accessible in the program, with
|
95 |
|
|
information on whether your program may read, write, or execute
|
96 |
|
|
each range.
|
97 |
|
|
|
98 |
|
|
`info proc times'
|
99 |
|
|
Starting time, user CPU time, and system CPU time for your program
|
100 |
|
|
and its children.
|
101 |
|
|
|
102 |
|
|
`info proc id'
|
103 |
|
|
Report on the process IDs related to your program: its own process
|
104 |
|
|
ID, the ID of its parent, the process group ID, and the session ID.
|
105 |
|
|
|
106 |
|
|
`info proc status'
|
107 |
|
|
General information on the state of the process. If the process is
|
108 |
|
|
stopped, this report includes the reason for stopping, and any
|
109 |
|
|
signal received.
|
110 |
|
|
|
111 |
|
|
`info proc all'
|
112 |
|
|
Show all the above information about the process.
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations
|
116 |
|
|
|
117 |
|
|
Embedded Operating Systems
|
118 |
|
|
==========================
|
119 |
|
|
|
120 |
|
|
This section describes configurations involving the debugging of
|
121 |
|
|
embedded operating systems that are available for several different
|
122 |
|
|
architectures.
|
123 |
|
|
|
124 |
|
|
* Menu:
|
125 |
|
|
|
126 |
|
|
* VxWorks:: Using GDB with VxWorks
|
127 |
|
|
|
128 |
|
|
GDB includes the ability to debug programs running on various
|
129 |
|
|
real-time operating systems.
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
File: gdb.info, Node: VxWorks, Up: Embedded OS
|
133 |
|
|
|
134 |
|
|
Using GDB with VxWorks
|
135 |
|
|
----------------------
|
136 |
|
|
|
137 |
|
|
`target vxworks MACHINENAME'
|
138 |
|
|
A VxWorks system, attached via TCP/IP. The argument MACHINENAME
|
139 |
|
|
is the target system's machine name or IP address.
|
140 |
|
|
|
141 |
|
|
On VxWorks, `load' links FILENAME dynamically on the current target
|
142 |
|
|
system as well as adding its symbols in GDB.
|
143 |
|
|
|
144 |
|
|
GDB enables developers to spawn and debug tasks running on networked
|
145 |
|
|
VxWorks targets from a Unix host. Already-running tasks spawned from
|
146 |
|
|
the VxWorks shell can also be debugged. GDB uses code that runs on
|
147 |
|
|
both the Unix host and on the VxWorks target. The program `gdb' is
|
148 |
|
|
installed and executed on the Unix host. (It may be installed with the
|
149 |
|
|
name `vxgdb', to distinguish it from a GDB for debugging programs on
|
150 |
|
|
the host itself.)
|
151 |
|
|
|
152 |
|
|
`VxWorks-timeout ARGS'
|
153 |
|
|
All VxWorks-based targets now support the option `vxworks-timeout'.
|
154 |
|
|
This option is set by the user, and ARGS represents the number of
|
155 |
|
|
seconds GDB waits for responses to rpc's. You might use this if
|
156 |
|
|
your VxWorks target is a slow software simulator or is on the far
|
157 |
|
|
side of a thin network line.
|
158 |
|
|
|
159 |
|
|
The following information on connecting to VxWorks was current when
|
160 |
|
|
this manual was produced; newer releases of VxWorks may use revised
|
161 |
|
|
procedures.
|
162 |
|
|
|
163 |
|
|
To use GDB with VxWorks, you must rebuild your VxWorks kernel to
|
164 |
|
|
include the remote debugging interface routines in the VxWorks library
|
165 |
|
|
`rdb.a'. To do this, define `INCLUDE_RDB' in the VxWorks configuration
|
166 |
|
|
file `configAll.h' and rebuild your VxWorks kernel. The resulting
|
167 |
|
|
kernel contains `rdb.a', and spawns the source debugging task
|
168 |
|
|
`tRdbTask' when VxWorks is booted. For more information on configuring
|
169 |
|
|
and remaking VxWorks, see the manufacturer's manual.
|
170 |
|
|
|
171 |
|
|
Once you have included `rdb.a' in your VxWorks system image and set
|
172 |
|
|
your Unix execution search path to find GDB, you are ready to run GDB.
|
173 |
|
|
From your Unix host, run `gdb' (or `vxgdb', depending on your
|
174 |
|
|
installation).
|
175 |
|
|
|
176 |
|
|
GDB comes up showing the prompt:
|
177 |
|
|
|
178 |
|
|
(vxgdb)
|
179 |
|
|
|
180 |
|
|
* Menu:
|
181 |
|
|
|
182 |
|
|
* VxWorks Connection:: Connecting to VxWorks
|
183 |
|
|
* VxWorks Download:: VxWorks download
|
184 |
|
|
* VxWorks Attach:: Running tasks
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
File: gdb.info, Node: VxWorks Connection, Next: VxWorks Download, Up: VxWorks
|
188 |
|
|
|
189 |
|
|
Connecting to VxWorks
|
190 |
|
|
.....................
|
191 |
|
|
|
192 |
|
|
The GDB command `target' lets you connect to a VxWorks target on the
|
193 |
|
|
network. To connect to a target whose host name is "`tt'", type:
|
194 |
|
|
|
195 |
|
|
(vxgdb) target vxworks tt
|
196 |
|
|
|
197 |
|
|
GDB displays messages like these:
|
198 |
|
|
|
199 |
|
|
Attaching remote machine across net...
|
200 |
|
|
Connected to tt.
|
201 |
|
|
|
202 |
|
|
GDB then attempts to read the symbol tables of any object modules
|
203 |
|
|
loaded into the VxWorks target since it was last booted. GDB locates
|
204 |
|
|
these files by searching the directories listed in the command search
|
205 |
|
|
path (*note Your program's environment: Environment.); if it fails to
|
206 |
|
|
find an object file, it displays a message such as:
|
207 |
|
|
|
208 |
|
|
prog.o: No such file or directory.
|
209 |
|
|
|
210 |
|
|
When this happens, add the appropriate directory to the search path
|
211 |
|
|
with the GDB command `path', and execute the `target' command again.
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
File: gdb.info, Node: VxWorks Download, Next: VxWorks Attach, Prev: VxWorks Connection, Up: VxWorks
|
215 |
|
|
|
216 |
|
|
VxWorks download
|
217 |
|
|
................
|
218 |
|
|
|
219 |
|
|
If you have connected to the VxWorks target and you want to debug an
|
220 |
|
|
object that has not yet been loaded, you can use the GDB `load' command
|
221 |
|
|
to download a file from Unix to VxWorks incrementally. The object file
|
222 |
|
|
given as an argument to the `load' command is actually opened twice:
|
223 |
|
|
first by the VxWorks target in order to download the code, then by GDB
|
224 |
|
|
in order to read the symbol table. This can lead to problems if the
|
225 |
|
|
current working directories on the two systems differ. If both systems
|
226 |
|
|
have NFS mounted the same filesystems, you can avoid these problems by
|
227 |
|
|
using absolute paths. Otherwise, it is simplest to set the working
|
228 |
|
|
directory on both systems to the directory in which the object file
|
229 |
|
|
resides, and then to reference the file by its name, without any path.
|
230 |
|
|
For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
|
231 |
|
|
VxWorks and in `HOSTPATH/vw/demo/rdb' on the host. To load this
|
232 |
|
|
program, type this on VxWorks:
|
233 |
|
|
|
234 |
|
|
-> cd "VXPATH/vw/demo/rdb"
|
235 |
|
|
|
236 |
|
|
Then, in GDB, type:
|
237 |
|
|
|
238 |
|
|
(vxgdb) cd HOSTPATH/vw/demo/rdb
|
239 |
|
|
(vxgdb) load prog.o
|
240 |
|
|
|
241 |
|
|
GDB displays a response similar to this:
|
242 |
|
|
|
243 |
|
|
Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
|
244 |
|
|
|
245 |
|
|
You can also use the `load' command to reload an object module after
|
246 |
|
|
editing and recompiling the corresponding source file. Note that this
|
247 |
|
|
makes GDB delete all currently-defined breakpoints, auto-displays, and
|
248 |
|
|
convenience variables, and to clear the value history. (This is
|
249 |
|
|
necessary in order to preserve the integrity of debugger's data
|
250 |
|
|
structures that reference the target system's symbol table.)
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
File: gdb.info, Node: VxWorks Attach, Prev: VxWorks Download, Up: VxWorks
|
254 |
|
|
|
255 |
|
|
Running tasks
|
256 |
|
|
.............
|
257 |
|
|
|
258 |
|
|
You can also attach to an existing task using the `attach' command as
|
259 |
|
|
follows:
|
260 |
|
|
|
261 |
|
|
(vxgdb) attach TASK
|
262 |
|
|
|
263 |
|
|
where TASK is the VxWorks hexadecimal task ID. The task can be running
|
264 |
|
|
or suspended when you attach to it. Running tasks are suspended at the
|
265 |
|
|
time of attachment.
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations
|
269 |
|
|
|
270 |
|
|
Embedded Processors
|
271 |
|
|
===================
|
272 |
|
|
|
273 |
|
|
This section goes into details specific to particular embedded
|
274 |
|
|
configurations.
|
275 |
|
|
|
276 |
|
|
* Menu:
|
277 |
|
|
|
278 |
|
|
* A29K Embedded:: AMD A29K Embedded
|
279 |
|
|
* ARM:: ARM
|
280 |
|
|
* H8/300:: Hitachi H8/300
|
281 |
|
|
* H8/500:: Hitachi H8/500
|
282 |
|
|
* i960:: Intel i960
|
283 |
|
|
* M32R/D:: Mitsubishi M32R/D
|
284 |
|
|
* M68K:: Motorola M68K
|
285 |
|
|
* M88K:: Motorola M88K
|
286 |
|
|
* MIPS Embedded:: MIPS Embedded
|
287 |
|
|
* PA:: HP PA Embedded
|
288 |
|
|
* PowerPC: PowerPC
|
289 |
|
|
* SH:: Hitachi SH
|
290 |
|
|
* Sparclet:: Tsqware Sparclet
|
291 |
|
|
* Sparclite:: Fujitsu Sparclite
|
292 |
|
|
* ST2000:: Tandem ST2000
|
293 |
|
|
* Z8000:: Zilog Z8000
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
File: gdb.info, Node: A29K Embedded, Next: ARM, Up: Embedded Processors
|
297 |
|
|
|
298 |
|
|
AMD A29K Embedded
|
299 |
|
|
-----------------
|
300 |
|
|
|
301 |
|
|
* Menu:
|
302 |
|
|
|
303 |
|
|
* A29K UDI::
|
304 |
|
|
* A29K EB29K::
|
305 |
|
|
* Comms (EB29K):: Communications setup
|
306 |
|
|
* gdb-EB29K:: EB29K cross-debugging
|
307 |
|
|
* Remote Log:: Remote log
|
308 |
|
|
|
309 |
|
|
`target adapt DEV'
|
310 |
|
|
Adapt monitor for A29K.
|
311 |
|
|
|
312 |
|
|
`target amd-eb DEV SPEED PROG'
|
313 |
|
|
Remote PC-resident AMD EB29K board, attached over serial lines.
|
314 |
|
|
DEV is the serial device, as for `target remote'; SPEED allows you
|
315 |
|
|
to specify the linespeed; and PROG is the name of the program to
|
316 |
|
|
be debugged, as it appears to DOS on the PC. *Note EBMON protocol
|
317 |
|
|
for AMD29K: A29K EB29K.
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
File: gdb.info, Node: A29K UDI, Next: A29K EB29K, Up: A29K Embedded
|
321 |
|
|
|
322 |
|
|
A29K UDI
|
323 |
|
|
........
|
324 |
|
|
|
325 |
|
|
GDB supports AMD's UDI ("Universal Debugger Interface") protocol for
|
326 |
|
|
debugging the a29k processor family. To use this configuration with
|
327 |
|
|
AMD targets running the MiniMON monitor, you need the program `MONTIP',
|
328 |
|
|
available from AMD at no charge. You can also use GDB with the
|
329 |
|
|
UDI-conformant a29k simulator program `ISSTIP', also available from AMD.
|
330 |
|
|
|
331 |
|
|
`target udi KEYWORD'
|
332 |
|
|
Select the UDI interface to a remote a29k board or simulator, where
|
333 |
|
|
KEYWORD is an entry in the AMD configuration file `udi_soc'. This
|
334 |
|
|
file contains keyword entries which specify parameters used to
|
335 |
|
|
connect to a29k targets. If the `udi_soc' file is not in your
|
336 |
|
|
working directory, you must set the environment variable `UDICONF'
|
337 |
|
|
to its pathname.
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
File: gdb.info, Node: A29K EB29K, Next: Comms (EB29K), Prev: A29K UDI, Up: A29K Embedded
|
341 |
|
|
|
342 |
|
|
EBMON protocol for AMD29K
|
343 |
|
|
.........................
|
344 |
|
|
|
345 |
|
|
AMD distributes a 29K development board meant to fit in a PC,
|
346 |
|
|
together with a DOS-hosted monitor program called `EBMON'. As a
|
347 |
|
|
shorthand term, this development system is called the "EB29K". To use
|
348 |
|
|
GDB from a Unix system to run programs on the EB29K board, you must
|
349 |
|
|
first connect a serial cable between the PC (which hosts the EB29K
|
350 |
|
|
board) and a serial port on the Unix system. In the following, we
|
351 |
|
|
assume you've hooked the cable between the PC's `COM1' port and
|
352 |
|
|
`/dev/ttya' on the Unix system.
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
File: gdb.info, Node: Comms (EB29K), Next: gdb-EB29K, Prev: A29K EB29K, Up: A29K Embedded
|
356 |
|
|
|
357 |
|
|
Communications setup
|
358 |
|
|
....................
|
359 |
|
|
|
360 |
|
|
The next step is to set up the PC's port, by doing something like
|
361 |
|
|
this in DOS on the PC:
|
362 |
|
|
|
363 |
|
|
C:\> MODE com1:9600,n,8,1,none
|
364 |
|
|
|
365 |
|
|
This example--run on an MS DOS 4.0 system--sets the PC port to 9600
|
366 |
|
|
bps, no parity, eight data bits, one stop bit, and no "retry" action;
|
367 |
|
|
you must match the communications parameters when establishing the Unix
|
368 |
|
|
end of the connection as well.
|
369 |
|
|
|
370 |
|
|
To give control of the PC to the Unix side of the serial line, type
|
371 |
|
|
the following at the DOS console:
|
372 |
|
|
|
373 |
|
|
C:\> CTTY com1
|
374 |
|
|
|
375 |
|
|
(Later, if you wish to return control to the DOS console, you can use
|
376 |
|
|
the command `CTTY con'--but you must send it over the device that had
|
377 |
|
|
control, in our example over the `COM1' serial line.)
|
378 |
|
|
|
379 |
|
|
From the Unix host, use a communications program such as `tip' or
|
380 |
|
|
`cu' to communicate with the PC; for example,
|
381 |
|
|
|
382 |
|
|
cu -s 9600 -l /dev/ttya
|
383 |
|
|
|
384 |
|
|
The `cu' options shown specify, respectively, the linespeed and the
|
385 |
|
|
serial port to use. If you use `tip' instead, your command line may
|
386 |
|
|
look something like the following:
|
387 |
|
|
|
388 |
|
|
tip -9600 /dev/ttya
|
389 |
|
|
|
390 |
|
|
Your system may require a different name where we show `/dev/ttya' as
|
391 |
|
|
the argument to `tip'. The communications parameters, including which
|
392 |
|
|
port to use, are associated with the `tip' argument in the "remote"
|
393 |
|
|
descriptions file--normally the system table `/etc/remote'.
|
394 |
|
|
|
395 |
|
|
Using the `tip' or `cu' connection, change the DOS working directory
|
396 |
|
|
to the directory containing a copy of your 29K program, then start the
|
397 |
|
|
PC program `EBMON' (an EB29K control program supplied with your board
|
398 |
|
|
by AMD). You should see an initial display from `EBMON' similar to the
|
399 |
|
|
one that follows, ending with the `EBMON' prompt `#'--
|
400 |
|
|
|
401 |
|
|
C:\> G:
|
402 |
|
|
|
403 |
|
|
G:\> CD \usr\joe\work29k
|
404 |
|
|
|
405 |
|
|
G:\USR\JOE\WORK29K> EBMON
|
406 |
|
|
Am29000 PC Coprocessor Board Monitor, version 3.0-18
|
407 |
|
|
Copyright 1990 Advanced Micro Devices, Inc.
|
408 |
|
|
Written by Gibbons and Associates, Inc.
|
409 |
|
|
|
410 |
|
|
Enter '?' or 'H' for help
|
411 |
|
|
|
412 |
|
|
PC Coprocessor Type = EB29K
|
413 |
|
|
I/O Base = 0x208
|
414 |
|
|
Memory Base = 0xd0000
|
415 |
|
|
|
416 |
|
|
Data Memory Size = 2048KB
|
417 |
|
|
Available I-RAM Range = 0x8000 to 0x1fffff
|
418 |
|
|
Available D-RAM Range = 0x80002000 to 0x801fffff
|
419 |
|
|
|
420 |
|
|
PageSize = 0x400
|
421 |
|
|
Register Stack Size = 0x800
|
422 |
|
|
Memory Stack Size = 0x1800
|
423 |
|
|
|
424 |
|
|
CPU PRL = 0x3
|
425 |
|
|
Am29027 Available = No
|
426 |
|
|
Byte Write Available = Yes
|
427 |
|
|
|
428 |
|
|
# ~.
|
429 |
|
|
|
430 |
|
|
Then exit the `cu' or `tip' program (done in the example by typing
|
431 |
|
|
`~.' at the `EBMON' prompt). `EBMON' keeps running, ready for GDB to
|
432 |
|
|
take over.
|
433 |
|
|
|
434 |
|
|
For this example, we've assumed what is probably the most convenient
|
435 |
|
|
way to make sure the same 29K program is on both the PC and the Unix
|
436 |
|
|
system: a PC/NFS connection that establishes "drive `G:'" on the PC as
|
437 |
|
|
a file system on the Unix host. If you do not have PC/NFS or something
|
438 |
|
|
similar connecting the two systems, you must arrange some other
|
439 |
|
|
way--perhaps floppy-disk transfer--of getting the 29K program from the
|
440 |
|
|
Unix system to the PC; GDB does _not_ download it over the serial line.
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
File: gdb.info, Node: gdb-EB29K, Next: Remote Log, Prev: Comms (EB29K), Up: A29K Embedded
|
444 |
|
|
|
445 |
|
|
EB29K cross-debugging
|
446 |
|
|
.....................
|
447 |
|
|
|
448 |
|
|
Finally, `cd' to the directory containing an image of your 29K
|
449 |
|
|
program on the Unix system, and start GDB--specifying as argument the
|
450 |
|
|
name of your 29K program:
|
451 |
|
|
|
452 |
|
|
cd /usr/joe/work29k
|
453 |
|
|
gdb myfoo
|
454 |
|
|
|
455 |
|
|
Now you can use the `target' command:
|
456 |
|
|
|
457 |
|
|
target amd-eb /dev/ttya 9600 MYFOO
|
458 |
|
|
|
459 |
|
|
In this example, we've assumed your program is in a file called
|
460 |
|
|
`myfoo'. Note that the filename given as the last argument to `target
|
461 |
|
|
amd-eb' should be the name of the program as it appears to DOS. In our
|
462 |
|
|
example this is simply `MYFOO', but in general it can include a DOS
|
463 |
|
|
path, and depending on your transfer mechanism may not resemble the
|
464 |
|
|
name on the Unix side.
|
465 |
|
|
|
466 |
|
|
At this point, you can set any breakpoints you wish; when you are
|
467 |
|
|
ready to see your program run on the 29K board, use the GDB command
|
468 |
|
|
`run'.
|
469 |
|
|
|
470 |
|
|
To stop debugging the remote program, use the GDB `detach' command.
|
471 |
|
|
|
472 |
|
|
To return control of the PC to its console, use `tip' or `cu' once
|
473 |
|
|
again, after your GDB session has concluded, to attach to `EBMON'. You
|
474 |
|
|
can then type the command `q' to shut down `EBMON', returning control
|
475 |
|
|
to the DOS command-line interpreter. Type `CTTY con' to return command
|
476 |
|
|
input to the main DOS console, and type `~.' to leave `tip' or `cu'.
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
File: gdb.info, Node: Remote Log, Prev: gdb-EB29K, Up: A29K Embedded
|
480 |
|
|
|
481 |
|
|
Remote log
|
482 |
|
|
..........
|
483 |
|
|
|
484 |
|
|
The `target amd-eb' command creates a file `eb.log' in the current
|
485 |
|
|
working directory, to help debug problems with the connection.
|
486 |
|
|
`eb.log' records all the output from `EBMON', including echoes of the
|
487 |
|
|
commands sent to it. Running `tail -f' on this file in another window
|
488 |
|
|
often helps to understand trouble with `EBMON', or unexpected events on
|
489 |
|
|
the PC side of the connection.
|
490 |
|
|
|
491 |
|
|
|
492 |
|
|
File: gdb.info, Node: ARM, Next: H8/300, Prev: A29K Embedded, Up: Embedded Processors
|
493 |
|
|
|
494 |
|
|
ARM
|
495 |
|
|
---
|
496 |
|
|
|
497 |
|
|
`target rdi DEV'
|
498 |
|
|
ARM Angel monitor, via RDI library interface to ADP protocol. You
|
499 |
|
|
may use this target to communicate with both boards running the
|
500 |
|
|
Angel monitor, or with the EmbeddedICE JTAG debug device.
|
501 |
|
|
|
502 |
|
|
`target rdp DEV'
|
503 |
|
|
ARM Demon monitor.
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
File: gdb.info, Node: H8/300, Next: H8/500, Prev: ARM, Up: Embedded Processors
|
507 |
|
|
|
508 |
|
|
Hitachi H8/300
|
509 |
|
|
--------------
|
510 |
|
|
|
511 |
|
|
`target hms DEV'
|
512 |
|
|
A Hitachi SH, H8/300, or H8/500 board, attached via serial line to
|
513 |
|
|
your host. Use special commands `device' and `speed' to control
|
514 |
|
|
the serial line and the communications speed used.
|
515 |
|
|
|
516 |
|
|
`target e7000 DEV'
|
517 |
|
|
E7000 emulator for Hitachi H8 and SH.
|
518 |
|
|
|
519 |
|
|
`target sh3 DEV'
|
520 |
|
|
`target sh3e DEV'
|
521 |
|
|
Hitachi SH-3 and SH-3E target systems.
|
522 |
|
|
|
523 |
|
|
When you select remote debugging to a Hitachi SH, H8/300, or H8/500
|
524 |
|
|
board, the `load' command downloads your program to the Hitachi board
|
525 |
|
|
and also opens it as the current executable target for GDB on your host
|
526 |
|
|
(like the `file' command).
|
527 |
|
|
|
528 |
|
|
GDB needs to know these things to talk to your Hitachi SH, H8/300,
|
529 |
|
|
or H8/500:
|
530 |
|
|
|
531 |
|
|
1. that you want to use `target hms', the remote debugging interface
|
532 |
|
|
for Hitachi microprocessors, or `target e7000', the in-circuit
|
533 |
|
|
emulator for the Hitachi SH and the Hitachi 300H. (`target hms' is
|
534 |
|
|
the default when GDB is configured specifically for the Hitachi SH,
|
535 |
|
|
H8/300, or H8/500.)
|
536 |
|
|
|
537 |
|
|
2. what serial device connects your host to your Hitachi board (the
|
538 |
|
|
first serial device available on your host is the default).
|
539 |
|
|
|
540 |
|
|
3. what speed to use over the serial device.
|
541 |
|
|
|
542 |
|
|
* Menu:
|
543 |
|
|
|
544 |
|
|
* Hitachi Boards:: Connecting to Hitachi boards.
|
545 |
|
|
* Hitachi ICE:: Using the E7000 In-Circuit Emulator.
|
546 |
|
|
* Hitachi Special:: Special GDB commands for Hitachi micros.
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
File: gdb.info, Node: Hitachi Boards, Next: Hitachi ICE, Up: H8/300
|
550 |
|
|
|
551 |
|
|
Connecting to Hitachi boards
|
552 |
|
|
............................
|
553 |
|
|
|
554 |
|
|
Use the special `GDB' command `device PORT' if you need to
|
555 |
|
|
explicitly set the serial device. The default PORT is the first
|
556 |
|
|
available port on your host. This is only necessary on Unix hosts,
|
557 |
|
|
where it is typically something like `/dev/ttya'.
|
558 |
|
|
|
559 |
|
|
`GDB' has another special command to set the communications speed:
|
560 |
|
|
`speed BPS'. This command also is only used from Unix hosts; on DOS
|
561 |
|
|
hosts, set the line speed as usual from outside GDB with the DOS `mode'
|
562 |
|
|
command (for instance, `mode com2:9600,n,8,1,p' for a 9600bps
|
563 |
|
|
connection).
|
564 |
|
|
|
565 |
|
|
The `device' and `speed' commands are available only when you use a
|
566 |
|
|
Unix host to debug your Hitachi microprocessor programs. If you use a
|
567 |
|
|
DOS host, GDB depends on an auxiliary terminate-and-stay-resident
|
568 |
|
|
program called `asynctsr' to communicate with the development board
|
569 |
|
|
through a PC serial port. You must also use the DOS `mode' command to
|
570 |
|
|
set up the serial port on the DOS side.
|
571 |
|
|
|
572 |
|
|
The following sample session illustrates the steps needed to start a
|
573 |
|
|
program under GDB control on an H8/300. The example uses a sample
|
574 |
|
|
H8/300 program called `t.x'. The procedure is the same for the Hitachi
|
575 |
|
|
SH and the H8/500.
|
576 |
|
|
|
577 |
|
|
First hook up your development board. In this example, we use a
|
578 |
|
|
board attached to serial port `COM2'; if you use a different serial
|
579 |
|
|
port, substitute its name in the argument of the `mode' command. When
|
580 |
|
|
you call `asynctsr', the auxiliary comms program used by the debugger,
|
581 |
|
|
you give it just the numeric part of the serial port's name; for
|
582 |
|
|
example, `asyncstr 2' below runs `asyncstr' on `COM2'.
|
583 |
|
|
|
584 |
|
|
C:\H8300\TEST> asynctsr 2
|
585 |
|
|
C:\H8300\TEST> mode com2:9600,n,8,1,p
|
586 |
|
|
|
587 |
|
|
Resident portion of MODE loaded
|
588 |
|
|
|
589 |
|
|
COM2: 9600, n, 8, 1, p
|
590 |
|
|
|
591 |
|
|
_Warning:_ We have noticed a bug in PC-NFS that conflicts with
|
592 |
|
|
`asynctsr'. If you also run PC-NFS on your DOS host, you may need
|
593 |
|
|
to disable it, or even boot without it, to use `asynctsr' to
|
594 |
|
|
control your development board.
|
595 |
|
|
|
596 |
|
|
Now that serial communications are set up, and the development board
|
597 |
|
|
is connected, you can start up GDB. Call `gdb' with the name of your
|
598 |
|
|
program as the argument. `GDB' prompts you, as usual, with the prompt
|
599 |
|
|
`(gdb)'. Use two special commands to begin your debugging session:
|
600 |
|
|
`target hms' to specify cross-debugging to the Hitachi board, and the
|
601 |
|
|
`load' command to download your program to the board. `load' displays
|
602 |
|
|
the names of the program's sections, and a `*' for each 2K of data
|
603 |
|
|
downloaded. (If you want to refresh GDB data on symbols or on the
|
604 |
|
|
executable file without downloading, use the GDB commands `file' or
|
605 |
|
|
`symbol-file'. These commands, and `load' itself, are described in
|
606 |
|
|
*Note Commands to specify files: Files.)
|
607 |
|
|
|
608 |
|
|
(eg-C:\H8300\TEST) gdb t.x
|
609 |
|
|
GDB is free software and you are welcome to distribute copies
|
610 |
|
|
of it under certain conditions; type "show copying" to see
|
611 |
|
|
the conditions.
|
612 |
|
|
There is absolutely no warranty for GDB; type "show warranty"
|
613 |
|
|
for details.
|
614 |
|
|
GDB 5.0, Copyright 1992 Free Software Foundation, Inc...
|
615 |
|
|
(gdb) target hms
|
616 |
|
|
Connected to remote H8/300 HMS system.
|
617 |
|
|
(gdb) load t.x
|
618 |
|
|
.text : 0x8000 .. 0xabde ***********
|
619 |
|
|
.data : 0xabde .. 0xad30 *
|
620 |
|
|
.stack : 0xf000 .. 0xf014 *
|
621 |
|
|
|
622 |
|
|
At this point, you're ready to run or debug your program. From here
|
623 |
|
|
on, you can use all the usual GDB commands. The `break' command sets
|
624 |
|
|
breakpoints; the `run' command starts your program; `print' or `x'
|
625 |
|
|
display data; the `continue' command resumes execution after stopping
|
626 |
|
|
at a breakpoint. You can use the `help' command at any time to find
|
627 |
|
|
out more about GDB commands.
|
628 |
|
|
|
629 |
|
|
Remember, however, that _operating system_ facilities aren't
|
630 |
|
|
available on your development board; for example, if your program hangs,
|
631 |
|
|
you can't send an interrupt--but you can press the RESET switch!
|
632 |
|
|
|
633 |
|
|
Use the RESET button on the development board
|
634 |
|
|
* to interrupt your program (don't use `ctl-C' on the DOS host--it
|
635 |
|
|
has no way to pass an interrupt signal to the development board);
|
636 |
|
|
and
|
637 |
|
|
|
638 |
|
|
* to return to the GDB command prompt after your program finishes
|
639 |
|
|
normally. The communications protocol provides no other way for
|
640 |
|
|
GDB to detect program completion.
|
641 |
|
|
|
642 |
|
|
In either case, GDB sees the effect of a RESET on the development
|
643 |
|
|
board as a "normal exit" of your program.
|
644 |
|
|
|
645 |
|
|
|
646 |
|
|
File: gdb.info, Node: Hitachi ICE, Next: Hitachi Special, Prev: Hitachi Boards, Up: H8/300
|
647 |
|
|
|
648 |
|
|
Using the E7000 in-circuit emulator
|
649 |
|
|
...................................
|
650 |
|
|
|
651 |
|
|
You can use the E7000 in-circuit emulator to develop code for either
|
652 |
|
|
the Hitachi SH or the H8/300H. Use one of these forms of the `target
|
653 |
|
|
e7000' command to connect GDB to your E7000:
|
654 |
|
|
|
655 |
|
|
`target e7000 PORT SPEED'
|
656 |
|
|
Use this form if your E7000 is connected to a serial port. The
|
657 |
|
|
PORT argument identifies what serial port to use (for example,
|
658 |
|
|
`com2'). The third argument is the line speed in bits per second
|
659 |
|
|
(for example, `9600').
|
660 |
|
|
|
661 |
|
|
`target e7000 HOSTNAME'
|
662 |
|
|
If your E7000 is installed as a host on a TCP/IP network, you can
|
663 |
|
|
just specify its hostname; GDB uses `telnet' to connect.
|
664 |
|
|
|
665 |
|
|
|
666 |
|
|
File: gdb.info, Node: Hitachi Special, Prev: Hitachi ICE, Up: H8/300
|
667 |
|
|
|
668 |
|
|
Special GDB commands for Hitachi micros
|
669 |
|
|
.......................................
|
670 |
|
|
|
671 |
|
|
Some GDB commands are available only for the H8/300:
|
672 |
|
|
|
673 |
|
|
`set machine h8300'
|
674 |
|
|
`set machine h8300h'
|
675 |
|
|
Condition GDB for one of the two variants of the H8/300
|
676 |
|
|
architecture with `set machine'. You can use `show machine' to
|
677 |
|
|
check which variant is currently in effect.
|
678 |
|
|
|
679 |
|
|
|
680 |
|
|
File: gdb.info, Node: H8/500, Next: i960, Prev: H8/300, Up: Embedded Processors
|
681 |
|
|
|
682 |
|
|
H8/500
|
683 |
|
|
------
|
684 |
|
|
|
685 |
|
|
`set memory MOD'
|
686 |
|
|
`show memory'
|
687 |
|
|
Specify which H8/500 memory model (MOD) you are using with `set
|
688 |
|
|
memory'; check which memory model is in effect with `show memory'.
|
689 |
|
|
The accepted values for MOD are `small', `big', `medium', and
|
690 |
|
|
`compact'.
|
691 |
|
|
|
692 |
|
|
|
693 |
|
|
File: gdb.info, Node: i960, Next: M32R/D, Prev: H8/500, Up: Embedded Processors
|
694 |
|
|
|
695 |
|
|
Intel i960
|
696 |
|
|
----------
|
697 |
|
|
|
698 |
|
|
`target mon960 DEV'
|
699 |
|
|
MON960 monitor for Intel i960.
|
700 |
|
|
|
701 |
|
|
`target nindy DEVICENAME'
|
702 |
|
|
An Intel 960 board controlled by a Nindy Monitor. DEVICENAME is
|
703 |
|
|
the name of the serial device to use for the connection, e.g.
|
704 |
|
|
`/dev/ttya'.
|
705 |
|
|
|
706 |
|
|
"Nindy" is a ROM Monitor program for Intel 960 target systems. When
|
707 |
|
|
GDB is configured to control a remote Intel 960 using Nindy, you can
|
708 |
|
|
tell GDB how to connect to the 960 in several ways:
|
709 |
|
|
|
710 |
|
|
* Through command line options specifying serial port, version of the
|
711 |
|
|
Nindy protocol, and communications speed;
|
712 |
|
|
|
713 |
|
|
* By responding to a prompt on startup;
|
714 |
|
|
|
715 |
|
|
* By using the `target' command at any point during your GDB
|
716 |
|
|
session. *Note Commands for managing targets: Target Commands.
|
717 |
|
|
|
718 |
|
|
|
719 |
|
|
With the Nindy interface to an Intel 960 board, `load' downloads
|
720 |
|
|
FILENAME to the 960 as well as adding its symbols in GDB.
|
721 |
|
|
|
722 |
|
|
* Menu:
|
723 |
|
|
|
724 |
|
|
* Nindy Startup:: Startup with Nindy
|
725 |
|
|
* Nindy Options:: Options for Nindy
|
726 |
|
|
* Nindy Reset:: Nindy reset command
|
727 |
|
|
|
728 |
|
|
|
729 |
|
|
File: gdb.info, Node: Nindy Startup, Next: Nindy Options, Up: i960
|
730 |
|
|
|
731 |
|
|
Startup with Nindy
|
732 |
|
|
..................
|
733 |
|
|
|
734 |
|
|
If you simply start `gdb' without using any command-line options,
|
735 |
|
|
you are prompted for what serial port to use, _before_ you reach the
|
736 |
|
|
ordinary GDB prompt:
|
737 |
|
|
|
738 |
|
|
Attach /dev/ttyNN -- specify NN, or "quit" to quit:
|
739 |
|
|
|
740 |
|
|
Respond to the prompt with whatever suffix (after `/dev/tty')
|
741 |
|
|
identifies the serial port you want to use. You can, if you choose,
|
742 |
|
|
simply start up with no Nindy connection by responding to the prompt
|
743 |
|
|
with an empty line. If you do this and later wish to attach to Nindy,
|
744 |
|
|
use `target' (*note Commands for managing targets: Target Commands.).
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
File: gdb.info, Node: Nindy Options, Next: Nindy Reset, Prev: Nindy Startup, Up: i960
|
748 |
|
|
|
749 |
|
|
Options for Nindy
|
750 |
|
|
.................
|
751 |
|
|
|
752 |
|
|
These are the startup options for beginning your GDB session with a
|
753 |
|
|
Nindy-960 board attached:
|
754 |
|
|
|
755 |
|
|
`-r PORT'
|
756 |
|
|
Specify the serial port name of a serial interface to be used to
|
757 |
|
|
connect to the target system. This option is only available when
|
758 |
|
|
GDB is configured for the Intel 960 target architecture. You may
|
759 |
|
|
specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
|
760 |
|
|
device name in `/dev' (e.g. `-r ttya'), or simply the unique
|
761 |
|
|
suffix for a specific `tty' (e.g. `-r a').
|
762 |
|
|
|
763 |
|
|
`-O'
|
764 |
|
|
(An uppercase letter "O", not a zero.) Specify that GDB should use
|
765 |
|
|
the "old" Nindy monitor protocol to connect to the target system.
|
766 |
|
|
This option is only available when GDB is configured for the Intel
|
767 |
|
|
960 target architecture.
|
768 |
|
|
|
769 |
|
|
_Warning:_ if you specify `-O', but are actually trying to
|
770 |
|
|
connect to a target system that expects the newer protocol,
|
771 |
|
|
the connection fails, appearing to be a speed mismatch. GDB
|
772 |
|
|
repeatedly attempts to reconnect at several different line
|
773 |
|
|
speeds. You can abort this process with an interrupt.
|
774 |
|
|
|
775 |
|
|
`-brk'
|
776 |
|
|
Specify that GDB should first send a `BREAK' signal to the target
|
777 |
|
|
system, in an attempt to reset it, before connecting to a Nindy
|
778 |
|
|
target.
|
779 |
|
|
|
780 |
|
|
_Warning:_ Many target systems do not have the hardware that
|
781 |
|
|
this requires; it only works with a few boards.
|
782 |
|
|
|
783 |
|
|
The standard `-b' option controls the line speed used on the serial
|
784 |
|
|
port.
|
785 |
|
|
|
786 |
|
|
|
787 |
|
|
File: gdb.info, Node: Nindy Reset, Prev: Nindy Options, Up: i960
|
788 |
|
|
|
789 |
|
|
Nindy reset command
|
790 |
|
|
...................
|
791 |
|
|
|
792 |
|
|
`reset'
|
793 |
|
|
For a Nindy target, this command sends a "break" to the remote
|
794 |
|
|
target system; this is only useful if the target has been equipped
|
795 |
|
|
with a circuit to perform a hard reset (or some other interesting
|
796 |
|
|
action) when a break is detected.
|
797 |
|
|
|
798 |
|
|
|
799 |
|
|
File: gdb.info, Node: M32R/D, Next: M68K, Prev: i960, Up: Embedded Processors
|
800 |
|
|
|
801 |
|
|
Mitsubishi M32R/D
|
802 |
|
|
-----------------
|
803 |
|
|
|
804 |
|
|
`target m32r DEV'
|
805 |
|
|
Mitsubishi M32R/D ROM monitor.
|
806 |
|
|
|
807 |
|
|
|
808 |
|
|
File: gdb.info, Node: M68K, Next: M88K, Prev: M32R/D, Up: Embedded Processors
|
809 |
|
|
|
810 |
|
|
M68k
|
811 |
|
|
----
|
812 |
|
|
|
813 |
|
|
The Motorola m68k configuration includes ColdFire support, and
|
814 |
|
|
target command for the following ROM monitors.
|
815 |
|
|
|
816 |
|
|
`target abug DEV'
|
817 |
|
|
ABug ROM monitor for M68K.
|
818 |
|
|
|
819 |
|
|
`target cpu32bug DEV'
|
820 |
|
|
CPU32BUG monitor, running on a CPU32 (M68K) board.
|
821 |
|
|
|
822 |
|
|
`target dbug DEV'
|
823 |
|
|
dBUG ROM monitor for Motorola ColdFire.
|
824 |
|
|
|
825 |
|
|
`target est DEV'
|
826 |
|
|
EST-300 ICE monitor, running on a CPU32 (M68K) board.
|
827 |
|
|
|
828 |
|
|
`target rom68k DEV'
|
829 |
|
|
ROM 68K monitor, running on an M68K IDP board.
|
830 |
|
|
|
831 |
|
|
If GDB is configured with `m68*-ericsson-*', it will instead have
|
832 |
|
|
only a single special target command:
|
833 |
|
|
|
834 |
|
|
`target es1800 DEV'
|
835 |
|
|
ES-1800 emulator for M68K.
|
836 |
|
|
|
837 |
|
|
[context?]
|
838 |
|
|
|
839 |
|
|
`target rombug DEV'
|
840 |
|
|
ROMBUG ROM monitor for OS/9000.
|
841 |
|
|
|
842 |
|
|
|
843 |
|
|
File: gdb.info, Node: M88K, Next: MIPS Embedded, Prev: M68K, Up: Embedded Processors
|
844 |
|
|
|
845 |
|
|
M88K
|
846 |
|
|
----
|
847 |
|
|
|
848 |
|
|
`target bug DEV'
|
849 |
|
|
BUG monitor, running on a MVME187 (m88k) board.
|
850 |
|
|
|
851 |
|
|
|
852 |
|
|
File: gdb.info, Node: MIPS Embedded, Next: PA, Prev: M88K, Up: Embedded Processors
|
853 |
|
|
|
854 |
|
|
MIPS Embedded
|
855 |
|
|
-------------
|
856 |
|
|
|
857 |
|
|
GDB can use the MIPS remote debugging protocol to talk to a MIPS
|
858 |
|
|
board attached to a serial line. This is available when you configure
|
859 |
|
|
GDB with `--target=mips-idt-ecoff'.
|
860 |
|
|
|
861 |
|
|
Use these GDB commands to specify the connection to your target
|
862 |
|
|
board:
|
863 |
|
|
|
864 |
|
|
`target mips PORT'
|
865 |
|
|
To run a program on the board, start up `gdb' with the name of
|
866 |
|
|
your program as the argument. To connect to the board, use the
|
867 |
|
|
command `target mips PORT', where PORT is the name of the serial
|
868 |
|
|
port connected to the board. If the program has not already been
|
869 |
|
|
downloaded to the board, you may use the `load' command to
|
870 |
|
|
download it. You can then use all the usual GDB commands.
|
871 |
|
|
|
872 |
|
|
For example, this sequence connects to the target board through a
|
873 |
|
|
serial port, and loads and runs a program called PROG through the
|
874 |
|
|
debugger:
|
875 |
|
|
|
876 |
|
|
host$ gdb PROG
|
877 |
|
|
GDB is free software and ...
|
878 |
|
|
(gdb) target mips /dev/ttyb
|
879 |
|
|
(gdb) load PROG
|
880 |
|
|
(gdb) run
|
881 |
|
|
|
882 |
|
|
`target mips HOSTNAME:PORTNUMBER'
|
883 |
|
|
On some GDB host configurations, you can specify a TCP connection
|
884 |
|
|
(for instance, to a serial line managed by a terminal
|
885 |
|
|
concentrator) instead of a serial port, using the syntax
|
886 |
|
|
`HOSTNAME:PORTNUMBER'.
|
887 |
|
|
|
888 |
|
|
`target pmon PORT'
|
889 |
|
|
PMON ROM monitor.
|
890 |
|
|
|
891 |
|
|
`target ddb PORT'
|
892 |
|
|
NEC's DDB variant of PMON for Vr4300.
|
893 |
|
|
|
894 |
|
|
`target lsi PORT'
|
895 |
|
|
LSI variant of PMON.
|
896 |
|
|
|
897 |
|
|
`target r3900 DEV'
|
898 |
|
|
Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips.
|
899 |
|
|
|
900 |
|
|
`target array DEV'
|
901 |
|
|
Array Tech LSI33K RAID controller board.
|
902 |
|
|
|
903 |
|
|
GDB also supports these special commands for MIPS targets:
|
904 |
|
|
|
905 |
|
|
`set processor ARGS'
|
906 |
|
|
`show processor'
|
907 |
|
|
Use the `set processor' command to set the type of MIPS processor
|
908 |
|
|
when you want to access processor-type-specific registers. For
|
909 |
|
|
example, `set processor R3041' tells GDB to use the CPO registers
|
910 |
|
|
appropriate for the 3041 chip. Use the `show processor' command
|
911 |
|
|
to see what MIPS processor GDB is using. Use the `info reg'
|
912 |
|
|
command to see what registers GDB is using.
|
913 |
|
|
|
914 |
|
|
`set mipsfpu double'
|
915 |
|
|
`set mipsfpu single'
|
916 |
|
|
`set mipsfpu none'
|
917 |
|
|
`show mipsfpu'
|
918 |
|
|
If your target board does not support the MIPS floating point
|
919 |
|
|
coprocessor, you should use the command `set mipsfpu none' (if you
|
920 |
|
|
need this, you may wish to put the command in your GDB init file).
|
921 |
|
|
This tells GDB how to find the return value of functions which
|
922 |
|
|
return floating point values. It also allows GDB to avoid saving
|
923 |
|
|
the floating point registers when calling functions on the board.
|
924 |
|
|
If you are using a floating point coprocessor with only single
|
925 |
|
|
precision floating point support, as on the R4650 processor, use
|
926 |
|
|
the command `set mipsfpu single'. The default double precision
|
927 |
|
|
floating point coprocessor may be selected using `set mipsfpu
|
928 |
|
|
double'.
|
929 |
|
|
|
930 |
|
|
In previous versions the only choices were double precision or no
|
931 |
|
|
floating point, so `set mipsfpu on' will select double precision
|
932 |
|
|
and `set mipsfpu off' will select no floating point.
|
933 |
|
|
|
934 |
|
|
As usual, you can inquire about the `mipsfpu' variable with `show
|
935 |
|
|
mipsfpu'.
|
936 |
|
|
|
937 |
|
|
`set remotedebug N'
|
938 |
|
|
`show remotedebug'
|
939 |
|
|
You can see some debugging information about communications with
|
940 |
|
|
the board by setting the `remotedebug' variable. If you set it to
|
941 |
|
|
`1' using `set remotedebug 1', every packet is displayed. If you
|
942 |
|
|
set it to `2', every character is displayed. You can check the
|
943 |
|
|
current value at any time with the command `show remotedebug'.
|
944 |
|
|
|
945 |
|
|
`set timeout SECONDS'
|
946 |
|
|
`set retransmit-timeout SECONDS'
|
947 |
|
|
`show timeout'
|
948 |
|
|
`show retransmit-timeout'
|
949 |
|
|
You can control the timeout used while waiting for a packet, in
|
950 |
|
|
the MIPS remote protocol, with the `set timeout SECONDS' command.
|
951 |
|
|
The default is 5 seconds. Similarly, you can control the timeout
|
952 |
|
|
used while waiting for an acknowledgement of a packet with the `set
|
953 |
|
|
retransmit-timeout SECONDS' command. The default is 3 seconds.
|
954 |
|
|
You can inspect both values with `show timeout' and `show
|
955 |
|
|
retransmit-timeout'. (These commands are _only_ available when
|
956 |
|
|
GDB is configured for `--target=mips-idt-ecoff'.)
|
957 |
|
|
|
958 |
|
|
The timeout set by `set timeout' does not apply when GDB is
|
959 |
|
|
waiting for your program to stop. In that case, GDB waits forever
|
960 |
|
|
because it has no way of knowing how long the program is going to
|
961 |
|
|
run before stopping.
|
962 |
|
|
|
963 |
|
|
|
964 |
|
|
File: gdb.info, Node: PowerPC, Next: SH, Prev: PA, Up: Embedded Processors
|
965 |
|
|
|
966 |
|
|
PowerPC
|
967 |
|
|
-------
|
968 |
|
|
|
969 |
|
|
`target dink32 DEV'
|
970 |
|
|
DINK32 ROM monitor.
|
971 |
|
|
|
972 |
|
|
`target ppcbug DEV'
|
973 |
|
|
|
974 |
|
|
`target ppcbug1 DEV'
|
975 |
|
|
PPCBUG ROM monitor for PowerPC.
|
976 |
|
|
|
977 |
|
|
`target sds DEV'
|
978 |
|
|
SDS monitor, running on a PowerPC board (such as Motorola's ADS).
|
979 |
|
|
|
980 |
|
|
|
981 |
|
|
File: gdb.info, Node: PA, Next: PowerPC, Prev: MIPS Embedded, Up: Embedded Processors
|
982 |
|
|
|
983 |
|
|
HP PA Embedded
|
984 |
|
|
--------------
|
985 |
|
|
|
986 |
|
|
`target op50n DEV'
|
987 |
|
|
OP50N monitor, running on an OKI HPPA board.
|
988 |
|
|
|
989 |
|
|
`target w89k DEV'
|
990 |
|
|
W89K monitor, running on a Winbond HPPA board.
|
991 |
|
|
|
992 |
|
|
|
993 |
|
|
File: gdb.info, Node: SH, Next: Sparclet, Prev: PowerPC, Up: Embedded Processors
|
994 |
|
|
|
995 |
|
|
Hitachi SH
|
996 |
|
|
----------
|
997 |
|
|
|
998 |
|
|
`target hms DEV'
|
999 |
|
|
A Hitachi SH board attached via serial line to your host. Use
|
1000 |
|
|
special commands `device' and `speed' to control the serial line
|
1001 |
|
|
and the communications speed used.
|
1002 |
|
|
|
1003 |
|
|
`target e7000 DEV'
|
1004 |
|
|
E7000 emulator for Hitachi SH.
|
1005 |
|
|
|
1006 |
|
|
`target sh3 DEV'
|
1007 |
|
|
|
1008 |
|
|
`target sh3e DEV'
|
1009 |
|
|
Hitachi SH-3 and SH-3E target systems.
|
1010 |
|
|
|
1011 |
|
|
|
1012 |
|
|
File: gdb.info, Node: Sparclet, Next: Sparclite, Prev: SH, Up: Embedded Processors
|
1013 |
|
|
|
1014 |
|
|
Tsqware Sparclet
|
1015 |
|
|
----------------
|
1016 |
|
|
|
1017 |
|
|
GDB enables developers to debug tasks running on Sparclet targets
|
1018 |
|
|
from a Unix host. GDB uses code that runs on both the Unix host and on
|
1019 |
|
|
the Sparclet target. The program `gdb' is installed and executed on
|
1020 |
|
|
the Unix host.
|
1021 |
|
|
|
1022 |
|
|
`remotetimeout ARGS'
|
1023 |
|
|
GDB supports the option `remotetimeout'. This option is set by
|
1024 |
|
|
the user, and ARGS represents the number of seconds GDB waits for
|
1025 |
|
|
responses.
|
1026 |
|
|
|
1027 |
|
|
When compiling for debugging, include the options `-g' to get debug
|
1028 |
|
|
information and `-Ttext' to relocate the program to where you wish to
|
1029 |
|
|
load it on the target. You may also want to add the options `-n' or
|
1030 |
|
|
`-N' in order to reduce the size of the sections. Example:
|
1031 |
|
|
|
1032 |
|
|
sparclet-aout-gcc prog.c -Ttext 0x12010000 -g -o prog -N
|
1033 |
|
|
|
1034 |
|
|
You can use `objdump' to verify that the addresses are what you
|
1035 |
|
|
intended:
|
1036 |
|
|
|
1037 |
|
|
sparclet-aout-objdump --headers --syms prog
|
1038 |
|
|
|
1039 |
|
|
Once you have set your Unix execution search path to find GDB, you
|
1040 |
|
|
are ready to run GDB. From your Unix host, run `gdb' (or
|
1041 |
|
|
`sparclet-aout-gdb', depending on your installation).
|
1042 |
|
|
|
1043 |
|
|
GDB comes up showing the prompt:
|
1044 |
|
|
|
1045 |
|
|
(gdbslet)
|
1046 |
|
|
|
1047 |
|
|
* Menu:
|
1048 |
|
|
|
1049 |
|
|
* Sparclet File:: Setting the file to debug
|
1050 |
|
|
* Sparclet Connection:: Connecting to Sparclet
|
1051 |
|
|
* Sparclet Download:: Sparclet download
|
1052 |
|
|
* Sparclet Execution:: Running and debugging
|
1053 |
|
|
|
1054 |
|
|
|
1055 |
|
|
File: gdb.info, Node: Sparclet File, Next: Sparclet Connection, Up: Sparclet
|
1056 |
|
|
|
1057 |
|
|
Setting file to debug
|
1058 |
|
|
.....................
|
1059 |
|
|
|
1060 |
|
|
The GDB command `file' lets you choose with program to debug.
|
1061 |
|
|
|
1062 |
|
|
(gdbslet) file prog
|
1063 |
|
|
|
1064 |
|
|
GDB then attempts to read the symbol table of `prog'. GDB locates
|
1065 |
|
|
the file by searching the directories listed in the command search path.
|
1066 |
|
|
If the file was compiled with debug information (option "-g"), source
|
1067 |
|
|
files will be searched as well. GDB locates the source files by
|
1068 |
|
|
searching the directories listed in the directory search path (*note
|
1069 |
|
|
Your program's environment: Environment.). If it fails to find a file,
|
1070 |
|
|
it displays a message such as:
|
1071 |
|
|
|
1072 |
|
|
prog: No such file or directory.
|
1073 |
|
|
|
1074 |
|
|
When this happens, add the appropriate directories to the search
|
1075 |
|
|
paths with the GDB commands `path' and `dir', and execute the `target'
|
1076 |
|
|
command again.
|
1077 |
|
|
|
1078 |
|
|
|
1079 |
|
|
File: gdb.info, Node: Sparclet Connection, Next: Sparclet Download, Prev: Sparclet File, Up: Sparclet
|
1080 |
|
|
|
1081 |
|
|
Connecting to Sparclet
|
1082 |
|
|
......................
|
1083 |
|
|
|
1084 |
|
|
The GDB command `target' lets you connect to a Sparclet target. To
|
1085 |
|
|
connect to a target on serial port "`ttya'", type:
|
1086 |
|
|
|
1087 |
|
|
(gdbslet) target sparclet /dev/ttya
|
1088 |
|
|
Remote target sparclet connected to /dev/ttya
|
1089 |
|
|
main () at ../prog.c:3
|
1090 |
|
|
|
1091 |
|
|
GDB displays messages like these:
|
1092 |
|
|
|
1093 |
|
|
Connected to ttya.
|
1094 |
|
|
|
1095 |
|
|
|
1096 |
|
|
File: gdb.info, Node: Sparclet Download, Next: Sparclet Execution, Prev: Sparclet Connection, Up: Sparclet
|
1097 |
|
|
|
1098 |
|
|
Sparclet download
|
1099 |
|
|
.................
|
1100 |
|
|
|
1101 |
|
|
Once connected to the Sparclet target, you can use the GDB `load'
|
1102 |
|
|
command to download the file from the host to the target. The file
|
1103 |
|
|
name and load offset should be given as arguments to the `load' command.
|
1104 |
|
|
Since the file format is aout, the program must be loaded to the
|
1105 |
|
|
starting address. You can use `objdump' to find out what this value
|
1106 |
|
|
is. The load offset is an offset which is added to the VMA (virtual
|
1107 |
|
|
memory address) of each of the file's sections. For instance, if the
|
1108 |
|
|
program `prog' was linked to text address 0x1201000, with data at
|
1109 |
|
|
0x12010160 and bss at 0x12010170, in GDB, type:
|
1110 |
|
|
|
1111 |
|
|
(gdbslet) load prog 0x12010000
|
1112 |
|
|
Loading section .text, size 0xdb0 vma 0x12010000
|
1113 |
|
|
|
1114 |
|
|
If the code is loaded at a different address then what the program
|
1115 |
|
|
was linked to, you may need to use the `section' and `add-symbol-file'
|
1116 |
|
|
commands to tell GDB where to map the symbol table.
|
1117 |
|
|
|
1118 |
|
|
|
1119 |
|
|
File: gdb.info, Node: Sparclet Execution, Prev: Sparclet Download, Up: Sparclet
|
1120 |
|
|
|
1121 |
|
|
Running and debugging
|
1122 |
|
|
.....................
|
1123 |
|
|
|
1124 |
|
|
You can now begin debugging the task using GDB's execution control
|
1125 |
|
|
commands, `b', `step', `run', etc. See the GDB manual for the list of
|
1126 |
|
|
commands.
|
1127 |
|
|
|
1128 |
|
|
(gdbslet) b main
|
1129 |
|
|
Breakpoint 1 at 0x12010000: file prog.c, line 3.
|
1130 |
|
|
(gdbslet) run
|
1131 |
|
|
Starting program: prog
|
1132 |
|
|
Breakpoint 1, main (argc=1, argv=0xeffff21c) at prog.c:3
|
1133 |
|
|
3 char *symarg = 0;
|
1134 |
|
|
(gdbslet) step
|
1135 |
|
|
4 char *execarg = "hello!";
|
1136 |
|
|
(gdbslet)
|
1137 |
|
|
|
1138 |
|
|
|
1139 |
|
|
File: gdb.info, Node: Sparclite, Next: ST2000, Prev: Sparclet, Up: Embedded Processors
|
1140 |
|
|
|
1141 |
|
|
Fujitsu Sparclite
|
1142 |
|
|
-----------------
|
1143 |
|
|
|
1144 |
|
|
`target sparclite DEV'
|
1145 |
|
|
Fujitsu sparclite boards, used only for the purpose of loading.
|
1146 |
|
|
You must use an additional command to debug the program. For
|
1147 |
|
|
example: target remote DEV using GDB standard remote protocol.
|
1148 |
|
|
|
1149 |
|
|
|
1150 |
|
|
File: gdb.info, Node: ST2000, Next: Z8000, Prev: Sparclite, Up: Embedded Processors
|
1151 |
|
|
|
1152 |
|
|
Tandem ST2000
|
1153 |
|
|
-------------
|
1154 |
|
|
|
1155 |
|
|
GDB may be used with a Tandem ST2000 phone switch, running Tandem's
|
1156 |
|
|
STDBUG protocol.
|
1157 |
|
|
|
1158 |
|
|
To connect your ST2000 to the host system, see the manufacturer's
|
1159 |
|
|
manual. Once the ST2000 is physically attached, you can run:
|
1160 |
|
|
|
1161 |
|
|
target st2000 DEV SPEED
|
1162 |
|
|
|
1163 |
|
|
to establish it as your debugging environment. DEV is normally the
|
1164 |
|
|
name of a serial device, such as `/dev/ttya', connected to the ST2000
|
1165 |
|
|
via a serial line. You can instead specify DEV as a TCP connection
|
1166 |
|
|
(for example, to a serial line attached via a terminal concentrator)
|
1167 |
|
|
using the syntax `HOSTNAME:PORTNUMBER'.
|
1168 |
|
|
|
1169 |
|
|
The `load' and `attach' commands are _not_ defined for this target;
|
1170 |
|
|
you must load your program into the ST2000 as you normally would for
|
1171 |
|
|
standalone operation. GDB reads debugging information (such as
|
1172 |
|
|
symbols) from a separate, debugging version of the program available on
|
1173 |
|
|
your host computer.
|
1174 |
|
|
|
1175 |
|
|
These auxiliary GDB commands are available to help you with the
|
1176 |
|
|
ST2000 environment:
|
1177 |
|
|
|
1178 |
|
|
`st2000 COMMAND'
|
1179 |
|
|
Send a COMMAND to the STDBUG monitor. See the manufacturer's
|
1180 |
|
|
manual for available commands.
|
1181 |
|
|
|
1182 |
|
|
`connect'
|
1183 |
|
|
Connect the controlling terminal to the STDBUG command monitor.
|
1184 |
|
|
When you are done interacting with STDBUG, typing either of two
|
1185 |
|
|
character sequences gets you back to the GDB command prompt:
|
1186 |
|
|
`~.' (Return, followed by tilde and period) or `~'
|
1187 |
|
|
(Return, followed by tilde and control-D).
|
1188 |
|
|
|
1189 |
|
|
|
1190 |
|
|
File: gdb.info, Node: Z8000, Prev: ST2000, Up: Embedded Processors
|
1191 |
|
|
|
1192 |
|
|
Zilog Z8000
|
1193 |
|
|
-----------
|
1194 |
|
|
|
1195 |
|
|
When configured for debugging Zilog Z8000 targets, GDB includes a
|
1196 |
|
|
Z8000 simulator.
|
1197 |
|
|
|
1198 |
|
|
For the Z8000 family, `target sim' simulates either the Z8002 (the
|
1199 |
|
|
unsegmented variant of the Z8000 architecture) or the Z8001 (the
|
1200 |
|
|
segmented variant). The simulator recognizes which architecture is
|
1201 |
|
|
appropriate by inspecting the object code.
|
1202 |
|
|
|
1203 |
|
|
`target sim ARGS'
|
1204 |
|
|
Debug programs on a simulated CPU. If the simulator supports setup
|
1205 |
|
|
options, specify them via ARGS.
|
1206 |
|
|
|
1207 |
|
|
After specifying this target, you can debug programs for the simulated
|
1208 |
|
|
CPU in the same style as programs for your host computer; use the
|
1209 |
|
|
`file' command to load a new program image, the `run' command to run
|
1210 |
|
|
your program, and so on.
|
1211 |
|
|
|
1212 |
|
|
As well as making available all the usual machine registers (*note
|
1213 |
|
|
Registers: Registers.), the Z8000 simulator provides three additional
|
1214 |
|
|
items of information as specially named registers:
|
1215 |
|
|
|
1216 |
|
|
`cycles'
|
1217 |
|
|
Counts clock-ticks in the simulator.
|
1218 |
|
|
|
1219 |
|
|
`insts'
|
1220 |
|
|
Counts instructions run in the simulator.
|
1221 |
|
|
|
1222 |
|
|
`time'
|
1223 |
|
|
Execution time in 60ths of a second.
|
1224 |
|
|
|
1225 |
|
|
You can refer to these values in GDB expressions with the usual
|
1226 |
|
|
conventions; for example, `b fputc if $cycles>5000' sets a conditional
|
1227 |
|
|
breakpoint that suspends only after at least 5000 simulated clock ticks.
|
1228 |
|
|
|
1229 |
|
|
|
1230 |
|
|
File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations
|
1231 |
|
|
|
1232 |
|
|
Architectures
|
1233 |
|
|
=============
|
1234 |
|
|
|
1235 |
|
|
This section describes characteristics of architectures that affect
|
1236 |
|
|
all uses of GDB with the architecture, both native and cross.
|
1237 |
|
|
|
1238 |
|
|
* Menu:
|
1239 |
|
|
|
1240 |
|
|
* A29K::
|
1241 |
|
|
* Alpha::
|
1242 |
|
|
* MIPS::
|
1243 |
|
|
|
1244 |
|
|
|
1245 |
|
|
File: gdb.info, Node: A29K, Next: Alpha, Up: Architectures
|
1246 |
|
|
|
1247 |
|
|
A29K
|
1248 |
|
|
----
|
1249 |
|
|
|
1250 |
|
|
`set rstack_high_address ADDRESS'
|
1251 |
|
|
On AMD 29000 family processors, registers are saved in a separate
|
1252 |
|
|
"register stack". There is no way for GDB to determine the extent
|
1253 |
|
|
of this stack. Normally, GDB just assumes that the stack is
|
1254 |
|
|
"large enough". This may result in GDB referencing memory
|
1255 |
|
|
locations that do not exist. If necessary, you can get around
|
1256 |
|
|
this problem by specifying the ending address of the register
|
1257 |
|
|
stack with the `set rstack_high_address' command. The argument
|
1258 |
|
|
should be an address, which you probably want to precede with `0x'
|
1259 |
|
|
to specify in hexadecimal.
|
1260 |
|
|
|
1261 |
|
|
`show rstack_high_address'
|
1262 |
|
|
Display the current limit of the register stack, on AMD 29000
|
1263 |
|
|
family processors.
|
1264 |
|
|
|
1265 |
|
|
|
1266 |
|
|
File: gdb.info, Node: Alpha, Next: MIPS, Prev: A29K, Up: Architectures
|
1267 |
|
|
|
1268 |
|
|
Alpha
|
1269 |
|
|
-----
|
1270 |
|
|
|
1271 |
|
|
See the following section.
|
1272 |
|
|
|
1273 |
|
|
|
1274 |
|
|
File: gdb.info, Node: MIPS, Prev: Alpha, Up: Architectures
|
1275 |
|
|
|
1276 |
|
|
MIPS
|
1277 |
|
|
----
|
1278 |
|
|
|
1279 |
|
|
Alpha- and MIPS-based computers use an unusual stack frame, which
|
1280 |
|
|
sometimes requires GDB to search backward in the object code to find
|
1281 |
|
|
the beginning of a function.
|
1282 |
|
|
|
1283 |
|
|
To improve response time (especially for embedded applications, where
|
1284 |
|
|
GDB may be restricted to a slow serial line for this search) you may
|
1285 |
|
|
want to limit the size of this search, using one of these commands:
|
1286 |
|
|
|
1287 |
|
|
`set heuristic-fence-post LIMIT'
|
1288 |
|
|
Restrict GDB to examining at most LIMIT bytes in its search for
|
1289 |
|
|
the beginning of a function. A value of 0 (the default) means
|
1290 |
|
|
there is no limit. However, except for 0, the larger the limit
|
1291 |
|
|
the more bytes `heuristic-fence-post' must search and therefore
|
1292 |
|
|
the longer it takes to run.
|
1293 |
|
|
|
1294 |
|
|
`show heuristic-fence-post'
|
1295 |
|
|
Display the current limit.
|
1296 |
|
|
|
1297 |
|
|
These commands are available _only_ when GDB is configured for
|
1298 |
|
|
debugging programs on Alpha or MIPS processors.
|
1299 |
|
|
|
1300 |
|
|
|
1301 |
|
|
File: gdb.info, Node: Controlling GDB, Next: Sequences, Prev: Configurations, Up: Top
|
1302 |
|
|
|
1303 |
|
|
Controlling GDB
|
1304 |
|
|
***************
|
1305 |
|
|
|
1306 |
|
|
You can alter the way GDB interacts with you by using the `set'
|
1307 |
|
|
command. For commands controlling how GDB displays data, see *Note
|
1308 |
|
|
Print settings: Print Settings. Other settings are described here.
|
1309 |
|
|
|
1310 |
|
|
* Menu:
|
1311 |
|
|
|
1312 |
|
|
* Prompt:: Prompt
|
1313 |
|
|
* Editing:: Command editing
|
1314 |
|
|
* History:: Command history
|
1315 |
|
|
* Screen Size:: Screen size
|
1316 |
|
|
* Numbers:: Numbers
|
1317 |
|
|
* Messages/Warnings:: Optional warnings and messages
|
1318 |
|
|
* Debugging Output:: Optional messages about internal happenings
|
1319 |
|
|
|
1320 |
|
|
|
1321 |
|
|
File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
|
1322 |
|
|
|
1323 |
|
|
Prompt
|
1324 |
|
|
======
|
1325 |
|
|
|
1326 |
|
|
GDB indicates its readiness to read a command by printing a string
|
1327 |
|
|
called the "prompt". This string is normally `(gdb)'. You can change
|
1328 |
|
|
the prompt string with the `set prompt' command. For instance, when
|
1329 |
|
|
debugging GDB with GDB, it is useful to change the prompt in one of the
|
1330 |
|
|
GDB sessions so that you can always tell which one you are talking to.
|
1331 |
|
|
|
1332 |
|
|
_Note:_ `set prompt' does not add a space for you after the prompt
|
1333 |
|
|
you set. This allows you to set a prompt which ends in a space or a
|
1334 |
|
|
prompt that does not.
|
1335 |
|
|
|
1336 |
|
|
`set prompt NEWPROMPT'
|
1337 |
|
|
Directs GDB to use NEWPROMPT as its prompt string henceforth.
|
1338 |
|
|
|
1339 |
|
|
`show prompt'
|
1340 |
|
|
Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
|
1341 |
|
|
|
1342 |
|
|
|
1343 |
|
|
File: gdb.info, Node: Editing, Next: History, Prev: Prompt, Up: Controlling GDB
|
1344 |
|
|
|
1345 |
|
|
Command editing
|
1346 |
|
|
===============
|
1347 |
|
|
|
1348 |
|
|
GDB reads its input commands via the "readline" interface. This GNU
|
1349 |
|
|
library provides consistent behavior for programs which provide a
|
1350 |
|
|
command line interface to the user. Advantages are GNU Emacs-style or
|
1351 |
|
|
"vi"-style inline editing of commands, `csh'-like history substitution,
|
1352 |
|
|
and a storage and recall of command history across debugging sessions.
|
1353 |
|
|
|
1354 |
|
|
You may control the behavior of command line editing in GDB with the
|
1355 |
|
|
command `set'.
|
1356 |
|
|
|
1357 |
|
|
`set editing'
|
1358 |
|
|
`set editing on'
|
1359 |
|
|
Enable command line editing (enabled by default).
|
1360 |
|
|
|
1361 |
|
|
`set editing off'
|
1362 |
|
|
Disable command line editing.
|
1363 |
|
|
|
1364 |
|
|
`show editing'
|
1365 |
|
|
Show whether command line editing is enabled.
|
1366 |
|
|
|
1367 |
|
|
|
1368 |
|
|
File: gdb.info, Node: History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
|
1369 |
|
|
|
1370 |
|
|
Command history
|
1371 |
|
|
===============
|
1372 |
|
|
|
1373 |
|
|
GDB can keep track of the commands you type during your debugging
|
1374 |
|
|
sessions, so that you can be certain of precisely what happened. Use
|
1375 |
|
|
these commands to manage the GDB command history facility.
|
1376 |
|
|
|
1377 |
|
|
`set history filename FNAME'
|
1378 |
|
|
Set the name of the GDB command history file to FNAME. This is
|
1379 |
|
|
the file where GDB reads an initial command history list, and
|
1380 |
|
|
where it writes the command history from this session when it
|
1381 |
|
|
exits. You can access this list through history expansion or
|
1382 |
|
|
through the history command editing characters listed below. This
|
1383 |
|
|
file defaults to the value of the environment variable
|
1384 |
|
|
`GDBHISTFILE', or to `./.gdb_history' (`./_gdb_history' on MS-DOS)
|
1385 |
|
|
if this variable is not set.
|
1386 |
|
|
|
1387 |
|
|
`set history save'
|
1388 |
|
|
`set history save on'
|
1389 |
|
|
Record command history in a file, whose name may be specified with
|
1390 |
|
|
the `set history filename' command. By default, this option is
|
1391 |
|
|
disabled.
|
1392 |
|
|
|
1393 |
|
|
`set history save off'
|
1394 |
|
|
Stop recording command history in a file.
|
1395 |
|
|
|
1396 |
|
|
`set history size SIZE'
|
1397 |
|
|
Set the number of commands which GDB keeps in its history list.
|
1398 |
|
|
This defaults to the value of the environment variable `HISTSIZE',
|
1399 |
|
|
or to 256 if this variable is not set.
|
1400 |
|
|
|
1401 |
|
|
History expansion assigns special meaning to the character `!'.
|
1402 |
|
|
|
1403 |
|
|
Since `!' is also the logical not operator in C, history expansion
|
1404 |
|
|
is off by default. If you decide to enable history expansion with the
|
1405 |
|
|
`set history expansion on' command, you may sometimes need to follow
|
1406 |
|
|
`!' (when it is used as logical not, in an expression) with a space or
|
1407 |
|
|
a tab to prevent it from being expanded. The readline history
|
1408 |
|
|
facilities do not attempt substitution on the strings `!=' and `!(',
|
1409 |
|
|
even when history expansion is enabled.
|
1410 |
|
|
|
1411 |
|
|
The commands to control history expansion are:
|
1412 |
|
|
|
1413 |
|
|
`set history expansion on'
|
1414 |
|
|
`set history expansion'
|
1415 |
|
|
Enable history expansion. History expansion is off by default.
|
1416 |
|
|
|
1417 |
|
|
`set history expansion off'
|
1418 |
|
|
Disable history expansion.
|
1419 |
|
|
|
1420 |
|
|
The readline code comes with more complete documentation of
|
1421 |
|
|
editing and history expansion features. Users unfamiliar with GNU
|
1422 |
|
|
Emacs or `vi' may wish to read it.
|
1423 |
|
|
|
1424 |
|
|
`show history'
|
1425 |
|
|
`show history filename'
|
1426 |
|
|
`show history save'
|
1427 |
|
|
`show history size'
|
1428 |
|
|
`show history expansion'
|
1429 |
|
|
These commands display the state of the GDB history parameters.
|
1430 |
|
|
`show history' by itself displays all four states.
|
1431 |
|
|
|
1432 |
|
|
`show commands'
|
1433 |
|
|
Display the last ten commands in the command history.
|
1434 |
|
|
|
1435 |
|
|
`show commands N'
|
1436 |
|
|
Print ten commands centered on command number N.
|
1437 |
|
|
|
1438 |
|
|
`show commands +'
|
1439 |
|
|
Print ten commands just after the commands last printed.
|
1440 |
|
|
|