OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [doc/] [gdb.info-8] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
This is gdb.info, produced by makeinfo version 4.1 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 Ninth Edition, December 2001, of `Debugging with GDB:
11
the GNU Source-Level Debugger' for GDB Version 5.3.
12
 
13
   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
14
1998,
15
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
16
 
17
   Permission is granted to copy, distribute and/or modify this document
18
under the terms of the GNU Free Documentation License, Version 1.1 or
19
any later version published by the Free Software Foundation; with the
20
Invariant Sections being "Free Software" and "Free Software Needs Free
21
Documentation", with the Front-Cover Texts being "A GNU Manual," and
22
with the Back-Cover Texts as in (a) below.
23
 
24
   (a) The Free Software Foundation's Back-Cover Text is: "You have
25
freedom to copy and modify this GNU Manual, like GNU software.  Copies
26
published by the Free Software Foundation raise funds for GNU
27
development."
28
 
29

30
File: gdb.info,  Node: Stub Contents,  Next: Bootstrapping,  Up: remote stub
31
 
32
What the stub can do for you
33
----------------------------
34
 
35
   The debugging stub for your architecture supplies these three
36
subroutines:
37
 
38
`set_debug_traps'
39
     This routine arranges for `handle_exception' to run when your
40
     program stops.  You must call this subroutine explicitly near the
41
     beginning of your program.
42
 
43
`handle_exception'
44
     This is the central workhorse, but your program never calls it
45
     explicitly--the setup code arranges for `handle_exception' to run
46
     when a trap is triggered.
47
 
48
     `handle_exception' takes control when your program stops during
49
     execution (for example, on a breakpoint), and mediates
50
     communications with GDB on the host machine.  This is where the
51
     communications protocol is implemented; `handle_exception' acts as
52
     the GDB representative on the target machine.  It begins by
53
     sending summary information on the state of your program, then
54
     continues to execute, retrieving and transmitting any information
55
     GDB needs, until you execute a GDB command that makes your program
56
     resume; at that point, `handle_exception' returns control to your
57
     own code on the target machine.
58
 
59
`breakpoint'
60
     Use this auxiliary subroutine to make your program contain a
61
     breakpoint.  Depending on the particular situation, this may be
62
     the only way for GDB to get control.  For instance, if your target
63
     machine has some sort of interrupt button, you won't need to call
64
     this; pressing the interrupt button transfers control to
65
     `handle_exception'--in effect, to GDB.  On some machines, simply
66
     receiving characters on the serial port may also trigger a trap;
67
     again, in that situation, you don't need to call `breakpoint' from
68
     your own program--simply running `target remote' from the host GDB
69
     session gets control.
70
 
71
     Call `breakpoint' if none of these is true, or if you simply want
72
     to make certain your program stops at a predetermined point for the
73
     start of your debugging session.
74
 
75

76
File: gdb.info,  Node: Bootstrapping,  Next: Debug Session,  Prev: Stub Contents,  Up: remote stub
77
 
78
What you must do for the stub
79
-----------------------------
80
 
81
   The debugging stubs that come with GDB are set up for a particular
82
chip architecture, but they have no information about the rest of your
83
debugging target machine.
84
 
85
   First of all you need to tell the stub how to communicate with the
86
serial port.
87
 
88
`int getDebugChar()'
89
     Write this subroutine to read a single character from the serial
90
     port.  It may be identical to `getchar' for your target system; a
91
     different name is used to allow you to distinguish the two if you
92
     wish.
93
 
94
`void putDebugChar(int)'
95
     Write this subroutine to write a single character to the serial
96
     port.  It may be identical to `putchar' for your target system; a
97
     different name is used to allow you to distinguish the two if you
98
     wish.
99
 
100
   If you want GDB to be able to stop your program while it is running,
101
you need to use an interrupt-driven serial driver, and arrange for it
102
to stop when it receives a `^C' (`\003', the control-C character).
103
That is the character which GDB uses to tell the remote system to stop.
104
 
105
   Getting the debugging target to return the proper status to GDB
