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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [doc/] [gdb.info-1] - Blame information for rev 1774

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

Line No. Rev Author Line
1 362 markom
This is ./gdb.info, produced by makeinfo version 4.0 from gdb.texinfo.
2 106 markom
 
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: Top,  Next: Summary,  Prev: (dir),  Up: (dir)
30
 
31
Debugging with GDB
32
******************
33
 
34
   This file describes GDB, the GNU symbolic debugger.
35
 
36
   This is the Eighth Edition, March 2000, for GDB Version 5.0.
37
 
38
   Copyright (C) 1988-2000 Free Software Foundation, Inc.
39
 
40
* Menu:
41
 
42
* Summary::                     Summary of GDB
43
* Sample Session::              A sample GDB session
44
 
45
* Invocation::                  Getting in and out of GDB
46
* Commands::                    GDB commands
47
* Running::                     Running programs under GDB
48
* Stopping::                    Stopping and continuing
49
* Stack::                       Examining the stack
50
* Source::                      Examining source files
51
* Data::                        Examining data
52
 
53
* Languages::                   Using GDB with different languages
54
 
55
* Symbols::                     Examining the symbol table
56
* Altering::                    Altering execution
57
* GDB Files::                   GDB files
58
* Targets::                     Specifying a debugging target
59
* Configurations::              Configuration-specific information
60
* Controlling GDB::             Controlling GDB
61
* Sequences::                   Canned sequences of commands
62
* Emacs::                       Using GDB under GNU Emacs
63
* Annotations::                 GDB's annotation interface.
64
* GDB/MI::                      GDB's Machine Interface.
65
 
66
* GDB Bugs::                    Reporting bugs in GDB
67
* Formatting Documentation::    How to format and print GDB documentation
68
 
69
* Command Line Editing::        Command Line Editing
70
* Using History Interactively:: Using History Interactively
71
* Installing GDB::              Installing GDB
72
* Index::                       Index
73
 
74

75
File: gdb.info,  Node: Summary,  Next: Sample Session,  Prev: Top,  Up: Top
76
 
77
Summary of GDB
78
**************
79
 
80
   The purpose of a debugger such as GDB is to allow you to see what is
81
going on "inside" another program while it executes--or what another
82
program was doing at the moment it crashed.
83
 
84
   GDB can do four main kinds of things (plus other things in support of
85
these) to help you catch bugs in the act:
86
 
87
   * Start your program, specifying anything that might affect its
88
     behavior.
89
 
90
   * Make your program stop on specified conditions.
91
 
92
   * Examine what has happened, when your program has stopped.
93
 
94
   * Change things in your program, so you can experiment with
95
     correcting the effects of one bug and go on to learn about another.
96
 
97
   You can use GDB to debug programs written in C and C++.  For more
98
information, see *Note Supported languages: Support.  For more
99
information, see *Note C and C++: C.
100
 
101
   Support for Modula-2 and Chill is partial.  For information on
102
Modula-2, see *Note Modula-2: Modula-2.  For information on Chill, see
103
*Note Chill::.
104
 
105
   Debugging Pascal programs which use sets, subranges, file variables,
106
or nested functions does not currently work.  GDB does not support
107
entering expressions, printing values, or similar features using Pascal
108
syntax.
109
 
110
   GDB can be used to debug programs written in Fortran, although it
111
may be necessary to refer to some variables with a trailing underscore.
112
 
113
* Menu:
114
 
115
* Free Software::               Freely redistributable software
116
* Contributors::                Contributors to GDB
117
 
118

119
File: gdb.info,  Node: Free Software,  Next: Contributors,  Up: Summary
120
 
121
Free software
122
=============
123
 
124
   GDB is "free software", protected by the GNU General Public License
125
(GPL).  The GPL gives you the freedom to copy or adapt a licensed
126
program--but every person getting a copy also gets with it the freedom
127
to modify that copy (which means that they must get access to the
128
source code), and the freedom to distribute further copies.  Typical
129
software companies use copyrights to limit your freedoms; the Free
130
Software Foundation uses the GPL to preserve these freedoms.
131
 
132
   Fundamentally, the General Public License is a license which says
133
that you have these freedoms and that you cannot take these freedoms
134
away from anyone else.
135
 
136

137
File: gdb.info,  Node: Contributors,  Prev: Free Software,  Up: Summary
138
 
139
Contributors to GDB
140
===================
141
 
142
   Richard Stallman was the original author of GDB, and of many other