106
probably requires changes to the standard stub; one quick and dirty way
107
is to just execute a breakpoint instruction (the "dirty" part is that
108
GDB reports a `SIGTRAP' instead of a `SIGINT').
109
 
110
   Other routines you need to supply are:
111
 
112
`void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
113
     Write this function to install EXCEPTION_ADDRESS in the exception
114
     handling tables.  You need to do this because the stub does not
115
     have any way of knowing what the exception handling tables on your
116
     target system are like (for example, the processor's table might
117
     be in ROM, containing entries which point to a table in RAM).
118
     EXCEPTION_NUMBER is the exception number which should be changed;
119
     its meaning is architecture-dependent (for example, different
120
     numbers might represent divide by zero, misaligned access, etc).
121
     When this exception occurs, control should be transferred directly
122
     to EXCEPTION_ADDRESS, and the processor state (stack, registers,
123
     and so on) should be just as it is when a processor exception
124
     occurs.  So if you want to use a jump instruction to reach
125
     EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
126
     subroutine.
127
 
128
     For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
129
     gate so that interrupts are masked while the handler runs.  The
130
     gate should be at privilege level 0 (the most privileged level).
131
     The SPARC and 68k stubs are able to mask interrupts themselves
132
     without help from `exceptionHandler'.
133
 
134
`void flush_i_cache()'
135
     On SPARC and SPARCLITE only, write this subroutine to flush the
136
     instruction cache, if any, on your target machine.  If there is no
137
     instruction cache, this subroutine may be a no-op.
138
 
139
     On target machines that have instruction caches, GDB requires this
140
     function to make certain that the state of your program is stable.
141
 
142
You must also make sure this library routine is available:
143
 
144
`void *memset(void *, int, int)'
145
     This is the standard library function `memset' that sets an area of
146
     memory to a known value.  If you have one of the free versions of
147
     `libc.a', `memset' can be found there; otherwise, you must either
148
     obtain it from your hardware manufacturer, or write your own.
149
 
150
   If you do not use the GNU C compiler, you may need other standard
151
library subroutines as well; this varies from one stub to another, but
152
in general the stubs are likely to use any of the common library
153
subroutines which `gcc' generates as inline code.
154
 
155

156
File: gdb.info,  Node: Debug Session,  Prev: Bootstrapping,  Up: remote stub
157
 
158
Putting it all together
159
-----------------------
160
 
161
   In summary, when your program is ready to debug, you must follow
162
these steps.
163
 
164
  1. Make sure you have defined the supporting low-level routines
165
     (*note What you must do for the stub: Bootstrapping.):
166
          `getDebugChar', `putDebugChar',
167
          `flush_i_cache', `memset', `exceptionHandler'.
168
 
169
  2. Insert these lines near the top of your program:
170
 
171
          set_debug_traps();
172
          breakpoint();
173
 
174
  3. For the 680x0 stub only, you need to provide a variable called
175
     `exceptionHook'.  Normally you just use:
176
 
177
          void (*exceptionHook)() = 0;
178
 
179
     but if before calling `set_debug_traps', you set it to point to a
180
     function in your program, that function is called when `GDB'
181
     continues after stopping on a trap (for example, bus error).  The
182
     function indicated by `exceptionHook' is called with one
183
     parameter: an `int' which is the exception number.
184
 
185
  4. Compile and link together: your program, the GDB debugging stub for
186
     your target architecture, and the supporting subroutines.
187
 
188
  5. Make sure you have a serial connection between your target machine
189
     and the GDB host, and identify the serial port on the host.
190
 
191
  6. Download your program to your target machine (or get it there by
192
     whatever means the manufacturer provides), and start it.
193
 
194
  7. To start remote debugging, run GDB on the host machine, and specify
195
     as an executable file the program that is running in the remote
196
     machine.  This tells GDB how to find your program's symbols and
197
     the contents of its pure text.
198
 
199
  8. Establish communication using the `target remote' command.  Its
200
     argument specifies how to communicate with the target
201
     machine--either via a devicename attached to a direct serial line,
202
     or a TCP or UDP port (usually to a terminal server which in turn
203
     has a serial line to the target).  For example, to use a serial
204
     line connected to the device named `/dev/ttyb':
205
 
206
          target remote /dev/ttyb
207
 
208
     To use a TCP connection, use an argument of the form `HOST:PORT'
209
     or `tcp:HOST:PORT'.  For example, to connect to port 2828 on a
210
     terminal server named `manyfarms':
211
 
212
          target remote manyfarms:2828
213
 
214
     If your remote target is actually running on the same machine as
215
     your debugger session (e.g. a simulator of your target running on
216
     the same host), you can omit the hostname.  For example, to connect
217
     to port 1234 on your local machine:
218
 
219
          target remote :1234
220
 
221
     Note that the colon is still required here.
222
 
223
     To use a UDP connection, use an argument of the form
224
     `udp:HOST:PORT'.  For example, to connect to UDP port 2828 on a
225
     terminal server named `manyfarms':
226
 
227
          target remote udp:manyfarms:2828
228
 
229
     When using a UDP connection for remote debugging, you should keep
230
     in mind that the `U' stands for "Unreliable".  UDP can silently
231
     drop packets on busy or unreliable networks, which will cause
232
     havoc with your debugging session.
233
 
234
 
235
   Now you can use all the usual commands to examine and change data
236
and to step and continue the remote program.
237
 
238
   To resume the remote program and stop debugging it, use the `detach'
239
command.
240
 
241
   Whenever GDB is waiting for the remote program, if you type the
242
interrupt character (often ), GDB attempts to stop the program.
243
This may or may not succeed, depending in part on the hardware and the
244
serial drivers the remote system uses.  If you type the interrupt
245
character once again, GDB displays this prompt:
246
 
247
     Interrupted while waiting for the program.
248
     Give up (and stop debugging it)?  (y or n)
249
 
250
   If you type `y', GDB abandons the remote debugging session.  (If you
251
decide you want to try again later, you can use `target remote' again
252
to connect once more.)  If you type `n', GDB goes back to waiting.
253
 
254

255
File: gdb.info,  Node: Configurations,  Next: Controlling GDB,  Prev: Remote Debugging,  Up: Top
256
 
257
Configuration-Specific Information
258
**********************************
259
 
260
   While nearly all GDB commands are available for all native and cross
261
versions of the debugger, there are some exceptions.  This chapter
262
describes things that are only available in certain configurations.
263
 
264
   There are three major categories of configurations: native
265
configurations, where the host and target are the same, embedded
266
operating system configurations, which are usually the same for several
267
different processor architectures, and bare embedded processors, which
268
are quite different from each other.
269
 
270
* Menu:
271
 
272
* Native::
273
* Embedded OS::
274
* Embedded Processors::
275
* Architectures::
276
 
277

278
File: gdb.info,  Node: Native,  Next: Embedded OS,  Up: Configurations
279
 
280
Native
281
======
282
 
283
   This section describes details specific to particular native
284
configurations.
285
 
286
* Menu:
287
 
288
* HP-UX::                       HP-UX
289
* SVR4 Process Information::    SVR4 process information
290
* DJGPP Native::                Features specific to the DJGPP port
291
* Cygwin Native::               Features specific to the Cygwin port
292
 
293

294
File: gdb.info,  Node: HP-UX,  Next: SVR4 Process Information,  Up: Native
295
 
296
HP-UX
297
-----
298
 
299
   On HP-UX systems, if you refer to a function or variable name that
300
begins with a dollar sign, GDB searches for a user or system name
301
first, before it searches for a convenience variable.
302
 
303

304
File: gdb.info,  Node: SVR4 Process Information,  Next: DJGPP Native,  Prev: HP-UX,  Up: Native
305
 
306
SVR4 process information
307
------------------------
308
 
309
   Many versions of SVR4 provide a facility called `/proc' that can be
310
used to examine the image of a running process using file-system
311
subroutines.  If GDB is configured for an operating system with this
312
facility, the command `info proc' is available to report on several
313
kinds of information about the process running your program.  `info
314
proc' works only on SVR4 systems that include the `procfs' code.  This
315
includes OSF/1 (Digital Unix), Solaris, Irix, and Unixware, but not
316
HP-UX or GNU/Linux, for example.
317
 
318
`info proc'
319
     Summarize available information about the process.
320
 
321
`info proc mappings'
322
     Report on the address ranges accessible in the program, with
323
     information on whether your program may read, write, or execute
324
     each range.
325
 
326

327
File: gdb.info,  Node: DJGPP Native,  Next: Cygwin Native,  Prev: SVR4 Process Information,  Up: Native
328
 
329
Features for Debugging DJGPP Programs
330
-------------------------------------
331
 
332
   DJGPP is the port of GNU development tools to MS-DOS and MS-Windows.
333
DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
334
(DOS Protected-Mode Interface) API to run on top of real-mode DOS
335
systems and their emulations.
336
 
337
   GDB supports native debugging of DJGPP programs, and defines a few
338
commands specific to the DJGPP port.  This subsection describes those
339
commands.
340
 
341
`info dos'
342
     This is a prefix of DJGPP-specific commands which print
343
     information about the target system and important OS structures.
344
 
345
`info dos sysinfo'
346
     This command displays assorted information about the underlying
347
     platform: the CPU type and features, the OS version and flavor, the
348
     DPMI version, and the available conventional and DPMI memory.
349
 
350
`info dos gdt'
351
`info dos ldt'
352
`info dos idt'
353
     These 3 commands display entries from, respectively, Global, Local,
354
     and Interrupt Descriptor Tables (GDT, LDT, and IDT).  The
355
     descriptor tables are data structures which store a descriptor for
356
     each segment that is currently in use.  The segment's selector is
357
     an index into a descriptor table; the table entry for that index
358
     holds the descriptor's base address and limit, and its attributes
359
     and access rights.
360
 
361
     A typical DJGPP program uses 3 segments: a code segment, a data
362
     segment (used for both data and the stack), and a DOS segment
363
     (which allows access to DOS/BIOS data structures and absolute
364
     addresses in conventional memory).  However, the DPMI host will
365
     usually define additional segments in order to support the DPMI
366
     environment.
367
 
368
     These commands allow to display entries from the descriptor tables.
369
     Without an argument, all entries from the specified table are
370
     displayed.  An argument, which should be an integer expression,
371
     means display a single entry whose index is given by the argument.
372
     For example, here's a convenient way to display information about
373
     the debugged program's data segment:
374
 
375
     `(gdb) info dos ldt $ds'
376
     `0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)'
377
 
378
     This comes in handy when you want to see whether a pointer is
379
     outside the data segment's limit (i.e. "garbled").
380
 
381
`info dos pde'
382
`info dos pte'
383
     These two commands display entries from, respectively, the Page
384
     Directory and the Page Tables.  Page Directories and Page Tables
385
     are data structures which control how virtual memory addresses are
386
     mapped into physical addresses.  A Page Table includes an entry
387
     for every page of memory that is mapped into the program's address
388
     space; there may be several Page Tables, each one holding up to
389
     4096 entries.  A Page Directory has up to 4096 entries, one each
390
     for every Page Table that is currently in use.
391
 
392
     Without an argument, `info dos pde' displays the entire Page
393
     Directory, and `info dos pte' displays all the entries in all of
394
     the Page Tables.  An argument, an integer expression, given to the
395
     `info dos pde' command means display only that entry from the Page
396
     Directory table.  An argument given to the `info dos pte' command
397
     means display entries from a single Page Table, the one pointed to
398
     by the specified entry in the Page Directory.
399
 
400
     These commands are useful when your program uses "DMA" (Direct
401
     Memory Access), which needs physical addresses to program the DMA
402
     controller.
403
 
404
     These commands are supported only with some DPMI servers.
405
 
406
`info dos address-pte ADDR'
407
     This command displays the Page Table entry for a specified linear
408
     address.  The argument linear address ADDR should already have the
409
     appropriate segment's base address added to it, because this
410
     command accepts addresses which may belong to _any_ segment.  For
411
     example, here's how to display the Page Table entry for the page
412
     where the variable `i' is stored:
413
 
414
     `(gdb) info dos address-pte __djgpp_base_address + (char *)&i'
415
     `Page Table entry for address 0x11a00d30:'
416
     `Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30'
417
 
418
     This says that `i' is stored at offset `0xd30' from the page whose
419
     physical base address is `0x02698000', and prints all the
420
     attributes of that page.
421
 
422
     Note that you must cast the addresses of variables to a `char *',
423
     since otherwise the value of `__djgpp_base_address', the base
424
     address of all variables and functions in a DJGPP program, will be
425
     added using the rules of C pointer arithmetics: if `i' is declared
426
     an `int', GDB will add 4 times the value of `__djgpp_base_address'
427
     to the address of `i'.
428
 
429
     Here's another example, it displays the Page Table entry for the
430
     transfer buffer:
431
 
432
     `(gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)'
433
     `Page Table entry for address 0x29110:'
434
     `Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110'
435
 