143
GNU programs.  Many others have contributed to its development.  This
144
section attempts to credit major contributors.  One of the virtues of
145
free software is that everyone is free to contribute to it; with
146
regret, we cannot actually acknowledge everyone here.  The file
147
`ChangeLog' in the GDB distribution approximates a blow-by-blow account.
148
 
149
   Changes much prior to version 2.0 are lost in the mists of time.
150
 
151
     _Plea:_ Additions to this section are particularly welcome.  If you
152
     or your friends (or enemies, to be evenhanded) have been unfairly
153
     omitted from this list, we would like to add your names!
154
 
155
   So that they may not regard their many labors as thankless, we
156
particularly thank those who shepherded GDB through major releases:
157
Andrew Cagney (release 5.0); Jim Blandy (release 4.18); Jason Molenda
158
(release 4.17); Stan Shebs (release 4.14); Fred Fish (releases 4.16,
159
4.15, 4.13, 4.12, 4.11, 4.10, and 4.9); Stu Grossman and John Gilmore
160
(releases 4.8, 4.7, 4.6, 4.5, and 4.4); John Gilmore (releases 4.3,
161
4.2, 4.1, 4.0, and 3.9); Jim Kingdon (releases 3.5, 3.4, and 3.3); and
162
Randy Smith (releases 3.2, 3.1, and 3.0).
163
 
164
   Richard Stallman, assisted at various times by Peter TerMaat, Chris
165
Hanson, and Richard Mlynarik, handled releases through 2.8.
166
 
167
   Michael Tiemann is the author of most of the GNU C++ support in GDB,
168
with significant additional contributions from Per Bothner.  James
169
Clark wrote the GNU C++ demangler.  Early work on C++ was by Peter
170
TerMaat (who also did much general update work leading to release 3.0).
171
 
172
   GDB 4 uses the BFD subroutine library to examine multiple
173
object-file formats; BFD was a joint project of David V.
174
Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore.
175
 
176
   David Johnson wrote the original COFF support; Pace Willison did the
177
original support for encapsulated COFF.
178
 
179
   Brent Benson of Harris Computer Systems contributed DWARF 2 support.
180
 
181
   Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
182
Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
183
support.  Jean-Daniel Fekete contributed Sun 386i support.  Chris
184
Hanson improved the HP9000 support.  Noboyuki Hikichi and Tomoyuki
185
Hasei contributed Sony/News OS 3 support.  David Johnson contributed
186
Encore Umax support.  Jyrki Kuoppala contributed Altos 3068 support.
187
Jeff Law contributed HP PA and SOM support.  Keith Packard contributed
188
NS32K support.  Doug Rabson contributed Acorn Risc Machine support.
189
Bob Rusk contributed Harris Nighthawk CX-UX support.  Chris Smith
190
contributed Convex support (and Fortran debugging).  Jonathan Stone
191
contributed Pyramid support.  Michael Tiemann contributed SPARC support.
192
Tim Tucker contributed support for the Gould NP1 and Gould Powernode.
193
Pace Willison contributed Intel 386 support.  Jay Vosburgh contributed
194
Symmetry support.
195
 
196
   Andreas Schwab contributed M68K Linux support.
197
 
198
   Rich Schaefer and Peter Schauer helped with support of SunOS shared
199
libraries.
200
 
201
   Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
202
several machine instruction sets.
203
 
204
   Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
205
develop remote debugging.  Intel Corporation, Wind River Systems, AMD,
206
and ARM contributed remote debugging modules for the i960, VxWorks,
207
A29K UDI, and RDI targets, respectively.
208
 
209
   Brian Fox is the author of the readline libraries providing
210
command-line editing and command history.
211
 
212
   Andrew Beers of SUNY Buffalo wrote the language-switching code, the
213
Modula-2 support, and contributed the Languages chapter of this manual.
214
 
215
   Fred Fish wrote most of the support for Unix System Vr4.  He also
216
enhanced the command-completion support to cover C++ overloaded symbols.
217
 
218
   Hitachi America, Ltd. sponsored the support for H8/300, H8/500, and
219
Super-H processors.
220
 
221
   NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx
222
processors.
223
 
224
   Mitsubishi sponsored the support for D10V, D30V, and M32R/D
225
processors.
226
 
227
   Toshiba sponsored the support for the TX39 Mips processor.
228
 
229
   Matsushita sponsored the support for the MN10200 and MN10300
230
processors.
231
 
232
   Fujitsu sponsored the support for SPARClite and FR30 processors.
233
 
234
   Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
235
watchpoints.
236
 
237
   Michael Snyder added support for tracepoints.
238
 
239
   Stu Grossman wrote gdbserver.
240
 
241
   Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly
242
innumerable bug fixes and cleanups throughout GDB.
243
 
244
   The following people at the Hewlett-Packard Company contributed
245
support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0
246
(narrow mode), HP's implementation of kernel threads, HP's aC++
247
compiler, and the terminal user interface: Ben Krepp, Richard Title,
248
John Bishop, Susan Macchia, Kathy Mann, Satish Pai, India Paul, Steve
249
Rehrauer, and Elena Zannoni.  Kim Haase provided HP-specific
250
information in this manual.
251
 
252
   Cygnus Solutions has sponsored GDB maintenance and much of its
253
development since 1991.  Cygnus engineers who have worked on GDB
254
fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin
255
Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim
256
Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
257
Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek
258
Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni.  In
259
addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton,
260
JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug
261
Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff
262
Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner,
263
Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin
264
Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
265
Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
266
Zuhn have made contributions both large and small.
267
 
268

269
File: gdb.info,  Node: Sample Session,  Next: Invocation,  Prev: Summary,  Up: Top
270
 
271
A Sample GDB Session
272
********************
273
 
274
   You can use this manual at your leisure to read all about GDB.
275
However, a handful of commands are enough to get started using the
276
debugger.  This chapter illustrates those commands.
277
 
278
   One of the preliminary versions of GNU `m4' (a generic macro
279
processor) exhibits the following bug: sometimes, when we change its
280
quote strings from the default, the commands used to capture one macro
281
definition within another stop working.  In the following short `m4'
282
session, we define a macro `foo' which expands to `0000'; we then use
283
the `m4' built-in `defn' to define `bar' as the same thing.  However,
284
when we change the open quote string to `' and the close quote
285
string to `', the same procedure fails to define a new synonym
286
`baz':
287
 
288
     $ cd gnu/m4
289
     $ ./m4
290
     define(foo,0000)
291
 
292
     foo
293
     0000
294
     define(bar,defn(`foo'))
295
 
296
     bar
297
     0000
298
     changequote(,)
299
 
300
     define(baz,defn(foo))
301
     baz
302
     C-d
303
     m4: End of input: 0: fatal error: EOF in string
304
 
305
Let us use GDB to try to see what is going on.
306
 
307
     $ gdb m4
308
     GDB is free software and you are welcome to distribute copies
309
      of it under certain conditions; type "show copying" to see
310
      the conditions.
311
     There is absolutely no warranty for GDB; type "show warranty"
312
      for details.
313
 
314
     GDB 5.0, Copyright 1999 Free Software Foundation, Inc...
315
     (gdb)
316
 
317
GDB reads only enough symbol data to know where to find the rest when
318
needed; as a result, the first prompt comes up very quickly.  We now
319
tell GDB to use a narrower display width than usual, so that examples
320
fit in this manual.
321
 
322
     (gdb) set width 70
323
 
324
We need to see how the `m4' built-in `changequote' works.  Having
325
looked at the source, we know the relevant subroutine is
326
`m4_changequote', so we set a breakpoint there with the GDB `break'
327
command.
328
 
329
     (gdb) break m4_changequote
330
     Breakpoint 1 at 0x62f4: file builtin.c, line 879.
331
 