436
     (The `+ 3' offset is because the transfer buffer's address is the
437
     3rd member of the `_go32_info_block' structure.)  The output of
438
     this command clearly shows that addresses in conventional memory
439
     are mapped 1:1, i.e. the physical and linear addresses are
440
     identical.
441
 
442
     This command is supported only with some DPMI servers.
443
 
444

445
File: gdb.info,  Node: Cygwin Native,  Prev: DJGPP Native,  Up: Native
446
 
447
Features for Debugging MS Windows PE executables
448
------------------------------------------------
449
 
450
   GDB supports native debugging of MS Windows programs, and defines a
451
few commands specific to the Cygwin port.  This subsection describes
452
those commands.
453
 
454
`info w32'
455
     This is a prefix of MS Windows specific commands which print
456
     information about the target system and important OS structures.
457
 
458
`info w32 selector'
459
     This command displays information returned by the Win32 API
460
     `GetThreadSelectorEntry' function.  It takes an optional argument
461
     that is evaluated to a long value to give the information about
462
     this given selector.  Without argument, this command displays
463
     information about the the six segment registers.
464
 
465
`info dll'
466
     This is a Cygwin specific alias of info shared.
467
 
468
`dll-symbols'
469
     This command loads symbols from a dll similarly to add-sym command
470
     but without the need to specify a base address.
471
 
472
`set new-console MODE'
473
     If MODE is `on' the debuggee will be started in a new console on
474
     next start.  If MODE is `off'i, the debuggee will be started in
475
     the same console as the debugger.
476
 
477
`show new-console'
478
     Displays whether a new console is used when the debuggee is
479
     started.
480
 
481
`set new-group MODE'
482
     This boolean value controls whether the debuggee should start a
483
     new group or stay in the same group as the debugger.  This affects
484
     the way the Windows OS handles Ctrl-C.
485
 
486
`show new-group'
487
     Displays current value of new-group boolean.
488
 
489
`set debugevents'
490
     This boolean value adds debug output concerning events seen by the
491
     debugger.
492
 
493
`set debugexec'
494
     This boolean value adds debug output concerning execute events
495
     seen by the debugger.
496
 
497
`set debugexceptions'
498
     This boolean value adds debug ouptut concerning exception events
499
     seen by the debugger.
500
 
501
`set debugmemory'
502
     This boolean value adds debug ouptut concerning memory events seen
503
     by the debugger.
504
 
505
`set shell'
506
     This boolean values specifies whether the debuggee is called via a
507
     shell or directly (default value is on).
508
 
509
`show shell'
510
     Displays if the debuggee will be started with a shell.
511
 
512

513
File: gdb.info,  Node: Embedded OS,  Next: Embedded Processors,  Prev: Native,  Up: Configurations
514
 
515
Embedded Operating Systems
516
==========================
517
 
518
   This section describes configurations involving the debugging of
519
embedded operating systems that are available for several different
520
architectures.
521
 
522
* Menu:
523
 
524
* VxWorks::                     Using GDB with VxWorks
525
 
526
   GDB includes the ability to debug programs running on various
527
real-time operating systems.
528
 
529

530
File: gdb.info,  Node: VxWorks,  Up: Embedded OS
531
 
532
Using GDB with VxWorks
533
----------------------
534
 
535
`target vxworks MACHINENAME'
536
     A VxWorks system, attached via TCP/IP.  The argument MACHINENAME
537
     is the target system's machine name or IP address.
538
 
539
   On VxWorks, `load' links FILENAME dynamically on the current target
540
system as well as adding its symbols in GDB.
541
 
542
   GDB enables developers to spawn and debug tasks running on networked
543
VxWorks targets from a Unix host.  Already-running tasks spawned from
544
the VxWorks shell can also be debugged.  GDB uses code that runs on
545
both the Unix host and on the VxWorks target.  The program `gdb' is
546
installed and executed on the Unix host.  (It may be installed with the
547
name `vxgdb', to distinguish it from a GDB for debugging programs on
548
the host itself.)
549
 
550
`VxWorks-timeout ARGS'
551
     All VxWorks-based targets now support the option `vxworks-timeout'.
552
     This option is set by the user, and  ARGS represents the number of
553
     seconds GDB waits for responses to rpc's.  You might use this if
554
     your VxWorks target is a slow software simulator or is on the far
555
     side of a thin network line.
556
 
557
   The following information on connecting to VxWorks was current when
558
this manual was produced; newer releases of VxWorks may use revised
559
procedures.
560
 
561
   To use GDB with VxWorks, you must rebuild your VxWorks kernel to
562
include the remote debugging interface routines in the VxWorks library
563
`rdb.a'.  To do this, define `INCLUDE_RDB' in the VxWorks configuration
564
file `configAll.h' and rebuild your VxWorks kernel.  The resulting
565
kernel contains `rdb.a', and spawns the source debugging task
566
`tRdbTask' when VxWorks is booted.  For more information on configuring
567
and remaking VxWorks, see the manufacturer's manual.
568
 
569
   Once you have included `rdb.a' in your VxWorks system image and set
570
your Unix execution search path to find GDB, you are ready to run GDB.
571
From your Unix host, run `gdb' (or `vxgdb', depending on your
572
installation).
573
 
574
   GDB comes up showing the prompt:
575
 
576
     (vxgdb)
577
 
578
* Menu:
579
 
580
* VxWorks Connection::          Connecting to VxWorks
581
* VxWorks Download::            VxWorks download
582
* VxWorks Attach::              Running tasks
583
 
584

585
File: gdb.info,  Node: VxWorks Connection,  Next: VxWorks Download,  Up: VxWorks
586
 
587
Connecting to VxWorks
588
.....................
589
 
590
   The GDB command `target' lets you connect to a VxWorks target on the
591
network.  To connect to a target whose host name is "`tt'", type:
592
 
593
     (vxgdb) target vxworks tt
594
 
595
   GDB displays messages like these:
596
 
597
     Attaching remote machine across net...
598
     Connected to tt.
599
 
600
   GDB then attempts to read the symbol tables of any object modules
601
loaded into the VxWorks target since it was last booted.  GDB locates
602
these files by searching the directories listed in the command search
603
path (*note Your program's environment: Environment.); if it fails to
604
find an object file, it displays a message such as:
605
 
606
     prog.o: No such file or directory.
607
 
608
   When this happens, add the appropriate directory to the search path
609
with the GDB command `path', and execute the `target' command again.
610
 
611

612
File: gdb.info,  Node: VxWorks Download,  Next: VxWorks Attach,  Prev: VxWorks Connection,  Up: VxWorks
613
 
614
VxWorks download
615
................
616
 
617
   If you have connected to the VxWorks target and you want to debug an
618
object that has not yet been loaded, you can use the GDB `load' command
619
to download a file from Unix to VxWorks incrementally.  The object file
620
given as an argument to the `load' command is actually opened twice:
621
first by the VxWorks target in order to download the code, then by GDB
622
in order to read the symbol table.  This can lead to problems if the
623
current working directories on the two systems differ.  If both systems
624
have NFS mounted the same filesystems, you can avoid these problems by
625
using absolute paths.  Otherwise, it is simplest to set the working
626
directory on both systems to the directory in which the object file
627
resides, and then to reference the file by its name, without any path.
628
For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
629
VxWorks and in `HOSTPATH/vw/demo/rdb' on the host.  To load this
630
program, type this on VxWorks:
631
 
632
     -> cd "VXPATH/vw/demo/rdb"
633
 
634
Then, in GDB, type:
635
 
636
     (vxgdb) cd HOSTPATH/vw/demo/rdb
637
     (vxgdb) load prog.o
638
 
639
   GDB displays a response similar to this:
640
 
641
     Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
642
 
643
   You can also use the `load' command to reload an object module after
644
editing and recompiling the corresponding source file.  Note that this
645
makes GDB delete all currently-defined breakpoints, auto-displays, and
646
convenience variables, and to clear the value history.  (This is
647
necessary in order to preserve the integrity of debugger's data
648
structures that reference the target system's symbol table.)
649
 
650

651
File: gdb.info,  Node: VxWorks Attach,  Prev: VxWorks Download,  Up: VxWorks
652
 
653
Running tasks
654
.............
655
 
656
   You can also attach to an existing task using the `attach' command as
657
follows:
658
 
659
     (vxgdb) attach TASK
660
 
661
where TASK is the VxWorks hexadecimal task ID.  The task can be running
662
or suspended when you attach to it.  Running tasks are suspended at the
663
time of attachment.
664
 
665

666
File: gdb.info,  Node: Embedded Processors,  Next: Architectures,  Prev: Embedded OS,  Up: Configurations
667
 
668
Embedded Processors
669
===================
670
 
671
   This section goes into details specific to particular embedded
672
configurations.
673
 
674
* Menu:
675
 
676
* ARM::                         ARM
677
* H8/300::                      Hitachi H8/300
678
* H8/500::                      Hitachi H8/500
679
* i960::                        Intel i960
680
* M32R/D::                      Mitsubishi M32R/D
681
* M68K::                        Motorola M68K
682
* MIPS Embedded::               MIPS Embedded
683
* PA::                          HP PA Embedded
684
* PowerPC:                      PowerPC
685
* SH::                          Hitachi SH
686
* Sparclet::                    Tsqware Sparclet
687
* Sparclite::                   Fujitsu Sparclite
688
* ST2000::                      Tandem ST2000
689
* Z8000::                       Zilog Z8000
690
 
691

692
File: gdb.info,  Node: ARM,  Next: H8/300,  Up: Embedded Processors
693
 
694
ARM
695
---
696
 
697
`target rdi DEV'
698
     ARM Angel monitor, via RDI library interface to ADP protocol.  You
699
     may use this target to communicate with both boards running the
700
     Angel monitor, or with the EmbeddedICE JTAG debug device.
701
 
702
`target rdp DEV'
703
     ARM Demon monitor.
704
 
705

706
File: gdb.info,  Node: H8/300,  Next: H8/500,  Prev: ARM,  Up: Embedded Processors
707
 
708
Hitachi H8/300
709
--------------
710
 
711
`target hms DEV'
712
     A Hitachi SH, H8/300, or H8/500 board, attached via serial line to
713
     your host.  Use special commands `device' and `speed' to control
714
     the serial line and the communications speed used.
715
 
716
`target e7000 DEV'
717
     E7000 emulator for Hitachi H8 and SH.
718
 
719
`target sh3 DEV'
720
`target sh3e DEV'
721
     Hitachi SH-3 and SH-3E target systems.
722
 
723
   When you select remote debugging to a Hitachi SH, H8/300, or H8/500
724
board, the `load' command downloads your program to the Hitachi board
725
and also opens it as the current executable target for GDB on your host
726
(like the `file' command).
727
 
728
   GDB needs to know these things to talk to your Hitachi SH, H8/300,
729
or H8/500:
730
 
731
  1. that you want to use `target hms', the remote debugging interface
732
     for Hitachi microprocessors, or `target e7000', the in-circuit
733
     emulator for the Hitachi SH and the Hitachi 300H.  (`target hms' is
734
     the default when GDB is configured specifically for the Hitachi SH,
735
     H8/300, or H8/500.)
736
 
737
  2. what serial device connects your host to your Hitachi board (the
738
     first serial device available on your host is the default).
739
 
740
  3. what speed to use over the serial device.
741
 
742
* Menu:
743
 
744
* Hitachi Boards::      Connecting to Hitachi boards.
745
* Hitachi ICE::         Using the E7000 In-Circuit Emulator.
746
* Hitachi Special::     Special GDB commands for Hitachi micros.
747
 
748

749
File: gdb.info,  Node: Hitachi Boards,  Next: Hitachi ICE,  Up: H8/300
750
 
751
Connecting to Hitachi boards
752
............................
753
 
754
   Use the special `GDB' command `device PORT' if you need to
755
explicitly set the serial device.  The default PORT is the first
756
available port on your host.  This is only necessary on Unix hosts,
757
where it is typically something like `/dev/ttya'.
758
 
759
   `GDB' has another special command to set the communications speed:
760
`speed BPS'.  This command also is only used from Unix hosts; on DOS
761
hosts, set the line speed as usual from outside GDB with the DOS `mode'
762
command (for instance, `mode com2:9600,n,8,1,p' for a 9600bps
763
connection).
764
 
765
   The `device' and `speed' commands are available only when you use a
766
Unix host to debug your Hitachi microprocessor programs.  If you use a
767
DOS host, GDB depends on an auxiliary terminate-and-stay-resident
768
program called `asynctsr' to communicate with the development board
769
through a PC serial port.  You must also use the DOS `mode' command to
770
set up the serial port on the DOS side.
771
 
772
   The following sample session illustrates the steps needed to start a
773
program under GDB control on an H8/300.  The example uses a sample
774
H8/300 program called `t.x'.  The procedure is the same for the Hitachi
775
SH and the H8/500.
776
 
777
   First hook up your development board.  In this example, we use a
778
board attached to serial port `COM2'; if you use a different serial
779
port, substitute its name in the argument of the `mode' command.  When
780
you call `asynctsr', the auxiliary comms program used by the debugger,
781
you give it just the numeric part of the serial port's name; for
782
example, `asyncstr 2' below runs `asyncstr' on `COM2'.
783
 
784
     C:\H8300\TEST> asynctsr 2
785
     C:\H8300\TEST> mode com2:9600,n,8,1,p
786
 
787
     Resident portion of MODE loaded
788
 
789
     COM2: 9600, n, 8, 1, p
790
 
791
     _Warning:_ We have noticed a bug in PC-NFS that conflicts with
792
     `asynctsr'.  If you also run PC-NFS on your DOS host, you may need
793
     to disable it, or even boot without it, to use `asynctsr' to
794
     control your development board.
795
 
796
   Now that serial communications are set up, and the development board
797
is connected, you can start up GDB.  Call `gdb' with the name of your
798
program as the argument.  `GDB' prompts you, as usual, with the prompt
799
`(gdb)'.  Use two special commands to begin your debugging session:
800
`target hms' to specify cross-debugging to the Hitachi board, and the
801
`load' command to download your program to the board.  `load' displays
802
the names of the program's sections, and a `*' for each 2K of data
803
downloaded.  (If you want to refresh GDB data on symbols or on the
804
executable file without downloading, use the GDB commands `file' or
805
`symbol-file'.  These commands, and `load' itself, are described in
806
*Note Commands to specify files: Files.)
807
 
808
     (eg-C:\H8300\TEST) gdb t.x
809
     GDB is free software and you are welcome to distribute copies
810
      of it under certain conditions; type "show copying" to see
811
      the conditions.
812
     There is absolutely no warranty for GDB; type "show warranty"
813
     for details.
814
     GDB 5.3, Copyright 1992 Free Software Foundation, Inc...
815
     (gdb) target hms
816
     Connected to remote H8/300 HMS system.
817
     (gdb) load t.x
818
     .text   : 0x8000 .. 0xabde ***********
819
     .data   : 0xabde .. 0xad30 *
820
     .stack  : 0xf000 .. 0xf014 *
821
 
822
   At this point, you're ready to run or debug your program.  From here
823
on, you can use all the usual GDB commands.  The `break' command sets
824
breakpoints; the `run' command starts your program; `print' or `x'
825
display data; the `continue' command resumes execution after stopping
826
at a breakpoint.  You can use the `help' command at any time to find
827
out more about GDB commands.
828
 
829
   Remember, however, that _operating system_ facilities aren't
830
available on your development board; for example, if your program hangs,
831
you can't send an interrupt--but you can press the RESET switch!
832
 
833
   Use the RESET button on the development board
834
   * to interrupt your program (don't use `ctl-C' on the DOS host--it
835
     has no way to pass an interrupt signal to the development board);
836
     and
837
 
838
   * to return to the GDB command prompt after your program finishes
839
     normally.  The communications protocol provides no other way for
840
     GDB to detect program completion.
841
 
842
   In either case, GDB sees the effect of a RESET on the development
843
board as a "normal exit" of your program.
844
 
845

846
File: gdb.info,  Node: Hitachi ICE,  Next: Hitachi Special,  Prev: Hitachi Boards,  Up: H8/300
847
 
848
Using the E7000 in-circuit emulator
849
...................................
850
 
851
   You can use the E7000 in-circuit emulator to develop code for either
852
the Hitachi SH or the H8/300H.  Use one of these forms of the `target
853
e7000' command to connect GDB to your E7000:
854
 
855
`target e7000 PORT SPEED'
856
     Use this form if your E7000 is connected to a serial port.  The
857
     PORT argument identifies what serial port to use (for example,
858
     `com2').  The third argument is the line speed in bits per second
859
     (for example, `9600').
860
 
861
`target e7000 HOSTNAME'
862
     If your E7000 is installed as a host on a TCP/IP network, you can
863
     just specify its hostname; GDB uses `telnet' to connect.
864
 
865

866
File: gdb.info,  Node: Hitachi Special,  Prev: Hitachi ICE,  Up: H8/300
867
 
868
Special GDB commands for Hitachi micros
869
.......................................
870
 
871
   Some GDB commands are available only for the H8/300:
872
 
873
`set machine h8300'
874
`set machine h8300h'
875
     Condition GDB for one of the two variants of the H8/300
876
     architecture with `set machine'.  You can use `show machine' to
877
     check which variant is currently in effect.
878
 
879

880
File: gdb.info,  Node: H8/500,  Next: i960,  Prev: H8/300,  Up: Embedded Processors
881
 
882
H8/500
883
------
884
 
885
`set memory MOD'
886
`show memory'
887
     Specify which H8/500 memory model (MOD) you are using with `set
888
     memory'; check which memory model is in effect with `show memory'.
889
     The accepted values for MOD are `small', `big', `medium', and
890
     `compact'.
891
 
892

893
File: gdb.info,  Node: i960,  Next: M32R/D,  Prev: H8/500,  Up: Embedded Processors
894
 
895
Intel i960
896
----------
897
 
898
`target mon960 DEV'
899
     MON960 monitor for Intel i960.
900
 
901
`target nindy DEVICENAME'
902
     An Intel 960 board controlled by a Nindy Monitor.  DEVICENAME is
903
     the name of the serial device to use for the connection, e.g.
904
     `/dev/ttya'.
905
 
906
   "Nindy" is a ROM Monitor program for Intel 960 target systems.  When
907
GDB is configured to control a remote Intel 960 using Nindy, you can
908
tell GDB how to connect to the 960 in several ways:
909
 
910
   * Through command line options specifying serial port, version of the
911
     Nindy protocol, and communications speed;
912
 
913
   * By responding to a prompt on startup;
914
 
915
   * By using the `target' command at any point during your GDB
916
     session.  *Note Commands for managing targets: Target Commands.
917
 
918
 
919
   With the Nindy interface to an Intel 960 board, `load' downloads
920
FILENAME to the 960 as well as adding its symbols in GDB.
921
 
922
* Menu:
923
 
924
* Nindy Startup::               Startup with Nindy
925
* Nindy Options::               Options for Nindy
926
* Nindy Reset::                 Nindy reset command
927
 
928

929
File: gdb.info,  Node: Nindy Startup,  Next: Nindy Options,  Up: i960
930
 
931
Startup with Nindy
932
..................
933
 
934
   If you simply start `gdb' without using any command-line options,
935
you are prompted for what serial port to use, _before_ you reach the
936
ordinary GDB prompt:
937
 
938
     Attach /dev/ttyNN -- specify NN, or "quit" to quit:
939
 
940
Respond to the prompt with whatever suffix (after `/dev/tty')
941
identifies the serial port you want to use.  You can, if you choose,
942
simply start up with no Nindy connection by responding to the prompt
943
with an empty line.  If you do this and later wish to attach to Nindy,
944
use `target' (*note Commands for managing targets: Target Commands.).
945
 
946

947
File: gdb.info,  Node: Nindy Options,  Next: Nindy Reset,  Prev: Nindy Startup,  Up: i960
948
 
949
Options for Nindy
950
.................
951
 
952
   These are the startup options for beginning your GDB session with a
953
Nindy-960 board attached:
954
 
955
`-r PORT'
956
     Specify the serial port name of a serial interface to be used to
957
     connect to the target system.  This option is only available when
958
     GDB is configured for the Intel 960 target architecture.  You may
959
     specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
960
     device name in `/dev' (e.g. `-r ttya'), or simply the unique
961
     suffix for a specific `tty' (e.g. `-r a').
962
 
963
`-O'
964
     (An uppercase letter "O", not a zero.)  Specify that GDB should use
965
     the "old" Nindy monitor protocol to connect to the target system.
966
     This option is only available when GDB is configured for the Intel
967
     960 target architecture.
968
 
969
          _Warning:_ if you specify `-O', but are actually trying to
970
          connect to a target system that expects the newer protocol,
971
          the connection fails, appearing to be a speed mismatch.  GDB
972
          repeatedly attempts to reconnect at several different line
973
          speeds.  You can abort this process with an interrupt.
974
 
975
`-brk'
976
     Specify that GDB should first send a `BREAK' signal to the target
977
     system, in an attempt to reset it, before connecting to a Nindy
978
     target.
979
 
980
          _Warning:_ Many target systems do not have the hardware that
981
          this requires; it only works with a few boards.
982
 
983
   The standard `-b' option controls the line speed used on the serial
984
port.
985
 
986

987
File: gdb.info,  Node: Nindy Reset,  Prev: Nindy Options,  Up: i960
988
 
989
Nindy reset command
990
...................
991
 
992
`reset'
993
     For a Nindy target, this command sends a "break" to the remote
994
     target system; this is only useful if the target has been equipped
995
     with a circuit to perform a hard reset (or some other interesting
996
     action) when a break is detected.
997
 
998

999
File: gdb.info,  Node: M32R/D,  Next: M68K,  Prev: i960,  Up: Embedded Processors
1000
 
1001
Mitsubishi M32R/D
1002
-----------------
1003
 
1004
`target m32r DEV'
1005
     Mitsubishi M32R/D ROM monitor.
1006
 
1007

1008
File: gdb.info,  Node: M68K,  Next: MIPS Embedded,  Prev: M32R/D,  Up: Embedded Processors
1009
 
1010
M68k
1011
----
1012
 
1013
   The Motorola m68k configuration includes ColdFire support, and
1014
target command for the following ROM monitors.
1015
 
1016
`target abug DEV'
1017
     ABug ROM monitor for M68K.
1018
 
1019
`target cpu32bug DEV'
1020
     CPU32BUG monitor, running on a CPU32 (M68K) board.
1021
 
1022
`target dbug DEV'
1023
     dBUG ROM monitor for Motorola ColdFire.
1024
 
1025
`target est DEV'
1026
     EST-300 ICE monitor, running on a CPU32 (M68K) board.
1027
 
1028
`target rom68k DEV'
1029
     ROM 68K monitor, running on an M68K IDP board.
1030
 
1031
   If GDB is configured with `m68*-ericsson-*', it will instead have
1032
only a single special target command:
1033
 
1034
`target es1800 DEV'
1035
     ES-1800 emulator for M68K.
1036
 
1037
   [context?]
1038
 
1039
`target rombug DEV'
1040
     ROMBUG ROM monitor for OS/9000.
1041
 
1042

1043
File: gdb.info,  Node: MIPS Embedded,  Next: PA,  Prev: M68K,  Up: Embedded Processors
1044
 
1045
MIPS Embedded
1046
-------------
1047
 
1048
   GDB can use the MIPS remote debugging protocol to talk to a MIPS
1049
board attached to a serial line.  This is available when you configure
1050
GDB with `--target=mips-idt-ecoff'.
1051
 
1052
   Use these GDB commands to specify the connection to your target
1053
board:
1054
 
1055
`target mips PORT'
1056
     To run a program on the board, start up `gdb' with the name of
1057
     your program as the argument.  To connect to the board, use the
1058
     command `target mips PORT', where PORT is the name of the serial
1059
     port connected to the board.  If the program has not already been
1060
     downloaded to the board, you may use the `load' command to
1061
     download it.  You can then use all the usual GDB commands.
1062
 
1063
     For example, this sequence connects to the target board through a
1064
     serial port, and loads and runs a program called PROG through the
1065
     debugger:
1066
 
1067
          host$ gdb PROG
1068
          GDB is free software and ...
1069
          (gdb) target mips /dev/ttyb
1070
          (gdb) load PROG
1071
          (gdb) run
1072
 
1073
`target mips HOSTNAME:PORTNUMBER'
1074
     On some GDB host configurations, you can specify a TCP connection
1075
     (for instance, to a serial line managed by a terminal
1076
     concentrator) instead of a serial port, using the syntax
1077
     `HOSTNAME:PORTNUMBER'.
1078
 
1079
`target pmon PORT'
1080
     PMON ROM monitor.
1081
 
1082
`target ddb PORT'
1083
     NEC's DDB variant of PMON for Vr4300.
1084
 
1085
`target lsi PORT'
1086
     LSI variant of PMON.
1087
 
1088
`target r3900 DEV'
1089
     Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips.
1090
 
1091
`target array DEV'
1092
     Array Tech LSI33K RAID controller board.
1093
 
1094
GDB also supports these special commands for MIPS targets:
1095
 
1096
`set processor ARGS'
1097
`show processor'
1098
     Use the `set processor' command to set the type of MIPS processor
1099
     when you want to access processor-type-specific registers.  For
1100
     example, `set processor R3041' tells GDB to use the CPU registers
1101
     appropriate for the 3041 chip.  Use the `show processor' command
1102
     to see what MIPS processor GDB is using.  Use the `info reg'
1103
     command to see what registers GDB is using.
1104
 
1105
`set mipsfpu double'
1106
`set mipsfpu single'
1107
`set mipsfpu none'
1108
`show mipsfpu'
1109
     If your target board does not support the MIPS floating point
1110
     coprocessor, you should use the command `set mipsfpu none' (if you
1111
     need this, you may wish to put the command in your GDB init file).
1112
     This tells GDB how to find the return value of functions which
1113
     return floating point values.  It also allows GDB to avoid saving
1114
     the floating point registers when calling functions on the board.
1115
     If you are using a floating point coprocessor with only single
1116
     precision floating point support, as on the R4650 processor, use
1117
     the command `set mipsfpu single'.  The default double precision
1118
     floating point coprocessor may be selected using `set mipsfpu
1119
     double'.
1120
 
1121
     In previous versions the only choices were double precision or no
1122
     floating point, so `set mipsfpu on' will select double precision
1123
     and `set mipsfpu off' will select no floating point.
1124
 
1125
     As usual, you can inquire about the `mipsfpu' variable with `show
1126
     mipsfpu'.
1127
 
1128
`set remotedebug N'
1129
`show remotedebug'
1130
     You can see some debugging information about communications with
1131
     the board by setting the `remotedebug' variable.  If you set it to
1132
     `1' using `set remotedebug 1', every packet is displayed.  If you
1133
     set it to `2', every character is displayed.  You can check the
1134
     current value at any time with the command `show remotedebug'.
1135
 
1136
`set timeout SECONDS'
1137
`set retransmit-timeout SECONDS'
1138
`show timeout'
1139
`show retransmit-timeout'
1140
     You can control the timeout used while waiting for a packet, in
1141
     the MIPS remote protocol, with the `set timeout SECONDS' command.
1142
     The default is 5 seconds.  Similarly, you can control the timeout
1143
     used while waiting for an acknowledgement of a packet with the `set
1144
     retransmit-timeout SECONDS' command.  The default is 3 seconds.
1145
     You can inspect both values with `show timeout' and `show
1146
     retransmit-timeout'.  (These commands are _only_ available when
1147
     GDB is configured for `--target=mips-idt-ecoff'.)
1148
 
1149
     The timeout set by `set timeout' does not apply when GDB is
1150
     waiting for your program to stop.  In that case, GDB waits forever
1151
     because it has no way of knowing how long the program is going to
1152
     run before stopping.
1153
 
1154

1155
File: gdb.info,  Node: PowerPC,  Next: SH,  Prev: PA,  Up: Embedded Processors
1156
 
1157
PowerPC
1158
-------
1159
 
1160
`target dink32 DEV'
1161
     DINK32 ROM monitor.
1162
 
1163
`target ppcbug DEV'
1164
 
1165
`target ppcbug1 DEV'
1166
     PPCBUG ROM monitor for PowerPC.
1167
 
1168
`target sds DEV'
1169
     SDS monitor, running on a PowerPC board (such as Motorola's ADS).
1170
 
1171

1172
File: gdb.info,  Node: PA,  Next: PowerPC,  Prev: MIPS Embedded,  Up: Embedded Processors
1173
 
1174
HP PA Embedded
1175
--------------
1176
 
1177
`target op50n DEV'
1178
     OP50N monitor, running on an OKI HPPA board.
1179
 
1180
`target w89k DEV'
1181
     W89K monitor, running on a Winbond HPPA board.
1182
 
1183

1184
File: gdb.info,  Node: SH,  Next: Sparclet,  Prev: PowerPC,  Up: Embedded Processors
1185
 
1186
Hitachi SH
1187
----------
1188
 
1189
`target hms DEV'
1190
     A Hitachi SH board attached via serial line to your host.  Use
1191
     special commands `device' and `speed' to control the serial line
1192
     and the communications speed used.
1193
 
1194
`target e7000 DEV'
1195
     E7000 emulator for Hitachi SH.
1196
 
1197
`target sh3 DEV'
1198
 
1199
`target sh3e DEV'
1200
     Hitachi SH-3 and SH-3E target systems.
1201
 
1202

1203
File: gdb.info,  Node: Sparclet,  Next: Sparclite,  Prev: SH,  Up: Embedded Processors
1204
 
1205
Tsqware Sparclet
1206
----------------
1207
 
1208
   GDB enables developers to debug tasks running on Sparclet targets
1209
from a Unix host.  GDB uses code that runs on both the Unix host and on
1210
the Sparclet target.  The program `gdb' is installed and executed on
1211
the Unix host.
1212
 
1213
`remotetimeout ARGS'
1214
     GDB supports the option `remotetimeout'.  This option is set by
1215
     the user, and  ARGS represents the number of seconds GDB waits for
1216
     responses.
1217
 
1218
   When compiling for debugging, include the options `-g' to get debug
1219
information and `-Ttext' to relocate the program to where you wish to
1220
load it on the target.  You may also want to add the options `-n' or
1221
`-N' in order to reduce the size of the sections.  Example:
1222
 
1223
     sparclet-aout-gcc prog.c -Ttext 0x12010000 -g -o prog -N
1224
 
1225
   You can use `objdump' to verify that the addresses are what you
1226
intended:
1227
 
1228
     sparclet-aout-objdump --headers --syms prog
1229
 
1230
   Once you have set your Unix execution search path to find GDB, you
1231
are ready to run GDB.  From your Unix host, run `gdb' (or
1232
`sparclet-aout-gdb', depending on your installation).
1233
 
1234
   GDB comes up showing the prompt:
1235
 
1236
     (gdbslet)
1237
 
1238
* Menu:
1239
 
1240
* Sparclet File::                Setting the file to debug
1241
* Sparclet Connection::          Connecting to Sparclet
1242
* Sparclet Download::            Sparclet download
1243
* Sparclet Execution::           Running and debugging
1244
 
1245

1246
File: gdb.info,  Node: Sparclet File,  Next: Sparclet Connection,  Up: Sparclet
1247
 
1248
Setting file to debug
1249
.....................
1250
 
1251
   The GDB command `file' lets you choose with program to debug.
1252
 
1253
     (gdbslet) file prog
1254
 
1255
   GDB then attempts to read the symbol table of `prog'.  GDB locates
1256
the file by searching the directories listed in the command search path.
1257
If the file was compiled with debug information (option "-g"), source
1258
files will be searched as well.  GDB locates the source files by
1259
searching the directories listed in the directory search path (*note
1260
Your program's environment: Environment.).  If it fails to find a file,
1261
it displays a message such as:
1262
 
1263
     prog: No such file or directory.
1264
 
1265
   When this happens, add the appropriate directories to the search
1266
paths with the GDB commands `path' and `dir', and execute the `target'
1267
command again.
1268
 
1269

1270
File: gdb.info,  Node: Sparclet Connection,  Next: Sparclet Download,  Prev: Sparclet File,  Up: Sparclet
1271
 
1272
Connecting to Sparclet
1273
......................
1274
 
1275
   The GDB command `target' lets you connect to a Sparclet target.  To
1276
connect to a target on serial port "`ttya'", type:
1277
 
1278
     (gdbslet) target sparclet /dev/ttya
1279
     Remote target sparclet connected to /dev/ttya
1280
     main () at ../prog.c:3
1281
 
1282
   GDB displays messages like these:
1283
 
1284
     Connected to ttya.
1285
 
1286

1287
File: gdb.info,  Node: Sparclet Download,  Next: Sparclet Execution,  Prev: Sparclet Connection,  Up: Sparclet
1288
 
1289
Sparclet download
1290
.................
1291
 
1292
   Once connected to the Sparclet target, you can use the GDB `load'
1293
command to download the file from the host to the target.  The file
1294
name and load offset should be given as arguments to the `load' command.
1295
Since the file format is aout, the program must be loaded to the
1296
starting address.  You can use `objdump' to find out what this value
1297
is.  The load offset is an offset which is added to the VMA (virtual
1298
memory address) of each of the file's sections.  For instance, if the
1299
program `prog' was linked to text address 0x1201000, with data at
1300
0x12010160 and bss at 0x12010170, in GDB, type:
1301
 
1302
     (gdbslet) load prog 0x12010000
1303
     Loading section .text, size 0xdb0 vma 0x12010000
1304
 
1305
   If the code is loaded at a different address then what the program
1306
was linked to, you may need to use the `section' and `add-symbol-file'
1307
commands to tell GDB where to map the symbol table.
1308
 
1309

1310
File: gdb.info,  Node: Sparclet Execution,  Prev: Sparclet Download,  Up: Sparclet
1311
 
1312
Running and debugging
1313
.....................
1314
 
1315
   You can now begin debugging the task using GDB's execution control
1316
commands, `b', `step', `run', etc.  See the GDB manual for the list of
1317
commands.
1318
 
1319
     (gdbslet) b main
1320
     Breakpoint 1 at 0x12010000: file prog.c, line 3.
1321
     (gdbslet) run
1322
     Starting program: prog
1323
     Breakpoint 1, main (argc=1, argv=0xeffff21c) at prog.c:3
1324
     3        char *symarg = 0;
1325
     (gdbslet) step
1326
     4        char *execarg = "hello!";
1327
     (gdbslet)
1328
 
1329

1330
File: gdb.info,  Node: Sparclite,  Next: ST2000,  Prev: Sparclet,  Up: Embedded Processors
1331
 
1332
Fujitsu Sparclite
1333
-----------------
1334
 
1335
`target sparclite DEV'
1336
     Fujitsu sparclite boards, used only for the purpose of loading.
1337
     You must use an additional command to debug the program.  For
1338
     example: target remote DEV using GDB standard remote protocol.
1339
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.