332
Using the `run' command, we start `m4' running under GDB control; as
333
long as control does not reach the `m4_changequote' subroutine, the
334
program runs as usual:
335
 
336
     (gdb) run
337
     Starting program: /work/Editorial/gdb/gnu/m4/m4
338
     define(foo,0000)
339
 
340
     foo
341
     0000
342
 
343
To trigger the breakpoint, we call `changequote'.  GDB suspends
344
execution of `m4', displaying information about the context where it
345
stops.
346
 
347
     changequote(,)
348
 
349
     Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
350
         at builtin.c:879
351
     879         if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
352
 
353
Now we use the command `n' (`next') to advance execution to the next
354
line of the current function.
355
 
356
     (gdb) n
357
     882         set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
358
      : nil,
359
 
360
`set_quotes' looks like a promising subroutine.  We can go into it by
361
using the command `s' (`step') instead of `next'.  `step' goes to the
362
next line to be executed in _any_ subroutine, so it steps into
363
`set_quotes'.
364
 
365
     (gdb) s
366
     set_quotes (lq=0x34c78 "", rq=0x34c88 "")
367
         at input.c:530
368
     530         if (lquote != def_lquote)
369
 
370
The display that shows the subroutine where `m4' is now suspended (and
371
its arguments) is called a stack frame display.  It shows a summary of
372
the stack.  We can use the `backtrace' command (which can also be
373
spelled `bt'), to see where we are in the stack as a whole: the
374
`backtrace' command displays a stack frame for each active subroutine.
375
 
376
     (gdb) bt
377
     #0  set_quotes (lq=0x34c78 "", rq=0x34c88 "")
378
         at input.c:530
379
     #1  0x6344 in m4_changequote (argc=3, argv=0x33c70)
380
         at builtin.c:882
381
     #2  0x8174 in expand_macro (sym=0x33320) at macro.c:242
382
     #3  0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
383
         at macro.c:71
384
     #4  0x79dc in expand_input () at macro.c:40
385
     #5  0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
386
 
387
We step through a few more lines to see what happens.  The first two
388
times, we can use `s'; the next two times we use `n' to avoid falling
389
into the `xstrdup' subroutine.
390
 
391
     (gdb) s
392
     0x3b5c  532         if (rquote != def_rquote)
393
     (gdb) s
394
     0x3b80  535         lquote = (lq == nil || *lq == '\0') ?  \
395
     def_lquote : xstrdup(lq);
396
     (gdb) n
397
     536         rquote = (rq == nil || *rq == '\0') ? def_rquote\
398
      : xstrdup(rq);
399
     (gdb) n
400
     538         len_lquote = strlen(rquote);
401
 
402
The last line displayed looks a little odd; we can examine the variables
403
`lquote' and `rquote' to see if they are in fact the new left and right
404
quotes we specified.  We use the command `p' (`print') to see their
405
values.
406
 
407
     (gdb) p lquote
408
     $1 = 0x35d40 ""
409
     (gdb) p rquote
410
     $2 = 0x35d50 ""
411
 
412
`lquote' and `rquote' are indeed the new left and right quotes.  To
413
look at some context, we can display ten lines of source surrounding
414
the current line with the `l' (`list') command.
415
 
416
     (gdb) l
417
     533             xfree(rquote);
418
     534
419
     535         lquote = (lq == nil || *lq == '\0') ? def_lquote\
420
      : xstrdup (lq);
421
     536         rquote = (rq == nil || *rq == '\0') ? def_rquote\
422
      : xstrdup (rq);
423
     537
424
     538         len_lquote = strlen(rquote);
425
     539         len_rquote = strlen(lquote);
426
     540     }
427
     541
428
     542     void
429
 
430
Let us step past the two lines that set `len_lquote' and `len_rquote',
431
and then examine the values of those variables.
432
 
433
     (gdb) n
434
     539         len_rquote = strlen(lquote);
435
     (gdb) n
436
     540     }
437
     (gdb) p len_lquote
438
     $3 = 9
439
     (gdb) p len_rquote
440
     $4 = 7
441
 
442
That certainly looks wrong, assuming `len_lquote' and `len_rquote' are
443
meant to be the lengths of `lquote' and `rquote' respectively.  We can
444
set them to better values using the `p' command, since it can print the
445
value of any expression--and that expression can include subroutine
446
calls and assignments.
447
 
448
     (gdb) p len_lquote=strlen(lquote)
449
     $5 = 7
450
     (gdb) p len_rquote=strlen(rquote)
451
     $6 = 9
452
 
453
Is that enough to fix the problem of using the new quotes with the `m4'
454
built-in `defn'?  We can allow `m4' to continue executing with the `c'
455
(`continue') command, and then try the example that caused trouble
456
initially:
457
 
458
     (gdb) c
459
     Continuing.
460
 
461
     define(baz,defn(foo))
462
 
463
     baz
464
     0000
465
 
466
Success!  The new quotes now work just as well as the default ones.  The
467
problem seems to have been just the two typos defining the wrong
468
lengths.  We allow `m4' exit by giving it an EOF as input:
469
 
470
     C-d
471
     Program exited normally.
472
 
473
The message `Program exited normally.' is from GDB; it indicates `m4'
474
has finished executing.  We can end our GDB session with the GDB `quit'
475
command.
476
 
477
     (gdb) quit
478
 
479

480
File: gdb.info,  Node: Invocation,  Next: Commands,  Prev: Sample Session,  Up: Top
481
 
482
Getting In and Out of GDB
483
*************************
484
 
485
   This chapter discusses how to start GDB, and how to get out of it.
486
The essentials are:
487
   * type `gdb' to start GDB.
488
 
489
   * type `quit' or `C-d' to exit.
490
 
491
* Menu:
492
 
493
* Invoking GDB::                How to start GDB
494
* Quitting GDB::                How to quit GDB
495
* Shell Commands::              How to use shell commands inside GDB
496
 
497

498
File: gdb.info,  Node: Invoking GDB,  Next: Quitting GDB,  Up: Invocation
499
 
500
Invoking GDB
501
============
502
 
503
   Invoke GDB by running the program `gdb'.  Once started, GDB reads
504
commands from the terminal until you tell it to exit.
505
 
506
   You can also run `gdb' with a variety of arguments and options, to
507
specify more of your debugging environment at the outset.
508
 
509
   The command-line options described here are designed to cover a
510
variety of situations; in some environments, some of these options may
511
effectively be unavailable.
512
 
513
   The most usual way to start GDB is with one argument, specifying an
514
executable program:
515
 
516
     gdb PROGRAM
517
 
518
You can also start with both an executable program and a core file
519
specified:
520
 
521
     gdb PROGRAM CORE
522
 
523
   You can, instead, specify a process ID as a second argument, if you
524
want to debug a running process:
525
 
526
     gdb PROGRAM 1234
527
 
528
would attach GDB to process `1234' (unless you also have a file named
529
`1234'; GDB does check for a core file first).
530
 
531
   Taking advantage of the second command-line argument requires a
532
fairly complete operating system; when you use GDB as a remote debugger
533
attached to a bare board, there may not be any notion of "process", and
534
there is often no way to get a core dump.  GDB will warn you if it is
535
unable to attach or to read core dumps.
536
 
537
   You can run `gdb' without printing the front material, which
538
describes GDB's non-warranty, by specifying `-silent':
539
 
540
     gdb -silent
541
 
542
You can further control how GDB starts up by using command-line
543
options.  GDB itself can remind you of the options available.
544
 
545
Type
546
 
547
     gdb -help
548
 
549
to display all available options and briefly describe their use (`gdb
550
-h' is a shorter equivalent).
551
 
552
   All options and command line arguments you give are processed in
553
sequential order.  The order makes a difference when the `-x' option is
554
used.
555
 
556
* Menu:
557
 
558
* File Options::                Choosing files
559
* Mode Options::                Choosing modes
560
 
561

562
File: gdb.info,  Node: File Options,  Next: Mode Options,  Up: Invoking GDB
563
 
564
Choosing files
565
--------------
566
 
567
   When GDB starts, it reads any arguments other than options as
568
specifying an executable file and core file (or process ID).  This is
569
the same as if the arguments were specified by the `-se' and `-c'
570
options respectively.  (GDB reads the first argument that does not have
571
an associated option flag as equivalent to the `-se' option followed by
572
that argument; and the second argument that does not have an associated
573
option flag, if any, as equivalent to the `-c' option followed by that
574
argument.)
575
 
576
   If GDB has not been configured to included core file support, such
577
as for most embedded targets, then it will complain about a second
578
argument and ignore it.
579
 
580
   Many options have both long and short forms; both are shown in the
581
following list.  GDB also recognizes the long forms if you truncate
582
them, so long as enough of the option is present to be unambiguous.
583
(If you prefer, you can flag option arguments with `--' rather than
584
`-', though we illustrate the more usual convention.)
585
 
586
`-symbols FILE'
587
`-s FILE'
588
     Read symbol table from file FILE.
589
 
590
`-exec FILE'
591
`-e FILE'
592
     Use file FILE as the executable file to execute when appropriate,
593
     and for examining pure data in conjunction with a core dump.
594
 
595
`-se FILE'
596
     Read symbol table from file FILE and use it as the executable file.
597
 
598
`-core FILE'
599
`-c FILE'
600
     Use file FILE as a core dump to examine.
601
 
602
`-c NUMBER'
603
     Connect to process ID NUMBER, as with the `attach' command (unless
604
     there is a file in core-dump format named NUMBER, in which case
605
     `-c' specifies that file as a core dump to read).
606
 
607
`-command FILE'
608
`-x FILE'
609
     Execute GDB commands from file FILE.  *Note Command files: Command
610
     Files.
611
 
612
`-directory DIRECTORY'
613
`-d DIRECTORY'
614
     Add DIRECTORY to the path to search for source files.
615
 
616
`-m'
617
`-mapped'
618
     _Warning: this option depends on operating system facilities that
619
     are not supported on all systems._
620
     If memory-mapped files are available on your system through the
621
     `mmap' system call, you can use this option to have GDB write the
622
     symbols from your program into a reusable file in the current
623
     directory.  If the program you are debugging is called
624
     `/tmp/fred', the mapped symbol file is `/tmp/fred.syms'.  Future
625
     GDB debugging sessions notice the presence of this file, and can
626
     quickly map in symbol information from it, rather than reading the
627
     symbol table from the executable program.
628
 
629
     The `.syms' file is specific to the host machine where GDB is run.
630
     It holds an exact image of the internal GDB symbol table.  It
631
     cannot be shared across multiple host platforms.
632
 
633
`-r'
634
`-readnow'
635
     Read each symbol file's entire symbol table immediately, rather
636
     than the default, which is to read it incrementally as it is
637
     needed.  This makes startup slower, but makes future operations
638
     faster.
639
 
640
   You typically combine the `-mapped' and `-readnow' options in order
641
to build a `.syms' file that contains complete symbol information.
642
(*Note Commands to specify files: Files, for information on `.syms'
643
files.)  A simple GDB invocation to do nothing but build a `.syms' file
644
for future use is:
645
 
646
     gdb -batch -nx -mapped -readnow programname
647
 
648

649
File: gdb.info,  Node: Mode Options,  Prev: File Options,  Up: Invoking GDB
650
 
651
Choosing modes
652
--------------
653
 
654
   You can run GDB in various alternative modes--for example, in batch
655
mode or quiet mode.
656
 
657
`-nx'
658
`-n'
659
     Do not execute commands found in any initialization files (normally
660
     called `.gdbinit', or `gdb.ini' on PCs).  Normally, GDB executes
661
     the commands in these files after all the command options and
662
     arguments have been processed.  *Note Command files: Command Files.
663
 
664
`-quiet'
665
`-silent'
666
`-q'
667
     "Quiet".  Do not print the introductory and copyright messages.
668
     These messages are also suppressed in batch mode.
669
 
670
`-batch'
671
     Run in batch mode.  Exit with status `0' after processing all the
672
     command files specified with `-x' (and all commands from
673
     initialization files, if not inhibited with `-n').  Exit with
674
     nonzero status if an error occurs in executing the GDB commands in
675
     the command files.
676
 
677
     Batch mode may be useful for running GDB as a filter, for example
678
     to download and run a program on another computer; in order to
679
     make this more useful, the message
680
 
681
          Program exited normally.
682
 
683
     (which is ordinarily issued whenever a program running under GDB
684
     control terminates) is not issued when running in batch mode.
685
 
686
`-nowindows'
687
`-nw'
688
     "No windows".  If GDB comes with a graphical user interface (GUI)
689
     built in, then this option tells GDB to only use the command-line
690
     interface.  If no GUI is available, this option has no effect.
691
 
692
`-windows'
693
`-w'
694
     If GDB includes a GUI, then this option requires it to be used if
695
     possible.
696
 
697
`-cd DIRECTORY'
698
     Run GDB using DIRECTORY as its working directory, instead of the
699
     current directory.
700
 
701
`-fullname'
702
`-f'
703
     GNU Emacs sets this option when it runs GDB as a subprocess.  It
704
     tells GDB to output the full file name and line number in a
705
     standard, recognizable fashion each time a stack frame is
706
     displayed (which includes each time your program stops).  This
707
     recognizable format looks like two `\032' characters, followed by
708
     the file name, line number and character position separated by
709
     colons, and a newline.  The Emacs-to-GDB interface program uses
710
     the two `\032' characters as a signal to display the source code
711
     for the frame.
712
 
713
`-epoch'
714
     The Epoch Emacs-GDB interface sets this option when it runs GDB as
715
     a subprocess.  It tells GDB to modify its print routines so as to
716
     allow Epoch to display values of expressions in a separate window.
717
 
718
`-annotate LEVEL'
719
     This option sets the "annotation level" inside GDB.  Its effect is
720 362 markom
     identical to using `set annotate LEVEL' (*note Annotations::).
721 106 markom
     Annotation level controls how much information does GDB print
722
     together with its prompt, values of expressions, source lines, and
723
     other types of output.  Level 0 is the normal, level 1 is for use
724
     when GDB is run as a subprocess of GNU Emacs, level 2 is the
725
     maximum annotation suitable for programs that control GDB.
726
 
727
`-async'
728
     Use the asynchronous event loop for the command-line interface.
729
     GDB processes all events, such as user keyboard input, via a
730
     special event loop.  This allows GDB to accept and process user
731
     commands in parallel with the debugged process being run(1), so
732
     you don't need to wait for control to return to GDB before you
733
     type the next command.  (_Note:_ as of version 5.0, the target
734
     side of the asynchronous operation is not yet in place, so
735
     `-async' does not work fully yet.)
736
 
737
     When the standard input is connected to a terminal device, GDB
738
     uses the asynchronous event loop by default, unless disabled by the
739
     `-noasync' option.
740
 
741
`-noasync'
742
     Disable the asynchronous event loop for the command-line interface.
743
 
744
`-baud BPS'
745
`-b BPS'
746
     Set the line speed (baud rate or bits per second) of any serial
747
     interface used by GDB for remote debugging.
748
 
749
`-tty DEVICE'
750
`-t DEVICE'
751
     Run using DEVICE for your program's standard input and output.
752
 
753
`-interpreter INTERP'
754
     Use the interpreter INTERP for interface with the controlling
755
     program or device.  This option is meant to be set by programs
756
     which communicate with GDB using it as a back end.  For example,
757
     `--interpreter=mi' causes GDB to use the "gdbmi interface" (*note
758
     The GDB/MI Interface: GDB/MI.).
759
 
760
`-write'
761
     Open the executable and core files for both reading and writing.
762
     This is equivalent to the `set write on' command inside GDB (*note
763 362 markom
     Patching::).
764 106 markom
 
765
`-statistics'
766
     This option causes GDB to print statistics about time and memory
767
     usage after it completes each command and returns to the prompt.
768
 
769
`-version'
770
     This option causes GDB to print its version number and no-warranty
771
     blurb, and exit.
772
 
773
   ---------- Footnotes ----------
774
 
775
   (1) GDB built with DJGPP tools for MS-DOS/MS-Windows supports this
776
mode of operation, but the event loop is suspended when the debuggee
777
runs.
778
 
779

780
File: gdb.info,  Node: Quitting GDB,  Next: Shell Commands,  Prev: Invoking GDB,  Up: Invocation
781
 
782
Quitting GDB
783
============
784
 
785
`quit [EXPRESSION]'
786
`q'
787
     To exit GDB, use the `quit' command (abbreviated `q'), or type an
788
     end-of-file character (usually `C-d').  If you do not supply
789
     EXPRESSION, GDB will terminate normally; otherwise it will
790
     terminate using the result of EXPRESSION as the error code.
791
 
792
   An interrupt (often `C-c') does not exit from GDB, but rather
793
terminates the action of any GDB command that is in progress and
794
returns to GDB command level.  It is safe to type the interrupt
795
character at any time because GDB does not allow it to take effect
796
until a time when it is safe.
797
 
798
   If you have been using GDB to control an attached process or device,
799
you can release it with the `detach' command (*note Debugging an
800
already-running process: Attach.).
801
 
802

803
File: gdb.info,  Node: Shell Commands,  Prev: Quitting GDB,  Up: Invocation
804
 
805
Shell commands
806
==============
807
 
808
   If you need to execute occasional shell commands during your
809
debugging session, there is no need to leave or suspend GDB; you can
810
just use the `shell' command.
811
 
812
`shell COMMAND STRING'
813
     Invoke a standard shell to execute COMMAND STRING.  If it exists,
814
     the environment variable `SHELL' determines which shell to run.
815
     Otherwise GDB uses the default shell (`/bin/sh' on Unix systems,
816
     `COMMAND.COM' on MS-DOS, etc.).
817
 
818
   The utility `make' is often needed in development environments.  You
819
do not have to use the `shell' command for this purpose in GDB:
820
 
821
`make MAKE-ARGS'
822
     Execute the `make' program with the specified arguments.  This is
823
     equivalent to `shell make MAKE-ARGS'.
824
 
825

826
File: gdb.info,  Node: Commands,  Next: Running,  Prev: Invocation,  Up: Top
827
 
828
GDB Commands
829
************
830
 
831
   You can abbreviate a GDB command to the first few letters of the
832
command name, if that abbreviation is unambiguous; and you can repeat
833
certain GDB commands by typing just .  You can also use the 
834
key to get GDB to fill out the rest of a word in a command (or to show
835
you the alternatives available, if there is more than one possibility).
836
 
837
* Menu:
838
 
839
* Command Syntax::              How to give commands to GDB
840
* Completion::                  Command completion
841
* Help::                        How to ask GDB for help
842
 
843

844
File: gdb.info,  Node: Command Syntax,  Next: Completion,  Up: Commands
845
 
846
Command syntax
847
==============
848
 
849
   A GDB command is a single line of input.  There is no limit on how
850
long it can be.  It starts with a command name, which is followed by
851
arguments whose meaning depends on the command name.  For example, the
852
command `step' accepts an argument which is the number of times to
853
step, as in `step 5'.  You can also use the `step' command with no
854
arguments.  Some commands do not allow any arguments.
855
 
856
   GDB command names may always be truncated if that abbreviation is
857
unambiguous.  Other possible command abbreviations are listed in the
858
documentation for individual commands.  In some cases, even ambiguous
859
abbreviations are allowed; for example, `s' is specially defined as
860
equivalent to `step' even though there are other commands whose names
861
start with `s'.  You can test abbreviations by using them as arguments
862
to the `help' command.
863
 
864
   A blank line as input to GDB (typing just ) means to repeat the
865
previous command.  Certain commands (for example, `run') will not
866
repeat this way; these are commands whose unintentional repetition
867
might cause trouble and which you are unlikely to want to repeat.
868
 
869
   The `list' and `x' commands, when you repeat them with ,
870
construct new arguments rather than repeating exactly as typed.  This
871
permits easy scanning of source or memory.
872
 
873
   GDB can also use  in another way: to partition lengthy output,
874
in a way similar to the common utility `more' (*note Screen size:
875
Screen Size.).  Since it is easy to press one  too many in this
876
situation, GDB disables command repetition after any command that
877
generates this sort of display.
878
 
879
   Any text from a `#' to the end of the line is a comment; it does
880
nothing.  This is useful mainly in command files (*note Command files:
881
Command Files.).
882
 
883

884
File: gdb.info,  Node: Completion,  Next: Help,  Prev: Command Syntax,  Up: Commands
885
 
886
Command completion
887
==================
888
 
889
   GDB can fill in the rest of a word in a command for you, if there is
890
only one possibility; it can also show you what the valid possibilities
891
are for the next word in a command, at any time.  This works for GDB
892
commands, GDB subcommands, and the names of symbols in your program.
893
 
894
   Press the  key whenever you want GDB to fill out the rest of a
895
word.  If there is only one possibility, GDB fills in the word, and
896
waits for you to finish the command (or press  to enter it).  For
897
example, if you type
898
 
899
     (gdb) info bre 
900
 
901
GDB fills in the rest of the word `breakpoints', since that is the only
902
`info' subcommand beginning with `bre':
903
 
904
     (gdb) info breakpoints
905
 
906
You can either press  at this point, to run the `info breakpoints'
907
command, or backspace and enter something else, if `breakpoints' does
908
not look like the command you expected.  (If you were sure you wanted
909
`info breakpoints' in the first place, you might as well just type
910
 immediately after `info bre', to exploit command abbreviations
911
rather than command completion).
912
 
913
   If there is more than one possibility for the next word when you
914
press , GDB sounds a bell.  You can either supply more characters
915
and try again, or just press  a second time; GDB displays all the
916
possible completions for that word.  For example, you might want to set
917
a breakpoint on a subroutine whose name begins with `make_', but when
918
you type `b make_' GDB just sounds the bell.  Typing  again
919
displays all the function names in your program that begin with those
920
characters, for example:
921
 
922
     (gdb) b make_ 
923
GDB sounds bell; press  again, to see:
924
     make_a_section_from_file     make_environ
925
     make_abs_section             make_function_type
926
     make_blockvector             make_pointer_type
927
     make_cleanup                 make_reference_type
928
     make_command                 make_symbol_completion_list
929
     (gdb) b make_
930
 
931
After displaying the available possibilities, GDB copies your partial
932
input (`b make_' in the example) so you can finish the command.
933
 
934
   If you just want to see the list of alternatives in the first place,
935
you can press `M-?' rather than pressing  twice. `M-?' means
936
` ?'.  You can type this either by holding down a key designated
937
as the  shift on your keyboard (if there is one) while typing
938
`?', or as  followed by `?'.
939
 
940
   Sometimes the string you need, while logically a "word", may contain
941
parentheses or other characters that GDB normally excludes from its
942
notion of a word.  To permit word completion to work in this situation,
943
you may enclose words in `'' (single quote marks) in GDB commands.
944
 
945
   The most likely situation where you might need this is in typing the
946
name of a C++ function.  This is because C++ allows function overloading
947
(multiple definitions of the same function, distinguished by argument
948
type).  For example, when you want to set a breakpoint you may need to
949
distinguish whether you mean the version of `name' that takes an `int'
950
parameter, `name(int)', or the version that takes a `float' parameter,
951
`name(float)'.  To use the word-completion facilities in this
952
situation, type a single quote `'' at the beginning of the function
953
name.  This alerts GDB that it may need to consider more information
954
than usual when you press  or `M-?' to request word completion:
955
 
956
     (gdb) b 'bubble( M-?
957
     bubble(double,double)    bubble(int,int)
958
     (gdb) b 'bubble(
959
 
960
   In some cases, GDB can tell that completing a name requires using
961
quotes.  When this happens, GDB inserts the quote for you (while
962
completing as much as it can) if you do not type the quote in the first
963
place:
964
 
965
     (gdb) b bub 
966
GDB alters your input line to the following, and rings a bell:
967
     (gdb) b 'bubble(
968
 
969
In general, GDB can tell that a quote is needed (and inserts it) if you
970
have not yet started typing the argument list when you ask for
971
completion on an overloaded symbol.
972
 
973
   For more information about overloaded functions, see *Note C++
974
expressions: C plus plus expressions.  You can use the command `set
975
overload-resolution off' to disable overload resolution; see *Note GDB
976
features for C++: Debugging C plus plus.
977
 
978

979
File: gdb.info,  Node: Help,  Prev: Completion,  Up: Commands
980
 
981
Getting help
982
============
983
 
984
   You can always ask GDB itself for information on its commands, using
985
the command `help'.
986
 
987
`help'
988
`h'
989
     You can use `help' (abbreviated `h') with no arguments to display
990
     a short list of named classes of commands:
991
 
992
          (gdb) help
993
          List of classes of commands:
994
 
995
          aliases -- Aliases of other commands
996
          breakpoints -- Making program stop at certain points
997
          data -- Examining data
998
          files -- Specifying and examining files
999
          internals -- Maintenance commands
1000
          obscure -- Obscure features
1001
          running -- Running the program
1002
          stack -- Examining the stack
1003
          status -- Status inquiries
1004
          support -- Support facilities
1005
          tracepoints -- Tracing of program execution without
1006
 
1007
          stopping the program
1008
          user-defined -- User-defined commands
1009
 
1010
          Type "help" followed by a class name for a list of
1011
          commands in that class.
1012
          Type "help" followed by command name for full
1013
          documentation.
1014
          Command name abbreviations are allowed if unambiguous.
1015
          (gdb)
1016
 
1017
`help CLASS'
1018
     Using one of the general help classes as an argument, you can get a
1019
     list of the individual commands in that class.  For example, here
1020
     is the help display for the class `status':
1021
 
1022
          (gdb) help status
1023
          Status inquiries.
1024
 
1025
          List of commands:
1026
 
1027
          info -- Generic command for showing things
1028
           about the program being debugged
1029
          show -- Generic command for showing things
1030
           about the debugger
1031
 
1032
          Type "help" followed by command name for full
1033
          documentation.
1034
          Command name abbreviations are allowed if unambiguous.
1035
          (gdb)
1036
 
1037
`help COMMAND'
1038
     With a command name as `help' argument, GDB displays a short
1039
     paragraph on how to use that command.
1040
 
1041
`apropos ARGS'
1042
     The `apropos ARGS' command searches through all of the GDB
1043
     commands, and their documentation, for the regular expression
1044
     specified in ARGS. It prints out all matches found. For example:
1045
 
1046
          apropos reload
1047
 
1048
     results in:
1049
 
1050
          set symbol-reloading -- Set dynamic symbol table reloading
1051
                                           multiple times in one run
1052
          show symbol-reloading -- Show dynamic symbol table reloading
1053
                                           multiple times in one run
1054
 
1055
`complete ARGS'
1056
     The `complete ARGS' command lists all the possible completions for
1057
     the beginning of a command.  Use ARGS to specify the beginning of
1058
     the command you want completed.  For example:
1059
 
1060
          complete i
1061
 
1062
     results in:
1063
 
1064
          if
1065
          ignore
1066
          info
1067
          inspect
1068
 
1069
     This is intended for use by GNU Emacs.
1070
 
1071
   In addition to `help', you can use the GDB commands `info' and
1072
`show' to inquire about the state of your program, or the state of GDB
1073
itself.  Each command supports many topics of inquiry; this manual
1074
introduces each of them in the appropriate context.  The listings under
1075
`info' and under `show' in the Index point to all the sub-commands.
1076
*Note Index::.
1077
 
1078
`info'
1079
     This command (abbreviated `i') is for describing the state of your
1080
     program.  For example, you can list the arguments given to your
1081
     program with `info args', list the registers currently in use with
1082
     `info registers', or list the breakpoints you have set with `info
1083
     breakpoints'.  You can get a complete list of the `info'
1084
     sub-commands with `help info'.
1085
 
1086
`set'
1087
     You can assign the result of an expression to an environment
1088
     variable with `set'.  For example, you can set the GDB prompt to a
1089
     $-sign with `set prompt $'.
1090
 
1091
`show'
1092
     In contrast to `info', `show' is for describing the state of GDB
1093
     itself.  You can change most of the things you can `show', by
1094
     using the related command `set'; for example, you can control what
1095
     number system is used for displays with `set radix', or simply
1096
     inquire which is currently in use with `show radix'.
1097
 
1098
     To display all the settable parameters and their current values,
1099
     you can use `show' with no arguments; you may also use `info set'.
1100
     Both commands produce the same display.
1101
 
1102
   Here are three miscellaneous `show' subcommands, all of which are
1103
exceptional in lacking corresponding `set' commands:
1104
 
1105
`show version'
1106
     Show what version of GDB is running.  You should include this
1107
     information in GDB bug-reports.  If multiple versions of GDB are
1108
     in use at your site, you may need to determine which version of
1109
     GDB you are running; as GDB evolves, new commands are introduced,
1110
     and old ones may wither away.  Also, many system vendors ship
1111
     variant versions of GDB, and there are variant versions of GDB in
1112
     GNU/Linux distributions as well.  The version number is the same
1113
     as the one announced when you start GDB.
1114
 
1115
`show copying'
1116
     Display information about permission for copying GDB.
1117
 
1118
`show warranty'
1119
     Display the GNU "NO WARRANTY" statement, or a warranty, if your
1120
     version of GDB comes with one.
1121
 
1122

1123
File: gdb.info,  Node: Running,  Next: Stopping,  Prev: Commands,  Up: Top
1124
 
1125
Running Programs Under GDB
1126
**************************
1127
 
1128
   When you run a program under GDB, you must first generate debugging
1129
information when you compile it.
1130
 
1131
   You may start GDB with its arguments, if any, in an environment of
1132
your choice.  If you are doing native debugging, you may redirect your
1133
program's input and output, debug an already running process, or kill a
1134
child process.
1135
 
1136
* Menu:
1137
 
1138
* Compilation::                 Compiling for debugging
1139
* Starting::                    Starting your program
1140
* Arguments::                   Your program's arguments
1141
* Environment::                 Your program's environment
1142
 
1143
* Working Directory::           Your program's working directory
1144
* Input/Output::                Your program's input and output
1145
* Attach::                      Debugging an already-running process
1146
* Kill Process::                Killing the child process
1147
 
1148
* Threads::                     Debugging programs with multiple threads
1149
* Processes::                   Debugging programs with multiple processes
1150
 
1151

1152
File: gdb.info,  Node: Compilation,  Next: Starting,  Up: Running
1153
 
1154
Compiling for debugging
1155
=======================
1156
 
1157
   In order to debug a program effectively, you need to generate
1158
debugging information when you compile it.  This debugging information
1159
is stored in the object file; it describes the data type of each
1160
variable or function and the correspondence between source line numbers
1161
and addresses in the executable code.
1162
 
1163
   To request debugging information, specify the `-g' option when you
1164
run the compiler.
1165
 
1166
   Many C compilers are unable to handle the `-g' and `-O' options
1167
together.  Using those compilers, you cannot generate optimized
1168
executables containing debugging information.
1169
 
1170
   GCC, the GNU C compiler, supports `-g' with or without `-O', making
1171
it possible to debug optimized code.  We recommend that you _always_
1172
use `-g' whenever you compile a program.  You may think your program is
1173
correct, but there is no sense in pushing your luck.
1174
 
1175
   When you debug a program compiled with `-g -O', remember that the
1176
optimizer is rearranging your code; the debugger shows you what is
1177
really there.  Do not be too surprised when the execution path does not
1178
exactly match your source file!  An extreme example: if you define a
1179
variable, but never use it, GDB never sees that variable--because the
1180
compiler optimizes it out of existence.
1181
 
1182
   Some things do not work as well with `-g -O' as with just `-g',
1183
particularly on machines with instruction scheduling.  If in doubt,
1184
recompile with `-g' alone, and if this fixes the problem, please report
1185
it to us as a bug (including a test case!).
1186
 
1187
   Older versions of the GNU C compiler permitted a variant option
1188
`-gg' for debugging information.  GDB no longer supports this format;
1189
if your GNU C compiler has this option, do not use it.
1190
 
1191

1192
File: gdb.info,  Node: Starting,  Next: Arguments,  Prev: Compilation,  Up: Running
1193
 
1194
Starting your program
1195
=====================
1196
 
1197
`run'
1198
`r'
1199
     Use the `run' command to start your program under GDB.  You must
1200
     first specify the program name (except on VxWorks) with an
1201
     argument to GDB (*note Getting In and Out of GDB: Invocation.), or
1202
     by using the `file' or `exec-file' command (*note Commands to
1203
     specify files: Files.).
1204
 
1205
   If you are running your program in an execution environment that
1206
supports processes, `run' creates an inferior process and makes that
1207
process run your program.  (In environments without processes, `run'
1208
jumps to the start of your program.)
1209
 
1210
   The execution of a program is affected by certain information it
1211
receives from its superior.  GDB provides ways to specify this
1212
information, which you must do _before_ starting your program.  (You
1213
can change it after starting your program, but such changes only affect
1214
your program the next time you start it.)  This information may be
1215
divided into four categories:
1216
 
1217
The _arguments._
1218
     Specify the arguments to give your program as the arguments of the
1219
     `run' command.  If a shell is available on your target, the shell
1220
     is used to pass the arguments, so that you may use normal
1221
     conventions (such as wildcard expansion or variable substitution)
1222
     in describing the arguments.  In Unix systems, you can control
1223
     which shell is used with the `SHELL' environment variable.  *Note
1224
     Your program's arguments: Arguments.
1225
 
1226
The _environment._
1227
     Your program normally inherits its environment from GDB, but you
1228
     can use the GDB commands `set environment' and `unset environment'
1229
     to change parts of the environment that affect your program.
1230
     *Note Your program's environment: Environment.
1231
 
1232
The _working directory._
1233
     Your program inherits its working directory from GDB.  You can set
1234
     the GDB working directory with the `cd' command in GDB.  *Note
1235
     Your program's working directory: Working Directory.
1236
 
1237
The _standard input and output._
1238
     Your program normally uses the same device for standard input and
1239
     standard output as GDB is using.  You can redirect input and output
1240
     in the `run' command line, or you can use the `tty' command to set
1241
     a different device for your program.  *Note Your program's input
1242
     and output: Input/Output.
1243
 
1244
     _Warning:_ While input and output redirection work, you cannot use
1245
     pipes to pass the output of the program you are debugging to
1246
     another program; if you attempt this, GDB is likely to wind up
1247
     debugging the wrong program.
1248
 
1249
   When you issue the `run' command, your program begins to execute
1250
immediately.  *Note Stopping and continuing: Stopping, for discussion
1251
of how to arrange for your program to stop.  Once your program has
1252
stopped, you may call functions in your program, using the `print' or
1253
`call' commands.  *Note Examining Data: Data.
1254
 
1255
   If the modification time of your symbol file has changed since the
1256
last time GDB read its symbols, GDB discards its symbol table, and
1257
reads it again.  When it does this, GDB tries to retain your current
1258
breakpoints.
1259
 
1260

1261
File: gdb.info,  Node: Arguments,  Next: Environment,  Prev: Starting,  Up: Running
1262
 
1263
Your program's arguments
1264
========================
1265
 
1266
   The arguments to your program can be specified by the arguments of
1267
the `run' command.  They are passed to a shell, which expands wildcard
1268
characters and performs redirection of I/O, and thence to your program.
1269
Your `SHELL' environment variable (if it exists) specifies what shell
1270
GDB uses.  If you do not define `SHELL', GDB uses the default shell
1271
(`/bin/sh' on Unix).
1272
 
1273
   On non-Unix systems, the program is usually invoked directly by GDB,
1274
which emulates I/O redirection via the appropriate system calls, and
1275
the wildcard characters are expanded by the startup code of the
1276
program, not by the shell.
1277
 
1278
   `run' with no arguments uses the same arguments used by the previous
1279
`run', or those set by the `set args' command.
1280
 
1281
`set args'
1282
     Specify the arguments to be used the next time your program is
1283
     run.  If `set args' has no arguments, `run' executes your program
1284
     with no arguments.  Once you have run your program with arguments,
1285
     using `set args' before the next `run' is the only way to run it
1286
     again without arguments.
1287
 
1288
`show args'
1289
     Show the arguments to give your program when it is started.
1290
 

powered by: WebSVN 2.1.0

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