1 This is gdb.info, produced by makeinfo version 4.8 from
2 ../../../../toolchain/android-toolchain/gdb-6.6/gdb/doc/gdb.texinfo.
4 INFO-DIR-SECTION Software development
6 * Gdb: (gdb). The GNU debugger.
9 This file documents the GNU debugger GDB.
11 This is the Ninth Edition, of `Debugging with GDB: the GNU
12 Source-Level Debugger' for GDB Version 6.6.
14 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
16 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
17 Free Software Foundation, Inc.
19 Permission is granted to copy, distribute and/or modify this document
20 under the terms of the GNU Free Documentation License, Version 1.1 or
21 any later version published by the Free Software Foundation; with the
22 Invariant Sections being "Free Software" and "Free Software Needs Free
23 Documentation", with the Front-Cover Texts being "A GNU Manual," and
24 with the Back-Cover Texts as in (a) below.
26 (a) The Free Software Foundation's Back-Cover Text is: "You have
27 freedom to copy and modify this GNU Manual, like GNU software. Copies
28 published by the Free Software Foundation raise funds for GNU
32 File: gdb.info, Node: Top, Next: Summary, Prev: (dir), Up: (dir)
37 This file describes GDB, the GNU symbolic debugger.
39 This is the Ninth Edition, for GDB Version 6.6.
41 Copyright (C) 1988-2006 Free Software Foundation, Inc.
45 * Summary:: Summary of GDB
46 * Sample Session:: A sample GDB session
48 * Invocation:: Getting in and out of GDB
49 * Commands:: GDB commands
50 * Running:: Running programs under GDB
51 * Stopping:: Stopping and continuing
52 * Stack:: Examining the stack
53 * Source:: Examining source files
54 * Data:: Examining data
55 * Macros:: Preprocessor Macros
56 * Tracepoints:: Debugging remote targets non-intrusively
57 * Overlays:: Debugging programs that use overlays
59 * Languages:: Using GDB with different languages
61 * Symbols:: Examining the symbol table
62 * Altering:: Altering execution
63 * GDB Files:: GDB files
64 * Targets:: Specifying a debugging target
65 * Remote Debugging:: Debugging remote programs
66 * Configurations:: Configuration-specific information
67 * Controlling GDB:: Controlling GDB
68 * Sequences:: Canned sequences of commands
69 * TUI:: GDB Text User Interface
70 * Interpreters:: Command Interpreters
71 * Emacs:: Using GDB under GNU Emacs
72 * Annotations:: GDB's annotation interface.
73 * GDB/MI:: GDB's Machine Interface.
75 * GDB Bugs:: Reporting bugs in GDB
76 * Formatting Documentation:: How to format and print GDB documentation
78 * Command Line Editing:: Command Line Editing
79 * Using History Interactively:: Using History Interactively
80 * Installing GDB:: Installing GDB
81 * Maintenance Commands:: Maintenance Commands
82 * Remote Protocol:: GDB Remote Serial Protocol
83 * Agent Expressions:: The GDB Agent Expression Mechanism
84 * Copying:: GNU General Public License says
85 how you can copy and share GDB
86 * GNU Free Documentation License:: The license for this documentation
90 File: gdb.info, Node: Summary, Next: Sample Session, Prev: Top, Up: Top
95 The purpose of a debugger such as GDB is to allow you to see what is
96 going on "inside" another program while it executes--or what another
97 program was doing at the moment it crashed.
99 GDB can do four main kinds of things (plus other things in support of
100 these) to help you catch bugs in the act:
102 * Start your program, specifying anything that might affect its
105 * Make your program stop on specified conditions.
107 * Examine what has happened, when your program has stopped.
109 * Change things in your program, so you can experiment with
110 correcting the effects of one bug and go on to learn about another.
112 You can use GDB to debug programs written in C and C++. For more
113 information, see *Note Supported languages: Supported languages. For
114 more information, see *Note C and C++: C.
116 Support for Modula-2 is partial. For information on Modula-2, see
117 *Note Modula-2: Modula-2.
119 Debugging Pascal programs which use sets, subranges, file variables,
120 or nested functions does not currently work. GDB does not support
121 entering expressions, printing values, or similar features using Pascal
124 GDB can be used to debug programs written in Fortran, although it
125 may be necessary to refer to some variables with a trailing underscore.
127 GDB can be used to debug programs written in Objective-C, using
128 either the Apple/NeXT or the GNU Objective-C runtime.
132 * Free Software:: Freely redistributable software
133 * Contributors:: Contributors to GDB
136 File: gdb.info, Node: Free Software, Next: Contributors, Up: Summary
141 GDB is "free software", protected by the GNU General Public License
142 (GPL). The GPL gives you the freedom to copy or adapt a licensed
143 program--but every person getting a copy also gets with it the freedom
144 to modify that copy (which means that they must get access to the
145 source code), and the freedom to distribute further copies. Typical
146 software companies use copyrights to limit your freedoms; the Free
147 Software Foundation uses the GPL to preserve these freedoms.
149 Fundamentally, the General Public License is a license which says
150 that you have these freedoms and that you cannot take these freedoms
151 away from anyone else.
153 Free Software Needs Free Documentation
154 ======================================
156 The biggest deficiency in the free software community today is not in
157 the software--it is the lack of good free documentation that we can
158 include with the free software. Many of our most important programs do
159 not come with free reference manuals and free introductory texts.
160 Documentation is an essential part of any software package; when an
161 important free software package does not come with a free manual and a
162 free tutorial, that is a major gap. We have many such gaps today.
164 Consider Perl, for instance. The tutorial manuals that people
165 normally use are non-free. How did this come about? Because the
166 authors of those manuals published them with restrictive terms--no
167 copying, no modification, source files not available--which exclude
168 them from the free software world.
170 That wasn't the first time this sort of thing happened, and it was
171 far from the last. Many times we have heard a GNU user eagerly
172 describe a manual that he is writing, his intended contribution to the
173 community, only to learn that he had ruined everything by signing a
174 publication contract to make it non-free.
176 Free documentation, like free software, is a matter of freedom, not
177 price. The problem with the non-free manual is not that publishers
178 charge a price for printed copies--that in itself is fine. (The Free
179 Software Foundation sells printed copies of manuals, too.) The problem
180 is the restrictions on the use of the manual. Free manuals are
181 available in source code form, and give you permission to copy and
182 modify. Non-free manuals do not allow this.
184 The criteria of freedom for a free manual are roughly the same as for
185 free software. Redistribution (including the normal kinds of
186 commercial redistribution) must be permitted, so that the manual can
187 accompany every copy of the program, both on-line and on paper.
189 Permission for modification of the technical content is crucial too.
190 When people modify the software, adding or changing features, if they
191 are conscientious they will change the manual too--so they can provide
192 accurate and clear documentation for the modified program. A manual
193 that leaves you no choice but to write a new manual to document a
194 changed version of the program is not really available to our community.
196 Some kinds of limits on the way modification is handled are
197 acceptable. For example, requirements to preserve the original
198 author's copyright notice, the distribution terms, or the list of
199 authors, are ok. It is also no problem to require modified versions to
200 include notice that they were modified. Even entire sections that may
201 not be deleted or changed are acceptable, as long as they deal with
202 nontechnical topics (like this one). These kinds of restrictions are
203 acceptable because they don't obstruct the community's normal use of
206 However, it must be possible to modify all the _technical_ content
207 of the manual, and then distribute the result in all the usual media,
208 through all the usual channels. Otherwise, the restrictions obstruct
209 the use of the manual, it is not free, and we need another manual to
212 Please spread the word about this issue. Our community continues to
213 lose manuals to proprietary publishing. If we spread the word that
214 free software needs free reference manuals and free tutorials, perhaps
215 the next person who wants to contribute by writing documentation will
216 realize, before it is too late, that only free manuals contribute to
217 the free software community.
219 If you are writing documentation, please insist on publishing it
220 under the GNU Free Documentation License or another free documentation
221 license. Remember that this decision requires your approval--you don't
222 have to let the publisher decide. Some commercial publishers will use
223 a free license if you insist, but they will not propose the option; it
224 is up to you to raise the issue and say firmly that this is what you
225 want. If the publisher you are dealing with refuses, please try other
226 publishers. If you're not sure whether a proposed license is free,
227 write to <licensing@gnu.org>.
229 You can encourage commercial publishers to sell more free, copylefted
230 manuals and tutorials by buying them, and particularly by buying copies
231 from the publishers that paid for their writing or for major
232 improvements. Meanwhile, try to avoid buying non-free documentation at
233 all. Check the distribution terms of a manual before you buy it, and
234 insist that whoever seeks your business must respect your freedom.
235 Check the history of the book, and try to reward the publishers that
236 have paid or pay the authors to work on it.
238 The Free Software Foundation maintains a list of free documentation
239 published by other publishers, at
240 `http://www.fsf.org/doc/other-free-books.html'.
243 File: gdb.info, Node: Contributors, Prev: Free Software, Up: Summary
248 Richard Stallman was the original author of GDB, and of many other GNU
249 programs. Many others have contributed to its development. This
250 section attempts to credit major contributors. One of the virtues of
251 free software is that everyone is free to contribute to it; with
252 regret, we cannot actually acknowledge everyone here. The file
253 `ChangeLog' in the GDB distribution approximates a blow-by-blow account.
255 Changes much prior to version 2.0 are lost in the mists of time.
257 _Plea:_ Additions to this section are particularly welcome. If you
258 or your friends (or enemies, to be evenhanded) have been unfairly
259 omitted from this list, we would like to add your names!
261 So that they may not regard their many labors as thankless, we
262 particularly thank those who shepherded GDB through major releases:
263 Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0, 5.3, 5.2, 5.1 and 5.0); Jim
264 Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs
265 (release 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10,
266 and 4.9); Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5,
267 and 4.4); John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim
268 Kingdon (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2,
271 Richard Stallman, assisted at various times by Peter TerMaat, Chris
272 Hanson, and Richard Mlynarik, handled releases through 2.8.
274 Michael Tiemann is the author of most of the GNU C++ support in GDB,
275 with significant additional contributions from Per Bothner and Daniel
276 Berlin. James Clark wrote the GNU C++ demangler. Early work on C++
277 was by Peter TerMaat (who also did much general update work leading to
280 GDB uses the BFD subroutine library to examine multiple object-file
281 formats; BFD was a joint project of David V. Henkel-Wallace, Rich
282 Pixley, Steve Chamberlain, and John Gilmore.
284 David Johnson wrote the original COFF support; Pace Willison did the
285 original support for encapsulated COFF.
287 Brent Benson of Harris Computer Systems contributed DWARF 2 support.
289 Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
290 Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
291 support. Jean-Daniel Fekete contributed Sun 386i support. Chris
292 Hanson improved the HP9000 support. Noboyuki Hikichi and Tomoyuki
293 Hasei contributed Sony/News OS 3 support. David Johnson contributed
294 Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support.
295 Jeff Law contributed HP PA and SOM support. Keith Packard contributed
296 NS32K support. Doug Rabson contributed Acorn Risc Machine support.
297 Bob Rusk contributed Harris Nighthawk CX-UX support. Chris Smith
298 contributed Convex support (and Fortran debugging). Jonathan Stone
299 contributed Pyramid support. Michael Tiemann contributed SPARC support.
300 Tim Tucker contributed support for the Gould NP1 and Gould Powernode.
301 Pace Willison contributed Intel 386 support. Jay Vosburgh contributed
302 Symmetry support. Marko Mlinar contributed OpenRISC 1000 support.
304 Andreas Schwab contributed M68K GNU/Linux support.
306 Rich Schaefer and Peter Schauer helped with support of SunOS shared
309 Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
310 several machine instruction sets.
312 Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
313 develop remote debugging. Intel Corporation, Wind River Systems, AMD,
314 and ARM contributed remote debugging modules for the i960, VxWorks,
315 A29K UDI, and RDI targets, respectively.
317 Brian Fox is the author of the readline libraries providing
318 command-line editing and command history.
320 Andrew Beers of SUNY Buffalo wrote the language-switching code, the
321 Modula-2 support, and contributed the Languages chapter of this manual.
323 Fred Fish wrote most of the support for Unix System Vr4. He also
324 enhanced the command-completion support to cover C++ overloaded symbols.
326 Hitachi America (now Renesas America), Ltd. sponsored the support for
327 H8/300, H8/500, and Super-H processors.
329 NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx
332 Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and
335 Toshiba sponsored the support for the TX39 Mips processor.
337 Matsushita sponsored the support for the MN10200 and MN10300
340 Fujitsu sponsored the support for SPARClite and FR30 processors.
342 Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
345 Michael Snyder added support for tracepoints.
347 Stu Grossman wrote gdbserver.
349 Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly
350 innumerable bug fixes and cleanups throughout GDB.
352 The following people at the Hewlett-Packard Company contributed
353 support for the PA-RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0
354 (narrow mode), HP's implementation of kernel threads, HP's aC++
355 compiler, and the Text User Interface (nee Terminal User Interface):
356 Ben Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann,
357 Satish Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase
358 provided HP-specific information in this manual.
360 DJ Delorie ported GDB to MS-DOS, for the DJGPP project. Robert
361 Hoehne made significant contributions to the DJGPP port.
363 Cygnus Solutions has sponsored GDB maintenance and much of its
364 development since 1991. Cygnus engineers who have worked on GDB
365 fulltime include Mark Alexander, Jim Blandy, Per Bothner, Kevin
366 Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin Hunt, Jim
367 Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
368 Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek
369 Radouch, Keith Seitz, Stan Shebs, David Taylor, and Elena Zannoni. In
370 addition, Dave Brolley, Ian Carmichael, Steve Chamberlain, Nick Clifton,
371 JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank Eigler, Doug
372 Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff
373 Holcomb, Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner,
374 Jason Merrill, Catherine Moore, Drew Moseley, Ken Raeburn, Gavin
375 Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela
376 Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David
377 Zuhn have made contributions both large and small.
379 Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for
380 Cygnus Solutions, implemented the original GDB/MI interface.
382 Jim Blandy added support for preprocessor macros, while working for
385 Andrew Cagney designed GDB's architecture vector. Many people
386 including Andrew Cagney, Stephane Carrez, Randolph Chung, Nick Duffek,
387 Richard Henderson, Mark Kettenis, Grace Sainsbury, Kei Sakamoto,
388 Yoshinori Sato, Michael Snyder, Andreas Schwab, Jason Thorpe, Corinna
389 Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the migration
390 of old architectures to this new framework.
392 Andrew Cagney completely re-designed and re-implemented GDB's
393 unwinder framework, this consisting of a fresh new design featuring
394 frame IDs, independent frame sniffers, and the sentinel frame. Mark
395 Kettenis implemented the DWARF 2 unwinder, Jeff Johnston the libunwind
396 unwinder, and Andrew Cagney the dummy, sentinel, tramp, and trad
397 unwinders. The architecture specific changes, each involving a
398 complete rewrite of the architecture's frame code, were carried out by
399 Jim Blandy, Joel Brobecker, Kevin Buettner, Andrew Cagney, Stephane
400 Carrez, Randolph Chung, Orjan Friberg, Richard Henderson, Daniel
401 Jacobowitz, Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei
402 Sakamoto, Yoshinori Sato, Michael Snyder, Corinna Vinschen, and Ulrich
405 Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from
406 Tensilica, Inc. contributed support for Xtensa processors. Others who
407 have worked on the Xtensa port of GDB in the past include Steve Tjiang,
408 John Newlin, and Scott Foehner.
411 File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
413 1 A Sample GDB Session
414 **********************
416 You can use this manual at your leisure to read all about GDB.
417 However, a handful of commands are enough to get started using the
418 debugger. This chapter illustrates those commands.
420 One of the preliminary versions of GNU `m4' (a generic macro
421 processor) exhibits the following bug: sometimes, when we change its
422 quote strings from the default, the commands used to capture one macro
423 definition within another stop working. In the following short `m4'
424 session, we define a macro `foo' which expands to `0000'; we then use
425 the `m4' built-in `defn' to define `bar' as the same thing. However,
426 when we change the open quote string to `<QUOTE>' and the close quote
427 string to `<UNQUOTE>', the same procedure fails to define a new synonym
436 define(bar,defn(`foo'))
440 changequote(<QUOTE>,<UNQUOTE>)
442 define(baz,defn(<QUOTE>foo<UNQUOTE>))
445 m4: End of input: 0: fatal error: EOF in string
447 Let us use GDB to try to see what is going on.
450 GDB is free software and you are welcome to distribute copies
451 of it under certain conditions; type "show copying" to see
453 There is absolutely no warranty for GDB; type "show warranty"
456 GDB 6.6, Copyright 1999 Free Software Foundation, Inc...
459 GDB reads only enough symbol data to know where to find the rest when
460 needed; as a result, the first prompt comes up very quickly. We now
461 tell GDB to use a narrower display width than usual, so that examples
466 We need to see how the `m4' built-in `changequote' works. Having
467 looked at the source, we know the relevant subroutine is
468 `m4_changequote', so we set a breakpoint there with the GDB `break'
471 (gdb) break m4_changequote
472 Breakpoint 1 at 0x62f4: file builtin.c, line 879.
474 Using the `run' command, we start `m4' running under GDB control; as
475 long as control does not reach the `m4_changequote' subroutine, the
476 program runs as usual:
479 Starting program: /work/Editorial/gdb/gnu/m4/m4
485 To trigger the breakpoint, we call `changequote'. GDB suspends
486 execution of `m4', displaying information about the context where it
489 changequote(<QUOTE>,<UNQUOTE>)
491 Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
493 879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
495 Now we use the command `n' (`next') to advance execution to the next
496 line of the current function.
499 882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
502 `set_quotes' looks like a promising subroutine. We can go into it by
503 using the command `s' (`step') instead of `next'. `step' goes to the
504 next line to be executed in _any_ subroutine, so it steps into
508 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
510 530 if (lquote != def_lquote)
512 The display that shows the subroutine where `m4' is now suspended (and
513 its arguments) is called a stack frame display. It shows a summary of
514 the stack. We can use the `backtrace' command (which can also be
515 spelled `bt'), to see where we are in the stack as a whole: the
516 `backtrace' command displays a stack frame for each active subroutine.
519 #0 set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
521 #1 0x6344 in m4_changequote (argc=3, argv=0x33c70)
523 #2 0x8174 in expand_macro (sym=0x33320) at macro.c:242
524 #3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
526 #4 0x79dc in expand_input () at macro.c:40
527 #5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
529 We step through a few more lines to see what happens. The first two
530 times, we can use `s'; the next two times we use `n' to avoid falling
531 into the `xstrdup' subroutine.
534 0x3b5c 532 if (rquote != def_rquote)
536 0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \
537 def_lquote : xstrdup(lq);
539 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
542 538 len_lquote = strlen(rquote);
544 The last line displayed looks a little odd; we can examine the variables
545 `lquote' and `rquote' to see if they are in fact the new left and right
546 quotes we specified. We use the command `p' (`print') to see their
550 $1 = 0x35d40 "<QUOTE>"
552 $2 = 0x35d50 "<UNQUOTE>"
554 `lquote' and `rquote' are indeed the new left and right quotes. To
555 look at some context, we can display ten lines of source surrounding
556 the current line with the `l' (`list') command.
561 535 lquote = (lq == nil || *lq == '\0') ? def_lquote\
563 536 rquote = (rq == nil || *rq == '\0') ? def_rquote\
566 538 len_lquote = strlen(rquote);
567 539 len_rquote = strlen(lquote);
572 Let us step past the two lines that set `len_lquote' and `len_rquote',
573 and then examine the values of those variables.
576 539 len_rquote = strlen(lquote);
584 That certainly looks wrong, assuming `len_lquote' and `len_rquote' are
585 meant to be the lengths of `lquote' and `rquote' respectively. We can
586 set them to better values using the `p' command, since it can print the
587 value of any expression--and that expression can include subroutine
588 calls and assignments.
590 (gdb) p len_lquote=strlen(lquote)
592 (gdb) p len_rquote=strlen(rquote)
595 Is that enough to fix the problem of using the new quotes with the `m4'
596 built-in `defn'? We can allow `m4' to continue executing with the `c'
597 (`continue') command, and then try the example that caused trouble
603 define(baz,defn(<QUOTE>foo<UNQUOTE>))
608 Success! The new quotes now work just as well as the default ones. The
609 problem seems to have been just the two typos defining the wrong
610 lengths. We allow `m4' exit by giving it an EOF as input:
613 Program exited normally.
615 The message `Program exited normally.' is from GDB; it indicates `m4'
616 has finished executing. We can end our GDB session with the GDB `quit'
622 File: gdb.info, Node: Invocation, Next: Commands, Prev: Sample Session, Up: Top
624 2 Getting In and Out of GDB
625 ***************************
627 This chapter discusses how to start GDB, and how to get out of it. The
629 * type `gdb' to start GDB.
631 * type `quit' or `Ctrl-d' to exit.
635 * Invoking GDB:: How to start GDB
636 * Quitting GDB:: How to quit GDB
637 * Shell Commands:: How to use shell commands inside GDB
638 * Logging output:: How to log GDB's output to a file
641 File: gdb.info, Node: Invoking GDB, Next: Quitting GDB, Up: Invocation
646 Invoke GDB by running the program `gdb'. Once started, GDB reads
647 commands from the terminal until you tell it to exit.
649 You can also run `gdb' with a variety of arguments and options, to
650 specify more of your debugging environment at the outset.
652 The command-line options described here are designed to cover a
653 variety of situations; in some environments, some of these options may
654 effectively be unavailable.
656 The most usual way to start GDB is with one argument, specifying an
661 You can also start with both an executable program and a core file
666 You can, instead, specify a process ID as a second argument, if you
667 want to debug a running process:
671 would attach GDB to process `1234' (unless you also have a file named
672 `1234'; GDB does check for a core file first).
674 Taking advantage of the second command-line argument requires a
675 fairly complete operating system; when you use GDB as a remote debugger
676 attached to a bare board, there may not be any notion of "process", and
677 there is often no way to get a core dump. GDB will warn you if it is
678 unable to attach or to read core dumps.
680 You can optionally have `gdb' pass any arguments after the
681 executable file to the inferior using `--args'. This option stops
683 gdb --args gcc -O2 -c foo.c
684 This will cause `gdb' to debug `gcc', and to set `gcc''s
685 command-line arguments (*note Arguments::) to `-O2 -c foo.c'.
687 You can run `gdb' without printing the front material, which
688 describes GDB's non-warranty, by specifying `-silent':
692 You can further control how GDB starts up by using command-line
693 options. GDB itself can remind you of the options available.
699 to display all available options and briefly describe their use (`gdb
700 -h' is a shorter equivalent).
702 All options and command line arguments you give are processed in
703 sequential order. The order makes a difference when the `-x' option is
708 * File Options:: Choosing files
709 * Mode Options:: Choosing modes
710 * Startup:: What GDB does during startup
713 File: gdb.info, Node: File Options, Next: Mode Options, Up: Invoking GDB
718 When GDB starts, it reads any arguments other than options as
719 specifying an executable file and core file (or process ID). This is
720 the same as if the arguments were specified by the `-se' and `-c' (or
721 `-p' options respectively. (GDB reads the first argument that does not
722 have an associated option flag as equivalent to the `-se' option
723 followed by that argument; and the second argument that does not have
724 an associated option flag, if any, as equivalent to the `-c'/`-p'
725 option followed by that argument.) If the second argument begins with
726 a decimal digit, GDB will first attempt to attach to it as a process,
727 and if that fails, attempt to open it as a corefile. If you have a
728 corefile whose name begins with a digit, you can prevent GDB from
729 treating it as a pid by prefixing it with `./', e.g. `./12345'.
731 If GDB has not been configured to included core file support, such
732 as for most embedded targets, then it will complain about a second
733 argument and ignore it.
735 Many options have both long and short forms; both are shown in the
736 following list. GDB also recognizes the long forms if you truncate
737 them, so long as enough of the option is present to be unambiguous.
738 (If you prefer, you can flag option arguments with `--' rather than
739 `-', though we illustrate the more usual convention.)
743 Read symbol table from file FILE.
747 Use file FILE as the executable file to execute when appropriate,
748 and for examining pure data in conjunction with a core dump.
751 Read symbol table from file FILE and use it as the executable file.
755 Use file FILE as a core dump to examine.
761 Connect to process ID NUMBER, as with the `attach' command. If
762 there is no such process, GDB will attempt to open a core file
767 Execute GDB commands from file FILE. *Note Command files: Command
770 `-eval-command COMMAND'
772 Execute a single GDB command.
774 This option may be used multiple times to call multiple commands.
775 It may also be interleaved with `-command' as required.
777 gdb -ex 'target sim' -ex 'load' \
778 -x setbreakpoints -ex 'run' a.out
780 `-directory DIRECTORY'
782 Add DIRECTORY to the path to search for source and script files.
786 Read each symbol file's entire symbol table immediately, rather
787 than the default, which is to read it incrementally as it is
788 needed. This makes startup slower, but makes future operations
793 File: gdb.info, Node: Mode Options, Next: Startup, Prev: File Options, Up: Invoking GDB
798 You can run GDB in various alternative modes--for example, in batch
803 Do not execute commands found in any initialization files.
804 Normally, GDB executes the commands in these files after all the
805 command options and arguments have been processed. *Note Command
806 files: Command Files.
811 "Quiet". Do not print the introductory and copyright messages.
812 These messages are also suppressed in batch mode.
815 Run in batch mode. Exit with status `0' after processing all the
816 command files specified with `-x' (and all commands from
817 initialization files, if not inhibited with `-n'). Exit with
818 nonzero status if an error occurs in executing the GDB commands in
821 Batch mode may be useful for running GDB as a filter, for example
822 to download and run a program on another computer; in order to
823 make this more useful, the message
825 Program exited normally.
827 (which is ordinarily issued whenever a program running under GDB
828 control terminates) is not issued when running in batch mode.
831 Run in batch mode exactly like `-batch', but totally silently. All
832 GDB output to `stdout' is prevented (`stderr' is unaffected).
833 This is much quieter than `-silent' and would be useless for an
836 This is particularly useful when using targets that give `Loading
837 section' messages, for example.
839 Note that targets that give their output via GDB, as opposed to
840 writing directly to `stdout', will also be made silent.
842 `-return-child-result'
843 The return code from GDB will be the return code from the child
844 process (the process being debugged), with the following
847 * GDB exits abnormally. E.g., due to an incorrect argument or
848 an internal error. In this case the exit code is the same as
849 it would have been without `-return-child-result'.
851 * The user quits with an explicit value. E.g., `quit 1'.
853 * The child process never runs, or is not allowed to terminate,
854 in which case the exit code will be -1.
856 This option is useful in conjunction with `-batch' or
857 `-batch-silent', when GDB is being used as a remote program loader
858 or simulator interface.
862 "No windows". If GDB comes with a graphical user interface (GUI)
863 built in, then this option tells GDB to only use the command-line
864 interface. If no GUI is available, this option has no effect.
868 If GDB includes a GUI, then this option requires it to be used if
872 Run GDB using DIRECTORY as its working directory, instead of the
877 GNU Emacs sets this option when it runs GDB as a subprocess. It
878 tells GDB to output the full file name and line number in a
879 standard, recognizable fashion each time a stack frame is
880 displayed (which includes each time your program stops). This
881 recognizable format looks like two `\032' characters, followed by
882 the file name, line number and character position separated by
883 colons, and a newline. The Emacs-to-GDB interface program uses
884 the two `\032' characters as a signal to display the source code
888 The Epoch Emacs-GDB interface sets this option when it runs GDB as
889 a subprocess. It tells GDB to modify its print routines so as to
890 allow Epoch to display values of expressions in a separate window.
893 This option sets the "annotation level" inside GDB. Its effect is
894 identical to using `set annotate LEVEL' (*note Annotations::).
895 The annotation LEVEL controls how much information GDB prints
896 together with its prompt, values of expressions, source lines, and
897 other types of output. Level 0 is the normal, level 1 is for use
898 when GDB is run as a subprocess of GNU Emacs, level 3 is the
899 maximum annotation suitable for programs that control GDB, and
900 level 2 has been deprecated.
902 The annotation mechanism has largely been superseded by GDB/MI
906 Change interpretation of command line so that arguments following
907 the executable file are passed as command line arguments to the
908 inferior. This option stops option processing.
912 Set the line speed (baud rate or bits per second) of any serial
913 interface used by GDB for remote debugging.
916 Set the timeout (in seconds) of any communication used by GDB for
921 Run using DEVICE for your program's standard input and output.
924 Activate the "Text User Interface" when starting. The Text User
925 Interface manages several text windows on the terminal, showing
926 source, assembly, registers and GDB command outputs (*note GDB
927 Text User Interface: TUI.). Alternatively, the Text User
928 Interface can be enabled by invoking the program `gdbtui'. Do not
929 use this option if you run GDB from Emacs (*note Using GDB under
932 `-interpreter INTERP'
933 Use the interpreter INTERP for interface with the controlling
934 program or device. This option is meant to be set by programs
935 which communicate with GDB using it as a back end. *Note Command
936 Interpreters: Interpreters.
938 `--interpreter=mi' (or `--interpreter=mi2') causes GDB to use the
939 "GDB/MI interface" (*note The GDB/MI Interface: GDB/MI.) included
940 since GDB version 6.0. The previous GDB/MI interface, included in
941 GDB version 5.3 and selected with `--interpreter=mi1', is
942 deprecated. Earlier GDB/MI interfaces are no longer supported.
945 Open the executable and core files for both reading and writing.
946 This is equivalent to the `set write on' command inside GDB (*note
950 This option causes GDB to print statistics about time and memory
951 usage after it completes each command and returns to the prompt.
954 This option causes GDB to print its version number and no-warranty
959 File: gdb.info, Node: Startup, Prev: Mode Options, Up: Invoking GDB
961 2.1.3 What GDB does during startup
962 ----------------------------------
964 Here's the description of what GDB does during session startup:
966 1. Sets up the command interpreter as specified by the command line
967 (*note interpreter: Mode Options.).
969 2. Reads the "init file" (if any) in your home directory(1) and
970 executes all the commands in that file.
972 3. Processes command line options and operands.
974 4. Reads and executes the commands from init file (if any) in the
975 current working directory. This is only done if the current
976 directory is different from your home directory. Thus, you can
977 have more than one init file, one generic in your home directory,
978 and another, specific to the program you are debugging, in the
979 directory where you invoke GDB.
981 5. Reads command files specified by the `-x' option. *Note Command
982 Files::, for more details about GDB command files.
984 6. Reads the command history recorded in the "history file". *Note
985 Command History::, for more details about the command history and
986 the files where GDB records it.
988 Init files use the same syntax as "command files" (*note Command
989 Files::) and are processed by GDB in the same way. The init file in
990 your home directory can set options (such as `set complaints') that
991 affect subsequent processing of command line options and operands.
992 Init files are not executed if you use the `-nx' option (*note Choosing
993 modes: Mode Options.).
995 The GDB init files are normally called `.gdbinit'. On some
996 configurations of GDB, the init file is known by a different name
997 (these are typically environments where a specialized form of GDB may
998 need to coexist with other forms, hence a different name for the
999 specialized version's init file). These are the environments with
1000 special init file names:
1002 * The DJGPP port of GDB uses the name `gdb.ini', due to the
1003 limitations of file names imposed by DOS filesystems. The Windows
1004 ports of GDB use the standard name, but if they find a `gdb.ini'
1005 file, they warn you about that and suggest to rename the file to
1008 * VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
1010 * OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
1012 * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
1014 * CISCO 68k: `.cisco-gdbinit'
1016 ---------- Footnotes ----------
1018 (1) On DOS/Windows systems, the home directory is the one pointed to
1019 by the `HOME' environment variable.
1022 File: gdb.info, Node: Quitting GDB, Next: Shell Commands, Prev: Invoking GDB, Up: Invocation
1029 To exit GDB, use the `quit' command (abbreviated `q'), or type an
1030 end-of-file character (usually `Ctrl-d'). If you do not supply
1031 EXPRESSION, GDB will terminate normally; otherwise it will
1032 terminate using the result of EXPRESSION as the error code.
1034 An interrupt (often `Ctrl-c') does not exit from GDB, but rather
1035 terminates the action of any GDB command that is in progress and
1036 returns to GDB command level. It is safe to type the interrupt
1037 character at any time because GDB does not allow it to take effect
1038 until a time when it is safe.
1040 If you have been using GDB to control an attached process or device,
1041 you can release it with the `detach' command (*note Debugging an
1042 already-running process: Attach.).
1045 File: gdb.info, Node: Shell Commands, Next: Logging output, Prev: Quitting GDB, Up: Invocation
1050 If you need to execute occasional shell commands during your debugging
1051 session, there is no need to leave or suspend GDB; you can just use the
1054 `shell COMMAND STRING'
1055 Invoke a standard shell to execute COMMAND STRING. If it exists,
1056 the environment variable `SHELL' determines which shell to run.
1057 Otherwise GDB uses the default shell (`/bin/sh' on Unix systems,
1058 `COMMAND.COM' on MS-DOS, etc.).
1060 The utility `make' is often needed in development environments. You
1061 do not have to use the `shell' command for this purpose in GDB:
1064 Execute the `make' program with the specified arguments. This is
1065 equivalent to `shell make MAKE-ARGS'.
1068 File: gdb.info, Node: Logging output, Prev: Shell Commands, Up: Invocation
1073 You may want to save the output of GDB commands to a file. There are
1074 several commands to control GDB's logging.
1082 `set logging file FILE'
1083 Change the name of the current logfile. The default logfile is
1086 `set logging overwrite [on|off]'
1087 By default, GDB will append to the logfile. Set `overwrite' if
1088 you want `set logging on' to overwrite the logfile instead.
1090 `set logging redirect [on|off]'
1091 By default, GDB output will go to both the terminal and the
1092 logfile. Set `redirect' if you want output to go only to the log
1096 Show the current values of the logging settings.
1099 File: gdb.info, Node: Commands, Next: Running, Prev: Invocation, Up: Top
1104 You can abbreviate a GDB command to the first few letters of the command
1105 name, if that abbreviation is unambiguous; and you can repeat certain
1106 GDB commands by typing just <RET>. You can also use the <TAB> key to
1107 get GDB to fill out the rest of a word in a command (or to show you the
1108 alternatives available, if there is more than one possibility).
1112 * Command Syntax:: How to give commands to GDB
1113 * Completion:: Command completion
1114 * Help:: How to ask GDB for help
1117 File: gdb.info, Node: Command Syntax, Next: Completion, Up: Commands
1122 A GDB command is a single line of input. There is no limit on how long
1123 it can be. It starts with a command name, which is followed by
1124 arguments whose meaning depends on the command name. For example, the
1125 command `step' accepts an argument which is the number of times to
1126 step, as in `step 5'. You can also use the `step' command with no
1127 arguments. Some commands do not allow any arguments.
1129 GDB command names may always be truncated if that abbreviation is
1130 unambiguous. Other possible command abbreviations are listed in the
1131 documentation for individual commands. In some cases, even ambiguous
1132 abbreviations are allowed; for example, `s' is specially defined as
1133 equivalent to `step' even though there are other commands whose names
1134 start with `s'. You can test abbreviations by using them as arguments
1135 to the `help' command.
1137 A blank line as input to GDB (typing just <RET>) means to repeat the
1138 previous command. Certain commands (for example, `run') will not
1139 repeat this way; these are commands whose unintentional repetition
1140 might cause trouble and which you are unlikely to want to repeat.
1141 User-defined commands can disable this feature; see *Note dont-repeat:
1144 The `list' and `x' commands, when you repeat them with <RET>,
1145 construct new arguments rather than repeating exactly as typed. This
1146 permits easy scanning of source or memory.
1148 GDB can also use <RET> in another way: to partition lengthy output,
1149 in a way similar to the common utility `more' (*note Screen size:
1150 Screen Size.). Since it is easy to press one <RET> too many in this
1151 situation, GDB disables command repetition after any command that
1152 generates this sort of display.
1154 Any text from a `#' to the end of the line is a comment; it does
1155 nothing. This is useful mainly in command files (*note Command files:
1158 The `Ctrl-o' binding is useful for repeating a complex sequence of
1159 commands. This command accepts the current line, like <RET>, and then
1160 fetches the next line relative to the current line from the history for
1164 File: gdb.info, Node: Completion, Next: Help, Prev: Command Syntax, Up: Commands
1166 3.2 Command completion
1167 ======================
1169 GDB can fill in the rest of a word in a command for you, if there is
1170 only one possibility; it can also show you what the valid possibilities
1171 are for the next word in a command, at any time. This works for GDB
1172 commands, GDB subcommands, and the names of symbols in your program.
1174 Press the <TAB> key whenever you want GDB to fill out the rest of a
1175 word. If there is only one possibility, GDB fills in the word, and
1176 waits for you to finish the command (or press <RET> to enter it). For
1177 example, if you type
1179 (gdb) info bre <TAB>
1181 GDB fills in the rest of the word `breakpoints', since that is the only
1182 `info' subcommand beginning with `bre':
1184 (gdb) info breakpoints
1186 You can either press <RET> at this point, to run the `info breakpoints'
1187 command, or backspace and enter something else, if `breakpoints' does
1188 not look like the command you expected. (If you were sure you wanted
1189 `info breakpoints' in the first place, you might as well just type
1190 <RET> immediately after `info bre', to exploit command abbreviations
1191 rather than command completion).
1193 If there is more than one possibility for the next word when you
1194 press <TAB>, GDB sounds a bell. You can either supply more characters
1195 and try again, or just press <TAB> a second time; GDB displays all the
1196 possible completions for that word. For example, you might want to set
1197 a breakpoint on a subroutine whose name begins with `make_', but when
1198 you type `b make_<TAB>' GDB just sounds the bell. Typing <TAB> again
1199 displays all the function names in your program that begin with those
1200 characters, for example:
1203 GDB sounds bell; press <TAB> again, to see:
1204 make_a_section_from_file make_environ
1205 make_abs_section make_function_type
1206 make_blockvector make_pointer_type
1207 make_cleanup make_reference_type
1208 make_command make_symbol_completion_list
1211 After displaying the available possibilities, GDB copies your partial
1212 input (`b make_' in the example) so you can finish the command.
1214 If you just want to see the list of alternatives in the first place,
1215 you can press `M-?' rather than pressing <TAB> twice. `M-?' means
1216 `<META> ?'. You can type this either by holding down a key designated
1217 as the <META> shift on your keyboard (if there is one) while typing
1218 `?', or as <ESC> followed by `?'.
1220 Sometimes the string you need, while logically a "word", may contain
1221 parentheses or other characters that GDB normally excludes from its
1222 notion of a word. To permit word completion to work in this situation,
1223 you may enclose words in `'' (single quote marks) in GDB commands.
1225 The most likely situation where you might need this is in typing the
1226 name of a C++ function. This is because C++ allows function
1227 overloading (multiple definitions of the same function, distinguished
1228 by argument type). For example, when you want to set a breakpoint you
1229 may need to distinguish whether you mean the version of `name' that
1230 takes an `int' parameter, `name(int)', or the version that takes a
1231 `float' parameter, `name(float)'. To use the word-completion
1232 facilities in this situation, type a single quote `'' at the beginning
1233 of the function name. This alerts GDB that it may need to consider
1234 more information than usual when you press <TAB> or `M-?' to request
1237 (gdb) b 'bubble( M-?
1238 bubble(double,double) bubble(int,int)
1241 In some cases, GDB can tell that completing a name requires using
1242 quotes. When this happens, GDB inserts the quote for you (while
1243 completing as much as it can) if you do not type the quote in the first
1247 GDB alters your input line to the following, and rings a bell:
1250 In general, GDB can tell that a quote is needed (and inserts it) if you
1251 have not yet started typing the argument list when you ask for
1252 completion on an overloaded symbol.
1254 For more information about overloaded functions, see *Note C++
1255 expressions: C plus plus expressions. You can use the command `set
1256 overload-resolution off' to disable overload resolution; see *Note GDB
1257 features for C++: Debugging C plus plus.
1260 File: gdb.info, Node: Help, Prev: Completion, Up: Commands
1265 You can always ask GDB itself for information on its commands, using
1270 You can use `help' (abbreviated `h') with no arguments to display
1271 a short list of named classes of commands:
1274 List of classes of commands:
1276 aliases -- Aliases of other commands
1277 breakpoints -- Making program stop at certain points
1278 data -- Examining data
1279 files -- Specifying and examining files
1280 internals -- Maintenance commands
1281 obscure -- Obscure features
1282 running -- Running the program
1283 stack -- Examining the stack
1284 status -- Status inquiries
1285 support -- Support facilities
1286 tracepoints -- Tracing of program execution without
1288 stopping the program
1289 user-defined -- User-defined commands
1291 Type "help" followed by a class name for a list of
1292 commands in that class.
1293 Type "help" followed by command name for full
1295 Command name abbreviations are allowed if unambiguous.
1299 Using one of the general help classes as an argument, you can get a
1300 list of the individual commands in that class. For example, here
1301 is the help display for the class `status':
1308 info -- Generic command for showing things
1309 about the program being debugged
1310 show -- Generic command for showing things
1313 Type "help" followed by command name for full
1315 Command name abbreviations are allowed if unambiguous.
1319 With a command name as `help' argument, GDB displays a short
1320 paragraph on how to use that command.
1323 The `apropos' command searches through all of the GDB commands,
1324 and their documentation, for the regular expression specified in
1325 ARGS. It prints out all matches found. For example:
1331 set symbol-reloading -- Set dynamic symbol table reloading
1332 multiple times in one run
1333 show symbol-reloading -- Show dynamic symbol table reloading
1334 multiple times in one run
1337 The `complete ARGS' command lists all the possible completions for
1338 the beginning of a command. Use ARGS to specify the beginning of
1339 the command you want completed. For example:
1350 This is intended for use by GNU Emacs.
1352 In addition to `help', you can use the GDB commands `info' and
1353 `show' to inquire about the state of your program, or the state of GDB
1354 itself. Each command supports many topics of inquiry; this manual
1355 introduces each of them in the appropriate context. The listings under
1356 `info' and under `show' in the Index point to all the sub-commands.
1360 This command (abbreviated `i') is for describing the state of your
1361 program. For example, you can list the arguments given to your
1362 program with `info args', list the registers currently in use with
1363 `info registers', or list the breakpoints you have set with `info
1364 breakpoints'. You can get a complete list of the `info'
1365 sub-commands with `help info'.
1368 You can assign the result of an expression to an environment
1369 variable with `set'. For example, you can set the GDB prompt to a
1370 $-sign with `set prompt $'.
1373 In contrast to `info', `show' is for describing the state of GDB
1374 itself. You can change most of the things you can `show', by
1375 using the related command `set'; for example, you can control what
1376 number system is used for displays with `set radix', or simply
1377 inquire which is currently in use with `show radix'.
1379 To display all the settable parameters and their current values,
1380 you can use `show' with no arguments; you may also use `info set'.
1381 Both commands produce the same display.
1383 Here are three miscellaneous `show' subcommands, all of which are
1384 exceptional in lacking corresponding `set' commands:
1387 Show what version of GDB is running. You should include this
1388 information in GDB bug-reports. If multiple versions of GDB are
1389 in use at your site, you may need to determine which version of
1390 GDB you are running; as GDB evolves, new commands are introduced,
1391 and old ones may wither away. Also, many system vendors ship
1392 variant versions of GDB, and there are variant versions of GDB in
1393 GNU/Linux distributions as well. The version number is the same
1394 as the one announced when you start GDB.
1398 Display information about permission for copying GDB.
1402 Display the GNU "NO WARRANTY" statement, or a warranty, if your
1403 version of GDB comes with one.
1407 File: gdb.info, Node: Running, Next: Stopping, Prev: Commands, Up: Top
1409 4 Running Programs Under GDB
1410 ****************************
1412 When you run a program under GDB, you must first generate debugging
1413 information when you compile it.
1415 You may start GDB with its arguments, if any, in an environment of
1416 your choice. If you are doing native debugging, you may redirect your
1417 program's input and output, debug an already running process, or kill a
1422 * Compilation:: Compiling for debugging
1423 * Starting:: Starting your program
1424 * Arguments:: Your program's arguments
1425 * Environment:: Your program's environment
1427 * Working Directory:: Your program's working directory
1428 * Input/Output:: Your program's input and output
1429 * Attach:: Debugging an already-running process
1430 * Kill Process:: Killing the child process
1432 * Threads:: Debugging programs with multiple threads
1433 * Processes:: Debugging programs with multiple processes
1434 * Checkpoint/Restart:: Setting a _bookmark_ to return to later
1437 File: gdb.info, Node: Compilation, Next: Starting, Up: Running
1439 4.1 Compiling for debugging
1440 ===========================
1442 In order to debug a program effectively, you need to generate debugging
1443 information when you compile it. This debugging information is stored
1444 in the object file; it describes the data type of each variable or
1445 function and the correspondence between source line numbers and
1446 addresses in the executable code.
1448 To request debugging information, specify the `-g' option when you
1451 Programs that are to be shipped to your customers are compiled with
1452 optimizations, using the `-O' compiler option. However, many compilers
1453 are unable to handle the `-g' and `-O' options together. Using those
1454 compilers, you cannot generate optimized executables containing
1455 debugging information.
1457 GCC, the GNU C/C++ compiler, supports `-g' with or without `-O',
1458 making it possible to debug optimized code. We recommend that you
1459 _always_ use `-g' whenever you compile a program. You may think your
1460 program is correct, but there is no sense in pushing your luck.
1462 When you debug a program compiled with `-g -O', remember that the
1463 optimizer is rearranging your code; the debugger shows you what is
1464 really there. Do not be too surprised when the execution path does not
1465 exactly match your source file! An extreme example: if you define a
1466 variable, but never use it, GDB never sees that variable--because the
1467 compiler optimizes it out of existence.
1469 Some things do not work as well with `-g -O' as with just `-g',
1470 particularly on machines with instruction scheduling. If in doubt,
1471 recompile with `-g' alone, and if this fixes the problem, please report
1472 it to us as a bug (including a test case!). *Note Variables::, for
1473 more information about debugging optimized code.
1475 Older versions of the GNU C compiler permitted a variant option
1476 `-gg' for debugging information. GDB no longer supports this format;
1477 if your GNU C compiler has this option, do not use it.
1479 GDB knows about preprocessor macros and can show you their expansion
1480 (*note Macros::). Most compilers do not include information about
1481 preprocessor macros in the debugging information if you specify the
1482 `-g' flag alone, because this information is rather large. Version 3.1
1483 and later of GCC, the GNU C compiler, provides macro information if you
1484 specify the options `-gdwarf-2' and `-g3'; the former option requests
1485 debugging information in the Dwarf 2 format, and the latter requests
1486 "extra information". In the future, we hope to find more compact ways
1487 to represent macro information, so that it can be included with `-g'
1491 File: gdb.info, Node: Starting, Next: Arguments, Prev: Compilation, Up: Running
1493 4.2 Starting your program
1494 =========================
1498 Use the `run' command to start your program under GDB. You must
1499 first specify the program name (except on VxWorks) with an
1500 argument to GDB (*note Getting In and Out of GDB: Invocation.), or
1501 by using the `file' or `exec-file' command (*note Commands to
1502 specify files: Files.).
1505 If you are running your program in an execution environment that
1506 supports processes, `run' creates an inferior process and makes that
1507 process run your program. (In environments without processes, `run'
1508 jumps to the start of your program.)
1510 The execution of a program is affected by certain information it
1511 receives from its superior. GDB provides ways to specify this
1512 information, which you must do _before_ starting your program. (You
1513 can change it after starting your program, but such changes only affect
1514 your program the next time you start it.) This information may be
1515 divided into four categories:
1518 Specify the arguments to give your program as the arguments of the
1519 `run' command. If a shell is available on your target, the shell
1520 is used to pass the arguments, so that you may use normal
1521 conventions (such as wildcard expansion or variable substitution)
1522 in describing the arguments. In Unix systems, you can control
1523 which shell is used with the `SHELL' environment variable. *Note
1524 Your program's arguments: Arguments.
1527 Your program normally inherits its environment from GDB, but you
1528 can use the GDB commands `set environment' and `unset environment'
1529 to change parts of the environment that affect your program.
1530 *Note Your program's environment: Environment.
1532 The _working directory._
1533 Your program inherits its working directory from GDB. You can set
1534 the GDB working directory with the `cd' command in GDB. *Note
1535 Your program's working directory: Working Directory.
1537 The _standard input and output._
1538 Your program normally uses the same device for standard input and
1539 standard output as GDB is using. You can redirect input and output
1540 in the `run' command line, or you can use the `tty' command to set
1541 a different device for your program. *Note Your program's input
1542 and output: Input/Output.
1544 _Warning:_ While input and output redirection work, you cannot use
1545 pipes to pass the output of the program you are debugging to
1546 another program; if you attempt this, GDB is likely to wind up
1547 debugging the wrong program.
1549 When you issue the `run' command, your program begins to execute
1550 immediately. *Note Stopping and continuing: Stopping, for discussion
1551 of how to arrange for your program to stop. Once your program has
1552 stopped, you may call functions in your program, using the `print' or
1553 `call' commands. *Note Examining Data: Data.
1555 If the modification time of your symbol file has changed since the
1556 last time GDB read its symbols, GDB discards its symbol table, and
1557 reads it again. When it does this, GDB tries to retain your current
1561 The name of the main procedure can vary from language to language.
1562 With C or C++, the main procedure name is always `main', but other
1563 languages such as Ada do not require a specific name for their
1564 main procedure. The debugger provides a convenient way to start
1565 the execution of the program and to stop at the beginning of the
1566 main procedure, depending on the language used.
1568 The `start' command does the equivalent of setting a temporary
1569 breakpoint at the beginning of the main procedure and then invoking
1572 Some programs contain an "elaboration" phase where some startup
1573 code is executed before the main procedure is called. This
1574 depends on the languages used to write your program. In C++, for
1575 instance, constructors for static and global objects are executed
1576 before `main' is called. It is therefore possible that the
1577 debugger stops before reaching the main procedure. However, the
1578 temporary breakpoint will remain to halt execution.
1580 Specify the arguments to give to your program as arguments to the
1581 `start' command. These arguments will be given verbatim to the
1582 underlying `run' command. Note that the same arguments will be
1583 reused if no argument is provided during subsequent calls to
1586 It is sometimes necessary to debug the program during elaboration.
1587 In these cases, using the `start' command would stop the
1588 execution of your program too late, as the program would have
1589 already completed the elaboration phase. Under these
1590 circumstances, insert breakpoints in your elaboration code before
1591 running your program.
1594 File: gdb.info, Node: Arguments, Next: Environment, Prev: Starting, Up: Running
1596 4.3 Your program's arguments
1597 ============================
1599 The arguments to your program can be specified by the arguments of the
1600 `run' command. They are passed to a shell, which expands wildcard
1601 characters and performs redirection of I/O, and thence to your program.
1602 Your `SHELL' environment variable (if it exists) specifies what shell
1603 GDB uses. If you do not define `SHELL', GDB uses the default shell
1604 (`/bin/sh' on Unix).
1606 On non-Unix systems, the program is usually invoked directly by GDB,
1607 which emulates I/O redirection via the appropriate system calls, and
1608 the wildcard characters are expanded by the startup code of the
1609 program, not by the shell.
1611 `run' with no arguments uses the same arguments used by the previous
1612 `run', or those set by the `set args' command.
1615 Specify the arguments to be used the next time your program is
1616 run. If `set args' has no arguments, `run' executes your program
1617 with no arguments. Once you have run your program with arguments,
1618 using `set args' before the next `run' is the only way to run it
1619 again without arguments.
1622 Show the arguments to give your program when it is started.
1625 File: gdb.info, Node: Environment, Next: Working Directory, Prev: Arguments, Up: Running
1627 4.4 Your program's environment
1628 ==============================
1630 The "environment" consists of a set of environment variables and their
1631 values. Environment variables conventionally record such things as
1632 your user name, your home directory, your terminal type, and your search
1633 path for programs to run. Usually you set up environment variables with
1634 the shell and they are inherited by all the other programs you run.
1635 When debugging, it can be useful to try running your program with a
1636 modified environment without having to start GDB over again.
1639 Add DIRECTORY to the front of the `PATH' environment variable (the
1640 search path for executables) that will be passed to your program.
1641 The value of `PATH' used by GDB does not change. You may specify
1642 several directory names, separated by whitespace or by a
1643 system-dependent separator character (`:' on Unix, `;' on MS-DOS
1644 and MS-Windows). If DIRECTORY is already in the path, it is moved
1645 to the front, so it is searched sooner.
1647 You can use the string `$cwd' to refer to whatever is the current
1648 working directory at the time GDB searches the path. If you use
1649 `.' instead, it refers to the directory where you executed the
1650 `path' command. GDB replaces `.' in the DIRECTORY argument (with
1651 the current path) before adding DIRECTORY to the search path.
1654 Display the list of search paths for executables (the `PATH'
1655 environment variable).
1657 `show environment [VARNAME]'
1658 Print the value of environment variable VARNAME to be given to
1659 your program when it starts. If you do not supply VARNAME, print
1660 the names and values of all environment variables to be given to
1661 your program. You can abbreviate `environment' as `env'.
1663 `set environment VARNAME [=VALUE]'
1664 Set environment variable VARNAME to VALUE. The value changes for
1665 your program only, not for GDB itself. VALUE may be any string;
1666 the values of environment variables are just strings, and any
1667 interpretation is supplied by your program itself. The VALUE
1668 parameter is optional; if it is eliminated, the variable is set to
1671 For example, this command:
1675 tells the debugged program, when subsequently run, that its user
1676 is named `foo'. (The spaces around `=' are used for clarity here;
1677 they are not actually required.)
1679 `unset environment VARNAME'
1680 Remove variable VARNAME from the environment to be passed to your
1681 program. This is different from `set env VARNAME ='; `unset
1682 environment' removes the variable from the environment, rather
1683 than assigning it an empty value.
1685 _Warning:_ On Unix systems, GDB runs your program using the shell
1686 indicated by your `SHELL' environment variable if it exists (or
1687 `/bin/sh' if not). If your `SHELL' variable names a shell that runs an
1688 initialization file--such as `.cshrc' for C-shell, or `.bashrc' for
1689 BASH--any variables you set in that file affect your program. You may
1690 wish to move setting of environment variables to files that are only
1691 run when you sign on, such as `.login' or `.profile'.
1694 File: gdb.info, Node: Working Directory, Next: Input/Output, Prev: Environment, Up: Running
1696 4.5 Your program's working directory
1697 ====================================
1699 Each time you start your program with `run', it inherits its working
1700 directory from the current working directory of GDB. The GDB working
1701 directory is initially whatever it inherited from its parent process
1702 (typically the shell), but you can specify a new working directory in
1703 GDB with the `cd' command.
1705 The GDB working directory also serves as a default for the commands
1706 that specify files for GDB to operate on. *Note Commands to specify
1710 Set the GDB working directory to DIRECTORY.
1713 Print the GDB working directory.
1715 It is generally impossible to find the current working directory of
1716 the process being debugged (since a program can change its directory
1717 during its run). If you work on a system where GDB is configured with
1718 the `/proc' support, you can use the `info proc' command (*note SVR4
1719 Process Information::) to find out the current working directory of the
1723 File: gdb.info, Node: Input/Output, Next: Attach, Prev: Working Directory, Up: Running
1725 4.6 Your program's input and output
1726 ===================================
1728 By default, the program you run under GDB does input and output to the
1729 same terminal that GDB uses. GDB switches the terminal to its own
1730 terminal modes to interact with you, but it records the terminal modes
1731 your program was using and switches back to them when you continue
1732 running your program.
1735 Displays information recorded by GDB about the terminal modes your
1738 You can redirect your program's input and/or output using shell
1739 redirection with the `run' command. For example,
1743 starts your program, diverting its output to the file `outfile'.
1745 Another way to specify where your program should do input and output
1746 is with the `tty' command. This command accepts a file name as
1747 argument, and causes this file to be the default for future `run'
1748 commands. It also resets the controlling terminal for the child
1749 process, for future `run' commands. For example,
1753 directs that processes started with subsequent `run' commands default
1754 to do input and output on the terminal `/dev/ttyb' and have that as
1755 their controlling terminal.
1757 An explicit redirection in `run' overrides the `tty' command's
1758 effect on the input/output device, but not its effect on the controlling
1761 When you use the `tty' command or redirect input in the `run'
1762 command, only the input _for your program_ is affected. The input for
1763 GDB still comes from your terminal. `tty' is an alias for `set
1766 You can use the `show inferior-tty' command to tell GDB to display
1767 the name of the terminal that will be used for future runs of your
1770 `set inferior-tty /dev/ttyb'
1771 Set the tty for the program being debugged to /dev/ttyb.
1774 Show the current tty for the program being debugged.
1777 File: gdb.info, Node: Attach, Next: Kill Process, Prev: Input/Output, Up: Running
1779 4.7 Debugging an already-running process
1780 ========================================
1783 This command attaches to a running process--one that was started
1784 outside GDB. (`info files' shows your active targets.) The
1785 command takes as argument a process ID. The usual way to find out
1786 the PROCESS-ID of a Unix process is with the `ps' utility, or with
1787 the `jobs -l' shell command.
1789 `attach' does not repeat if you press <RET> a second time after
1790 executing the command.
1792 To use `attach', your program must be running in an environment
1793 which supports processes; for example, `attach' does not work for
1794 programs on bare-board targets that lack an operating system. You must
1795 also have permission to send the process a signal.
1797 When you use `attach', the debugger finds the program running in the
1798 process first by looking in the current working directory, then (if the
1799 program is not found) by using the source file search path (*note
1800 Specifying source directories: Source Path.). You can also use the
1801 `file' command to load the program. *Note Commands to Specify Files:
1804 The first thing GDB does after arranging to debug the specified
1805 process is to stop it. You can examine and modify an attached process
1806 with all the GDB commands that are ordinarily available when you start
1807 processes with `run'. You can insert breakpoints; you can step and
1808 continue; you can modify storage. If you would rather the process
1809 continue running, you may use the `continue' command after attaching
1813 When you have finished debugging the attached process, you can use
1814 the `detach' command to release it from GDB control. Detaching
1815 the process continues its execution. After the `detach' command,
1816 that process and GDB become completely independent once more, and
1817 you are ready to `attach' another process or start one with `run'.
1818 `detach' does not repeat if you press <RET> again after executing
1821 If you exit GDB or use the `run' command while you have an attached
1822 process, you kill that process. By default, GDB asks for confirmation
1823 if you try to do either of these things; you can control whether or not
1824 you need to confirm by using the `set confirm' command (*note Optional
1825 warnings and messages: Messages/Warnings.).
1828 File: gdb.info, Node: Kill Process, Next: Threads, Prev: Attach, Up: Running
1830 4.8 Killing the child process
1831 =============================
1834 Kill the child process in which your program is running under GDB.
1836 This command is useful if you wish to debug a core dump instead of a
1837 running process. GDB ignores any core dump file while your program is
1840 On some operating systems, a program cannot be executed outside GDB
1841 while you have breakpoints set on it inside GDB. You can use the
1842 `kill' command in this situation to permit running your program outside
1845 The `kill' command is also useful if you wish to recompile and
1846 relink your program, since on many systems it is impossible to modify an
1847 executable file while it is running in a process. In this case, when
1848 you next type `run', GDB notices that the file has changed, and reads
1849 the symbol table again (while trying to preserve your current
1850 breakpoint settings).
1853 File: gdb.info, Node: Threads, Next: Processes, Prev: Kill Process, Up: Running
1855 4.9 Debugging programs with multiple threads
1856 ============================================
1858 In some operating systems, such as HP-UX and Solaris, a single program
1859 may have more than one "thread" of execution. The precise semantics of
1860 threads differ from one operating system to another, but in general the
1861 threads of a single program are akin to multiple processes--except that
1862 they share one address space (that is, they can all examine and modify
1863 the same variables). On the other hand, each thread has its own
1864 registers and execution stack, and perhaps private memory.
1866 GDB provides these facilities for debugging multi-thread programs:
1868 * automatic notification of new threads
1870 * `thread THREADNO', a command to switch among threads
1872 * `info threads', a command to inquire about existing threads
1874 * `thread apply [THREADNO] [ALL] ARGS', a command to apply a command
1875 to a list of threads
1877 * thread-specific breakpoints
1879 _Warning:_ These facilities are not yet available on every GDB
1880 configuration where the operating system supports threads. If
1881 your GDB does not support threads, these commands have no effect.
1882 For example, a system without thread support shows no output from
1883 `info threads', and always rejects the `thread' command, like this:
1887 Thread ID 1 not known. Use the "info threads" command to
1888 see the IDs of currently known threads.
1890 The GDB thread debugging facility allows you to observe all threads
1891 while your program runs--but whenever GDB takes control, one thread in
1892 particular is always the focus of debugging. This thread is called the
1893 "current thread". Debugging commands show program information from the
1894 perspective of the current thread.
1896 Whenever GDB detects a new thread in your program, it displays the
1897 target system's identification for the thread with a message in the
1898 form `[New SYSTAG]'. SYSTAG is a thread identifier whose form varies
1899 depending on the particular system. For example, on LynxOS, you might
1902 [New process 35 thread 27]
1904 when GDB notices a new thread. In contrast, on an SGI system, the
1905 SYSTAG is simply something like `process 368', with no further
1908 For debugging purposes, GDB associates its own thread number--always
1909 a single integer--with each thread in your program.
1912 Display a summary of all threads currently in your program. GDB
1913 displays for each thread (in this order):
1915 1. the thread number assigned by GDB
1917 2. the target system's thread identifier (SYSTAG)
1919 3. the current stack frame summary for that thread
1921 An asterisk `*' to the left of the GDB thread number indicates the
1927 3 process 35 thread 27 0x34e5 in sigpause ()
1928 2 process 35 thread 23 0x34e5 in sigpause ()
1929 * 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
1934 For debugging purposes, GDB associates its own thread number--a
1935 small integer assigned in thread-creation order--with each thread in
1938 Whenever GDB detects a new thread in your program, it displays both
1939 GDB's thread number and the target system's identification for the
1940 thread with a message in the form `[New SYSTAG]'. SYSTAG is a thread
1941 identifier whose form varies depending on the particular system. For
1942 example, on HP-UX, you see
1944 [New thread 2 (system thread 26594)]
1946 when GDB notices a new thread.
1949 Display a summary of all threads currently in your program. GDB
1950 displays for each thread (in this order):
1952 1. the thread number assigned by GDB
1954 2. the target system's thread identifier (SYSTAG)
1956 3. the current stack frame summary for that thread
1958 An asterisk `*' to the left of the GDB thread number indicates the
1964 * 3 system thread 26607 worker (wptr=0x7b09c318 "@") \
1967 2 system thread 26606 0x7b0030d8 in __ksleep () \
1969 from /usr/lib/libc.2
1970 1 system thread 27905 0x7b003498 in _brk () \
1972 from /usr/lib/libc.2
1974 On Solaris, you can display more information about user threads with
1975 a Solaris-specific command:
1977 `maint info sol-threads'
1978 Display info on Solaris user threads.
1981 Make thread number THREADNO the current thread. The command
1982 argument THREADNO is the internal GDB thread number, as shown in
1983 the first field of the `info threads' display. GDB responds by
1984 displaying the system identifier of the thread you selected, and
1985 its current stack frame summary:
1988 [Switching to process 35 thread 23]
1989 0x34e5 in sigpause ()
1991 As with the `[New ...]' message, the form of the text after
1992 `Switching to' depends on your system's conventions for identifying
1995 `thread apply [THREADNO] [ALL] COMMAND'
1996 The `thread apply' command allows you to apply the named COMMAND
1997 to one or more threads. Specify the numbers of the threads that
1998 you want affected with the command argument THREADNO. It can be a
1999 single thread number, one of the numbers shown in the first field
2000 of the `info threads' display; or it could be a range of thread
2001 numbers, as in `2-4'. To apply a command to all threads, type
2002 `thread apply all COMMAND'.
2004 Whenever GDB stops your program, due to a breakpoint or a signal, it
2005 automatically selects the thread where that breakpoint or signal
2006 happened. GDB alerts you to the context switch with a message of the
2007 form `[Switching to SYSTAG]' to identify the thread.
2009 *Note Stopping and starting multi-thread programs: Thread Stops, for
2010 more information about how GDB behaves when you stop and start programs
2011 with multiple threads.
2013 *Note Setting watchpoints: Set Watchpoints, for information about
2014 watchpoints in programs with multiple threads.
2017 File: gdb.info, Node: Processes, Next: Checkpoint/Restart, Prev: Threads, Up: Running
2019 4.10 Debugging programs with multiple processes
2020 ===============================================
2022 On most systems, GDB has no special support for debugging programs
2023 which create additional processes using the `fork' function. When a
2024 program forks, GDB will continue to debug the parent process and the
2025 child process will run unimpeded. If you have set a breakpoint in any
2026 code which the child then executes, the child will get a `SIGTRAP'
2027 signal which (unless it catches the signal) will cause it to terminate.
2029 However, if you want to debug the child process there is a workaround
2030 which isn't too painful. Put a call to `sleep' in the code which the
2031 child process executes after the fork. It may be useful to sleep only
2032 if a certain environment variable is set, or a certain file exists, so
2033 that the delay need not occur when you don't want to run GDB on the
2034 child. While the child is sleeping, use the `ps' program to get its
2035 process ID. Then tell GDB (a new invocation of GDB if you are also
2036 debugging the parent process) to attach to the child process (*note
2037 Attach::). From that point on you can debug the child process just
2038 like any other process which you attached to.
2040 On some systems, GDB provides support for debugging programs that
2041 create additional processes using the `fork' or `vfork' functions.
2042 Currently, the only platforms with this feature are HP-UX (11.x and
2043 later only?) and GNU/Linux (kernel version 2.5.60 and later).
2045 By default, when a program forks, GDB will continue to debug the
2046 parent process and the child process will run unimpeded.
2048 If you want to follow the child process instead of the parent
2049 process, use the command `set follow-fork-mode'.
2051 `set follow-fork-mode MODE'
2052 Set the debugger response to a program call of `fork' or `vfork'.
2053 A call to `fork' or `vfork' creates a new process. The MODE
2057 The original process is debugged after a fork. The child
2058 process runs unimpeded. This is the default.
2061 The new process is debugged after a fork. The parent process
2065 `show follow-fork-mode'
2066 Display the current debugger response to a `fork' or `vfork' call.
2068 On Linux, if you want to debug both the parent and child processes,
2069 use the command `set detach-on-fork'.
2071 `set detach-on-fork MODE'
2072 Tells gdb whether to detach one of the processes after a fork, or
2073 retain debugger control over them both.
2076 The child process (or parent process, depending on the value
2077 of `follow-fork-mode') will be detached and allowed to run
2078 independently. This is the default.
2081 Both processes will be held under the control of GDB. One
2082 process (child or parent, depending on the value of
2083 `follow-fork-mode') is debugged as usual, while the other is
2087 `show detach-on-follow'
2088 Show whether detach-on-follow mode is on/off.
2090 If you choose to set DETACH-ON-FOLLOW mode off, then GDB will retain
2091 control of all forked processes (including nested forks). You can list
2092 the forked processes under the control of GDB by using the `info forks'
2093 command, and switch from one fork to another by using the `fork'
2097 Print a list of all forked processes under the control of GDB.
2098 The listing will include a fork id, a process id, and the current
2099 position (program counter) of the process.
2102 Make fork number FORK-ID the current process. The argument
2103 FORK-ID is the internal fork number assigned by GDB, as shown in
2104 the first field of the `info forks' display.
2107 To quit debugging one of the forked processes, you can either detach
2108 from it by using the `detach fork' command (allowing it to run
2109 independently), or delete (and kill) it using the `delete fork' command.
2111 `detach fork FORK-ID'
2112 Detach from the process identified by GDB fork number FORK-ID, and
2113 remove it from the fork list. The process will be allowed to run
2116 `delete fork FORK-ID'
2117 Kill the process identified by GDB fork number FORK-ID, and remove
2118 it from the fork list.
2121 If you ask to debug a child process and a `vfork' is followed by an
2122 `exec', GDB executes the new target up to the first breakpoint in the
2123 new target. If you have a breakpoint set on `main' in your original
2124 program, the breakpoint will also be set on the child process's `main'.
2126 When a child process is spawned by `vfork', you cannot debug the
2127 child or parent until an `exec' call completes.
2129 If you issue a `run' command to GDB after an `exec' call executes,
2130 the new target restarts. To restart the parent process, use the `file'
2131 command with the parent executable name as its argument.
2133 You can use the `catch' command to make GDB stop whenever a `fork',
2134 `vfork', or `exec' call is made. *Note Setting catchpoints: Set
2138 File: gdb.info, Node: Checkpoint/Restart, Prev: Processes, Up: Running
2140 4.11 Setting a _bookmark_ to return to later
2141 ============================================
2143 On certain operating systems(1), GDB is able to save a "snapshot" of a
2144 program's state, called a "checkpoint", and come back to it later.
2146 Returning to a checkpoint effectively undoes everything that has
2147 happened in the program since the `checkpoint' was saved. This
2148 includes changes in memory, registers, and even (within some limits)
2149 system state. Effectively, it is like going back in time to the moment
2150 when the checkpoint was saved.
2152 Thus, if you're stepping thru a program and you think you're getting
2153 close to the point where things go wrong, you can save a checkpoint.
2154 Then, if you accidentally go too far and miss the critical statement,
2155 instead of having to restart your program from the beginning, you can
2156 just go back to the checkpoint and start again from there.
2158 This can be especially useful if it takes a lot of time or steps to
2159 reach the point where you think the bug occurs.
2161 To use the `checkpoint'/`restart' method of debugging:
2164 Save a snapshot of the debugged program's current execution state.
2165 The `checkpoint' command takes no arguments, but each checkpoint
2166 is assigned a small integer id, similar to a breakpoint id.
2169 List the checkpoints that have been saved in the current debugging
2170 session. For each checkpoint, the following information will be
2179 `Source line, or label'
2181 `restart CHECKPOINT-ID'
2182 Restore the program state that was saved as checkpoint number
2183 CHECKPOINT-ID. All program variables, registers, stack frames
2184 etc. will be returned to the values that they had when the
2185 checkpoint was saved. In essence, gdb will "wind back the clock"
2186 to the point in time when the checkpoint was saved.
2188 Note that breakpoints, GDB variables, command history etc. are
2189 not affected by restoring a checkpoint. In general, a checkpoint
2190 only restores things that reside in the program being debugged,
2191 not in the debugger.
2193 `delete checkpoint CHECKPOINT-ID'
2194 Delete the previously-saved checkpoint identified by CHECKPOINT-ID.
2197 Returning to a previously saved checkpoint will restore the user
2198 state of the program being debugged, plus a significant subset of the
2199 system (OS) state, including file pointers. It won't "un-write" data
2200 from a file, but it will rewind the file pointer to the previous
2201 location, so that the previously written data can be overwritten. For
2202 files opened in read mode, the pointer will also be restored so that the
2203 previously read data can be read again.
2205 Of course, characters that have been sent to a printer (or other
2206 external device) cannot be "snatched back", and characters received
2207 from eg. a serial device can be removed from internal program buffers,
2208 but they cannot be "pushed back" into the serial pipeline, ready to be
2209 received again. Similarly, the actual contents of files that have been
2210 changed cannot be restored (at this time).
2212 However, within those constraints, you actually can "rewind" your
2213 program to a previously saved point in time, and begin debugging it
2214 again -- and you can change the course of events so as to debug a
2215 different execution path this time.
2217 Finally, there is one bit of internal program state that will be
2218 different when you return to a checkpoint -- the program's process id.
2219 Each checkpoint will have a unique process id (or PID), and each will
2220 be different from the program's original PID. If your program has
2221 saved a local copy of its process id, this could potentially pose a
2224 4.11.1 A non-obvious benefit of using checkpoints
2225 -------------------------------------------------
2227 On some systems such as GNU/Linux, address space randomization is
2228 performed on new processes for security reasons. This makes it
2229 difficult or impossible to set a breakpoint, or watchpoint, on an
2230 absolute address if you have to restart the program, since the absolute
2231 location of a symbol will change from one execution to the next.
2233 A checkpoint, however, is an _identical_ copy of a process.
2234 Therefore if you create a checkpoint at (eg.) the start of main, and
2235 simply return to that checkpoint instead of restarting the process, you
2236 can avoid the effects of address randomization and your symbols will
2237 all stay in the same place.
2239 ---------- Footnotes ----------
2241 (1) Currently, only GNU/Linux.
2244 File: gdb.info, Node: Stopping, Next: Stack, Prev: Running, Up: Top
2246 5 Stopping and Continuing
2247 *************************
2249 The principal purposes of using a debugger are so that you can stop your
2250 program before it terminates; or so that, if your program runs into
2251 trouble, you can investigate and find out why.
2253 Inside GDB, your program may stop for any of several reasons, such
2254 as a signal, a breakpoint, or reaching a new line after a GDB command
2255 such as `step'. You may then examine and change variables, set new
2256 breakpoints or remove old ones, and then continue execution. Usually,
2257 the messages shown by GDB provide ample explanation of the status of
2258 your program--but you can also explicitly request this information at
2262 Display information about the status of your program: whether it is
2263 running or not, what process it is, and why it stopped.
2267 * Breakpoints:: Breakpoints, watchpoints, and catchpoints
2268 * Continuing and Stepping:: Resuming execution
2270 * Thread Stops:: Stopping and starting multi-thread programs
2273 File: gdb.info, Node: Breakpoints, Next: Continuing and Stepping, Up: Stopping
2275 5.1 Breakpoints, watchpoints, and catchpoints
2276 =============================================
2278 A "breakpoint" makes your program stop whenever a certain point in the
2279 program is reached. For each breakpoint, you can add conditions to
2280 control in finer detail whether your program stops. You can set
2281 breakpoints with the `break' command and its variants (*note Setting
2282 breakpoints: Set Breaks.), to specify the place where your program
2283 should stop by line number, function name or exact address in the
2286 On some systems, you can set breakpoints in shared libraries before
2287 the executable is run. There is a minor limitation on HP-UX systems:
2288 you must wait until the executable is run in order to set breakpoints
2289 in shared library routines that are not called directly by the program
2290 (for example, routines that are arguments in a `pthread_create' call).
2292 A "watchpoint" is a special breakpoint that stops your program when
2293 the value of an expression changes. The expression may be a value of a
2294 variable, or it could involve values of one or more variables combined
2295 by operators, such as `a + b'. This is sometimes called "data
2296 breakpoints". You must use a different command to set watchpoints
2297 (*note Setting watchpoints: Set Watchpoints.), but aside from that, you
2298 can manage a watchpoint like any other breakpoint: you enable, disable,
2299 and delete both breakpoints and watchpoints using the same commands.
2301 You can arrange to have values from your program displayed
2302 automatically whenever GDB stops at a breakpoint. *Note Automatic
2303 display: Auto Display.
2305 A "catchpoint" is another special breakpoint that stops your program
2306 when a certain kind of event occurs, such as the throwing of a C++
2307 exception or the loading of a library. As with watchpoints, you use a
2308 different command to set a catchpoint (*note Setting catchpoints: Set
2309 Catchpoints.), but aside from that, you can manage a catchpoint like any
2310 other breakpoint. (To stop when your program receives a signal, use the
2311 `handle' command; see *Note Signals: Signals.)
2313 GDB assigns a number to each breakpoint, watchpoint, or catchpoint
2314 when you create it; these numbers are successive integers starting with
2315 one. In many of the commands for controlling various features of
2316 breakpoints you use the breakpoint number to say which breakpoint you
2317 want to change. Each breakpoint may be "enabled" or "disabled"; if
2318 disabled, it has no effect on your program until you enable it again.
2320 Some GDB commands accept a range of breakpoints on which to operate.
2321 A breakpoint range is either a single breakpoint number, like `5', or
2322 two such numbers, in increasing order, separated by a hyphen, like
2323 `5-7'. When a breakpoint range is given to a command, all breakpoint
2324 in that range are operated on.
2328 * Set Breaks:: Setting breakpoints
2329 * Set Watchpoints:: Setting watchpoints
2330 * Set Catchpoints:: Setting catchpoints
2331 * Delete Breaks:: Deleting breakpoints
2332 * Disabling:: Disabling breakpoints
2333 * Conditions:: Break conditions
2334 * Break Commands:: Breakpoint command lists
2335 * Breakpoint Menus:: Breakpoint menus
2336 * Error in Breakpoints:: ``Cannot insert breakpoints''
2337 * Breakpoint related warnings:: ``Breakpoint address adjusted...''
2340 File: gdb.info, Node: Set Breaks, Next: Set Watchpoints, Up: Breakpoints
2342 5.1.1 Setting breakpoints
2343 -------------------------
2345 Breakpoints are set with the `break' command (abbreviated `b'). The
2346 debugger convenience variable `$bpnum' records the number of the
2347 breakpoint you've set most recently; see *Note Convenience variables:
2348 Convenience Vars, for a discussion of what you can do with convenience
2351 You have several ways to say where the breakpoint should go.
2354 Set a breakpoint at entry to function FUNCTION. When using source
2355 languages that permit overloading of symbols, such as C++,
2356 FUNCTION may refer to more than one possible place to break.
2357 *Note Breakpoint menus: Breakpoint Menus, for a discussion of that
2362 Set a breakpoint some number of lines forward or back from the
2363 position at which execution stopped in the currently selected
2364 "stack frame". (*Note Frames: Frames, for a description of stack
2368 Set a breakpoint at line LINENUM in the current source file. The
2369 current source file is the last file whose source text was printed.
2370 The breakpoint will stop your program just before it executes any
2371 of the code on that line.
2373 `break FILENAME:LINENUM'
2374 Set a breakpoint at line LINENUM in source file FILENAME.
2376 `break FILENAME:FUNCTION'
2377 Set a breakpoint at entry to function FUNCTION found in file
2378 FILENAME. Specifying a file name as well as a function name is
2379 superfluous except when multiple files contain similarly named
2383 Set a breakpoint at address ADDRESS. You can use this to set
2384 breakpoints in parts of your program which do not have debugging
2385 information or source files.
2388 When called without any arguments, `break' sets a breakpoint at
2389 the next instruction to be executed in the selected stack frame
2390 (*note Examining the Stack: Stack.). In any selected frame but the
2391 innermost, this makes your program stop as soon as control returns
2392 to that frame. This is similar to the effect of a `finish'
2393 command in the frame inside the selected frame--except that
2394 `finish' does not leave an active breakpoint. If you use `break'
2395 without an argument in the innermost frame, GDB stops the next
2396 time it reaches the current location; this may be useful inside
2399 GDB normally ignores breakpoints when it resumes execution, until
2400 at least one instruction has been executed. If it did not do
2401 this, you would be unable to proceed past a breakpoint without
2402 first disabling the breakpoint. This rule applies whether or not
2403 the breakpoint already existed when your program stopped.
2406 Set a breakpoint with condition COND; evaluate the expression COND
2407 each time the breakpoint is reached, and stop only if the value is
2408 nonzero--that is, if COND evaluates as true. `...' stands for one
2409 of the possible arguments described above (or no argument)
2410 specifying where to break. *Note Break conditions: Conditions,
2411 for more information on breakpoint conditions.
2414 Set a breakpoint enabled only for one stop. ARGS are the same as
2415 for the `break' command, and the breakpoint is set in the same
2416 way, but the breakpoint is automatically deleted after the first
2417 time your program stops there. *Note Disabling breakpoints:
2421 Set a hardware-assisted breakpoint. ARGS are the same as for the
2422 `break' command and the breakpoint is set in the same way, but the
2423 breakpoint requires hardware support and some target hardware may
2424 not have this support. The main purpose of this is EPROM/ROM code
2425 debugging, so you can set a breakpoint at an instruction without
2426 changing the instruction. This can be used with the new
2427 trap-generation provided by SPARClite DSU and most x86-based
2428 targets. These targets will generate traps when a program
2429 accesses some data or instruction address that is assigned to the
2430 debug registers. However the hardware breakpoint registers can
2431 take a limited number of breakpoints. For example, on the DSU,
2432 only two data breakpoints can be set at a time, and GDB will
2433 reject this command if more than two are used. Delete or disable
2434 unused hardware breakpoints before setting new ones (*note
2435 Disabling: Disabling.). *Note Break conditions: Conditions. For
2436 remote targets, you can restrict the number of hardware
2437 breakpoints GDB will use, see *Note set remote
2438 hardware-breakpoint-limit::.
2441 Set a hardware-assisted breakpoint enabled only for one stop. ARGS
2442 are the same as for the `hbreak' command and the breakpoint is set
2443 in the same way. However, like the `tbreak' command, the
2444 breakpoint is automatically deleted after the first time your
2445 program stops there. Also, like the `hbreak' command, the
2446 breakpoint requires hardware support and some target hardware may
2447 not have this support. *Note Disabling breakpoints: Disabling.
2448 See also *Note Break conditions: Conditions.
2451 Set breakpoints on all functions matching the regular expression
2452 REGEX. This command sets an unconditional breakpoint on all
2453 matches, printing a list of all breakpoints it set. Once these
2454 breakpoints are set, they are treated just like the breakpoints
2455 set with the `break' command. You can delete them, disable them,
2456 or make them conditional the same way as any other breakpoint.
2458 The syntax of the regular expression is the standard one used with
2459 tools like `grep'. Note that this is different from the syntax
2460 used by shells, so for instance `foo*' matches all functions that
2461 include an `fo' followed by zero or more `o's. There is an
2462 implicit `.*' leading and trailing the regular expression you
2463 supply, so to match only functions that begin with `foo', use
2466 When debugging C++ programs, `rbreak' is useful for setting
2467 breakpoints on overloaded functions that are not members of any
2470 The `rbreak' command can be used to set breakpoints in *all* the
2471 functions in a program, like this:
2475 `info breakpoints [N]'
2477 `info watchpoints [N]'
2478 Print a table of all breakpoints, watchpoints, and catchpoints set
2479 and not deleted. Optional argument N means print information only
2480 about the specified breakpoint (or watchpoint or catchpoint). For
2481 each breakpoint, following columns are printed:
2483 _Breakpoint Numbers_
2486 Breakpoint, watchpoint, or catchpoint.
2489 Whether the breakpoint is marked to be disabled or deleted
2492 _Enabled or Disabled_
2493 Enabled breakpoints are marked with `y'. `n' marks
2494 breakpoints that are not enabled.
2497 Where the breakpoint is in your program, as a memory address.
2498 If the breakpoint is pending (see below for details) on a
2499 future load of a shared library, the address will be listed
2503 Where the breakpoint is in the source for your program, as a
2504 file and line number. For a pending breakpoint, the original
2505 string passed to the breakpoint command will be listed as it
2506 cannot be resolved until the appropriate shared library is
2507 loaded in the future.
2509 If a breakpoint is conditional, `info break' shows the condition on
2510 the line following the affected breakpoint; breakpoint commands,
2511 if any, are listed after that. A pending breakpoint is allowed to
2512 have a condition specified for it. The condition is not parsed
2513 for validity until a shared library is loaded that allows the
2514 pending breakpoint to resolve to a valid location.
2516 `info break' with a breakpoint number N as argument lists only
2517 that breakpoint. The convenience variable `$_' and the default
2518 examining-address for the `x' command are set to the address of
2519 the last breakpoint listed (*note Examining memory: Memory.).
2521 `info break' displays a count of the number of times the breakpoint
2522 has been hit. This is especially useful in conjunction with the
2523 `ignore' command. You can ignore a large number of breakpoint
2524 hits, look at the breakpoint info to see how many times the
2525 breakpoint was hit, and then run again, ignoring one less than
2526 that number. This will get you quickly to the last hit of that
2529 GDB allows you to set any number of breakpoints at the same place in
2530 your program. There is nothing silly or meaningless about this. When
2531 the breakpoints are conditional, this is even useful (*note Break
2532 conditions: Conditions.).
2534 If a specified breakpoint location cannot be found, it may be due to
2535 the fact that the location is in a shared library that is yet to be
2536 loaded. In such a case, you may want GDB to create a special
2537 breakpoint (known as a "pending breakpoint") that attempts to resolve
2538 itself in the future when an appropriate shared library gets loaded.
2540 Pending breakpoints are useful to set at the start of your GDB
2541 session for locations that you know will be dynamically loaded later by
2542 the program being debugged. When shared libraries are loaded, a check
2543 is made to see if the load resolves any pending breakpoint locations.
2544 If a pending breakpoint location gets resolved, a regular breakpoint is
2545 created and the original pending breakpoint is removed.
2547 GDB provides some additional commands for controlling pending
2550 `set breakpoint pending auto'
2551 This is the default behavior. When GDB cannot find the breakpoint
2552 location, it queries you whether a pending breakpoint should be
2555 `set breakpoint pending on'
2556 This indicates that an unrecognized breakpoint location should
2557 automatically result in a pending breakpoint being created.
2559 `set breakpoint pending off'
2560 This indicates that pending breakpoints are not to be created. Any
2561 unrecognized breakpoint location results in an error. This
2562 setting does not affect any pending breakpoints previously created.
2564 `show breakpoint pending'
2565 Show the current behavior setting for creating pending breakpoints.
2567 Normal breakpoint operations apply to pending breakpoints as well.
2568 You may specify a condition for a pending breakpoint and/or commands to
2569 run when the breakpoint is reached. You can also enable or disable the
2570 pending breakpoint. When you specify a condition for a pending
2571 breakpoint, the parsing of the condition will be deferred until the
2572 point where the pending breakpoint location is resolved. Disabling a
2573 pending breakpoint tells GDB to not attempt to resolve the breakpoint
2574 on any subsequent shared library load. When a pending breakpoint is
2575 re-enabled, GDB checks to see if the location is already resolved.
2576 This is done because any number of shared library loads could have
2577 occurred since the time the breakpoint was disabled and one or more of
2578 these loads could resolve the location.
2580 GDB itself sometimes sets breakpoints in your program for special
2581 purposes, such as proper handling of `longjmp' (in C programs). These
2582 internal breakpoints are assigned negative numbers, starting with `-1';
2583 `info breakpoints' does not display them. You can see these
2584 breakpoints with the GDB maintenance command `maint info breakpoints'
2585 (*note maint info breakpoints::).
2588 File: gdb.info, Node: Set Watchpoints, Next: Set Catchpoints, Prev: Set Breaks, Up: Breakpoints
2590 5.1.2 Setting watchpoints
2591 -------------------------
2593 You can use a watchpoint to stop execution whenever the value of an
2594 expression changes, without having to predict a particular place where
2595 this may happen. (This is sometimes called a "data breakpoint".) The
2596 expression may be as simple as the value of a single variable, or as
2597 complex as many variables combined by operators. Examples include:
2599 * A reference to the value of a single variable.
2601 * An address cast to an appropriate data type. For example, `*(int
2602 *)0x12345678' will watch a 4-byte region at the specified address
2603 (assuming an `int' occupies 4 bytes).
2605 * An arbitrarily complex expression, such as `a*b + c/d'. The
2606 expression can use any operators valid in the program's native
2607 language (*note Languages::).
2609 Depending on your system, watchpoints may be implemented in software
2610 or hardware. GDB does software watchpointing by single-stepping your
2611 program and testing the variable's value each time, which is hundreds of
2612 times slower than normal execution. (But this may still be worth it, to
2613 catch errors where you have no clue what part of your program is the
2616 On some systems, such as HP-UX, GNU/Linux and most other x86-based
2617 targets, GDB includes support for hardware watchpoints, which do not
2618 slow down the running of your program.
2621 Set a watchpoint for an expression. GDB will break when the
2622 expression EXPR is written into by the program and its value
2623 changes. The simplest (and the most popular) use of this command
2624 is to watch the value of a single variable:
2629 Set a watchpoint that will break when the value of EXPR is read by
2633 Set a watchpoint that will break when EXPR is either read from or
2634 written into by the program.
2637 This command prints a list of watchpoints, breakpoints, and
2638 catchpoints; it is the same as `info break' (*note Set Breaks::).
2640 GDB sets a "hardware watchpoint" if possible. Hardware watchpoints
2641 execute very quickly, and the debugger reports a change in value at the
2642 exact instruction where the change occurs. If GDB cannot set a
2643 hardware watchpoint, it sets a software watchpoint, which executes more
2644 slowly and reports the change in value at the next _statement_, not the
2645 instruction, after the change occurs.
2647 You can force GDB to use only software watchpoints with the `set
2648 can-use-hw-watchpoints 0' command. With this variable set to zero, GDB
2649 will never try to use hardware watchpoints, even if the underlying
2650 system supports them. (Note that hardware-assisted watchpoints that
2651 were set _before_ setting `can-use-hw-watchpoints' to zero will still
2652 use the hardware mechanism of watching expressiion values.)
2654 `set can-use-hw-watchpoints'
2655 Set whether or not to use hardware watchpoints.
2657 `show can-use-hw-watchpoints'
2658 Show the current mode of using hardware watchpoints.
2660 For remote targets, you can restrict the number of hardware
2661 watchpoints GDB will use, see *Note set remote
2662 hardware-breakpoint-limit::.
2664 When you issue the `watch' command, GDB reports
2666 Hardware watchpoint NUM: EXPR
2668 if it was able to set a hardware watchpoint.
2670 Currently, the `awatch' and `rwatch' commands can only set hardware
2671 watchpoints, because accesses to data that don't change the value of
2672 the watched expression cannot be detected without examining every
2673 instruction as it is being executed, and GDB does not do that
2674 currently. If GDB finds that it is unable to set a hardware breakpoint
2675 with the `awatch' or `rwatch' command, it will print a message like
2678 Expression cannot be implemented with read/access watchpoint.
2680 Sometimes, GDB cannot set a hardware watchpoint because the data
2681 type of the watched expression is wider than what a hardware watchpoint
2682 on the target machine can handle. For example, some systems can only
2683 watch regions that are up to 4 bytes wide; on such systems you cannot
2684 set hardware watchpoints for an expression that yields a
2685 double-precision floating-point number (which is typically 8 bytes
2686 wide). As a work-around, it might be possible to break the large region
2687 into a series of smaller ones and watch them with separate watchpoints.
2689 If you set too many hardware watchpoints, GDB might be unable to
2690 insert all of them when you resume the execution of your program.
2691 Since the precise number of active watchpoints is unknown until such
2692 time as the program is about to be resumed, GDB might not be able to
2693 warn you about this when you set the watchpoints, and the warning will
2694 be printed only when the program is resumed:
2696 Hardware watchpoint NUM: Could not insert watchpoint
2698 If this happens, delete or disable some of the watchpoints.
2700 Watching complex expressions that reference many variables can also
2701 exhaust the resources available for hardware-assisted watchpoints.
2702 That's because GDB needs to watch every variable in the expression with
2703 separately allocated resources.
2705 The SPARClite DSU will generate traps when a program accesses some
2706 data or instruction address that is assigned to the debug registers.
2707 For the data addresses, DSU facilitates the `watch' command. However
2708 the hardware breakpoint registers can only take two data watchpoints,
2709 and both watchpoints must be the same kind. For example, you can set
2710 two watchpoints with `watch' commands, two with `rwatch' commands, *or*
2711 two with `awatch' commands, but you cannot set one watchpoint with one
2712 command and the other with a different command. GDB will reject the
2713 command if you try to mix watchpoints. Delete or disable unused
2714 watchpoint commands before setting new ones.
2716 If you call a function interactively using `print' or `call', any
2717 watchpoints you have set will be inactive until GDB reaches another
2718 kind of breakpoint or the call completes.
2720 GDB automatically deletes watchpoints that watch local (automatic)
2721 variables, or expressions that involve such variables, when they go out
2722 of scope, that is, when the execution leaves the block in which these
2723 variables were defined. In particular, when the program being debugged
2724 terminates, _all_ local variables go out of scope, and so only
2725 watchpoints that watch global variables remain set. If you rerun the
2726 program, you will need to set all such watchpoints again. One way of
2727 doing that would be to set a code breakpoint at the entry to the `main'
2728 function and when it breaks, set all the watchpoints.
2730 _Warning:_ In multi-thread programs, watchpoints have only limited
2731 usefulness. With the current watchpoint implementation, GDB can
2732 only watch the value of an expression _in a single thread_. If
2733 you are confident that the expression can only change due to the
2734 current thread's activity (and if you are also confident that no
2735 other thread can become current), then you can use watchpoints as
2736 usual. However, GDB may not notice when a non-current thread's
2737 activity changes the expression.
2739 _HP-UX Warning:_ In multi-thread programs, software watchpoints
2740 have only limited usefulness. If GDB creates a software
2741 watchpoint, it can only watch the value of an expression _in a
2742 single thread_. If you are confident that the expression can only
2743 change due to the current thread's activity (and if you are also
2744 confident that no other thread can become current), then you can
2745 use software watchpoints as usual. However, GDB may not notice
2746 when a non-current thread's activity changes the expression.
2747 (Hardware watchpoints, in contrast, watch an expression in all
2750 *Note set remote hardware-watchpoint-limit::.
2753 File: gdb.info, Node: Set Catchpoints, Next: Delete Breaks, Prev: Set Watchpoints, Up: Breakpoints
2755 5.1.3 Setting catchpoints
2756 -------------------------
2758 You can use "catchpoints" to cause the debugger to stop for certain
2759 kinds of program events, such as C++ exceptions or the loading of a
2760 shared library. Use the `catch' command to set a catchpoint.
2763 Stop when EVENT occurs. EVENT can be any of the following:
2765 The throwing of a C++ exception.
2768 The catching of a C++ exception.
2771 A call to `exec'. This is currently only available for HP-UX.
2774 A call to `fork'. This is currently only available for HP-UX.
2777 A call to `vfork'. This is currently only available for
2782 The dynamic loading of any shared library, or the loading of
2783 the library LIBNAME. This is currently only available for
2788 The unloading of any dynamically loaded shared library, or
2789 the unloading of the library LIBNAME. This is currently only
2790 available for HP-UX.
2793 Set a catchpoint that is enabled only for one stop. The
2794 catchpoint is automatically deleted after the first time the event
2798 Use the `info break' command to list the current catchpoints.
2800 There are currently some limitations to C++ exception handling
2801 (`catch throw' and `catch catch') in GDB:
2803 * If you call a function interactively, GDB normally returns control
2804 to you when the function has finished executing. If the call
2805 raises an exception, however, the call may bypass the mechanism
2806 that returns control to you and cause your program either to abort
2807 or to simply continue running until it hits a breakpoint, catches
2808 a signal that GDB is listening for, or exits. This is the case
2809 even if you set a catchpoint for the exception; catchpoints on
2810 exceptions are disabled within interactive calls.
2812 * You cannot raise an exception interactively.
2814 * You cannot install an exception handler interactively.
2816 Sometimes `catch' is not the best way to debug exception handling:
2817 if you need to know exactly where an exception is raised, it is better
2818 to stop _before_ the exception handler is called, since that way you
2819 can see the stack before any unwinding takes place. If you set a
2820 breakpoint in an exception handler instead, it may not be easy to find
2821 out where the exception was raised.
2823 To stop just before an exception handler is called, you need some
2824 knowledge of the implementation. In the case of GNU C++, exceptions are
2825 raised by calling a library function named `__raise_exception' which
2826 has the following ANSI C interface:
2828 /* ADDR is where the exception identifier is stored.
2829 ID is the exception identifier. */
2830 void __raise_exception (void **addr, void *id);
2832 To make the debugger catch all exceptions before any stack unwinding
2833 takes place, set a breakpoint on `__raise_exception' (*note
2834 Breakpoints; watchpoints; and exceptions: Breakpoints.).
2836 With a conditional breakpoint (*note Break conditions: Conditions.)
2837 that depends on the value of ID, you can stop your program when a
2838 specific exception is raised. You can use multiple conditional
2839 breakpoints to stop your program when any of a number of exceptions are
2843 File: gdb.info, Node: Delete Breaks, Next: Disabling, Prev: Set Catchpoints, Up: Breakpoints
2845 5.1.4 Deleting breakpoints
2846 --------------------------
2848 It is often necessary to eliminate a breakpoint, watchpoint, or
2849 catchpoint once it has done its job and you no longer want your program
2850 to stop there. This is called "deleting" the breakpoint. A breakpoint
2851 that has been deleted no longer exists; it is forgotten.
2853 With the `clear' command you can delete breakpoints according to
2854 where they are in your program. With the `delete' command you can
2855 delete individual breakpoints, watchpoints, or catchpoints by specifying
2856 their breakpoint numbers.
2858 It is not necessary to delete a breakpoint to proceed past it. GDB
2859 automatically ignores breakpoints on the first instruction to be
2860 executed when you continue execution without changing the execution
2864 Delete any breakpoints at the next instruction to be executed in
2865 the selected stack frame (*note Selecting a frame: Selection.).
2866 When the innermost frame is selected, this is a good way to delete
2867 a breakpoint where your program just stopped.
2870 `clear FILENAME:FUNCTION'
2871 Delete any breakpoints set at entry to the named FUNCTION.
2874 `clear FILENAME:LINENUM'
2875 Delete any breakpoints set at or within the code of the specified
2876 LINENUM of the specified FILENAME.
2878 `delete [breakpoints] [RANGE...]'
2879 Delete the breakpoints, watchpoints, or catchpoints of the
2880 breakpoint ranges specified as arguments. If no argument is
2881 specified, delete all breakpoints (GDB asks confirmation, unless
2882 you have `set confirm off'). You can abbreviate this command as
2886 File: gdb.info, Node: Disabling, Next: Conditions, Prev: Delete Breaks, Up: Breakpoints
2888 5.1.5 Disabling breakpoints
2889 ---------------------------
2891 Rather than deleting a breakpoint, watchpoint, or catchpoint, you might
2892 prefer to "disable" it. This makes the breakpoint inoperative as if it
2893 had been deleted, but remembers the information on the breakpoint so
2894 that you can "enable" it again later.
2896 You disable and enable breakpoints, watchpoints, and catchpoints with
2897 the `enable' and `disable' commands, optionally specifying one or more
2898 breakpoint numbers as arguments. Use `info break' or `info watch' to
2899 print a list of breakpoints, watchpoints, and catchpoints if you do not
2900 know which numbers to use.
2902 A breakpoint, watchpoint, or catchpoint can have any of four
2903 different states of enablement:
2905 * Enabled. The breakpoint stops your program. A breakpoint set
2906 with the `break' command starts out in this state.
2908 * Disabled. The breakpoint has no effect on your program.
2910 * Enabled once. The breakpoint stops your program, but then becomes
2913 * Enabled for deletion. The breakpoint stops your program, but
2914 immediately after it does so it is deleted permanently. A
2915 breakpoint set with the `tbreak' command starts out in this state.
2917 You can use the following commands to enable or disable breakpoints,
2918 watchpoints, and catchpoints:
2920 `disable [breakpoints] [RANGE...]'
2921 Disable the specified breakpoints--or all breakpoints, if none are
2922 listed. A disabled breakpoint has no effect but is not forgotten.
2923 All options such as ignore-counts, conditions and commands are
2924 remembered in case the breakpoint is enabled again later. You may
2925 abbreviate `disable' as `dis'.
2927 `enable [breakpoints] [RANGE...]'
2928 Enable the specified breakpoints (or all defined breakpoints).
2929 They become effective once again in stopping your program.
2931 `enable [breakpoints] once RANGE...'
2932 Enable the specified breakpoints temporarily. GDB disables any of
2933 these breakpoints immediately after stopping your program.
2935 `enable [breakpoints] delete RANGE...'
2936 Enable the specified breakpoints to work once, then die. GDB
2937 deletes any of these breakpoints as soon as your program stops
2938 there. Breakpoints set by the `tbreak' command start out in this
2941 Except for a breakpoint set with `tbreak' (*note Setting
2942 breakpoints: Set Breaks.), breakpoints that you set are initially
2943 enabled; subsequently, they become disabled or enabled only when you
2944 use one of the commands above. (The command `until' can set and delete
2945 a breakpoint of its own, but it does not change the state of your other
2946 breakpoints; see *Note Continuing and stepping: Continuing and
2950 File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
2952 5.1.6 Break conditions
2953 ----------------------
2955 The simplest sort of breakpoint breaks every time your program reaches a
2956 specified place. You can also specify a "condition" for a breakpoint.
2957 A condition is just a Boolean expression in your programming language
2958 (*note Expressions: Expressions.). A breakpoint with a condition
2959 evaluates the expression each time your program reaches it, and your
2960 program stops only if the condition is _true_.
2962 This is the converse of using assertions for program validation; in
2963 that situation, you want to stop when the assertion is violated--that
2964 is, when the condition is false. In C, if you want to test an
2965 assertion expressed by the condition ASSERT, you should set the
2966 condition `! ASSERT' on the appropriate breakpoint.
2968 Conditions are also accepted for watchpoints; you may not need them,
2969 since a watchpoint is inspecting the value of an expression anyhow--but
2970 it might be simpler, say, to just set a watchpoint on a variable name,
2971 and specify a condition that tests whether the new value is an
2974 Break conditions can have side effects, and may even call functions
2975 in your program. This can be useful, for example, to activate functions
2976 that log program progress, or to use your own print functions to format
2977 special data structures. The effects are completely predictable unless
2978 there is another enabled breakpoint at the same address. (In that
2979 case, GDB might see the other breakpoint first and stop your program
2980 without checking the condition of this one.) Note that breakpoint
2981 commands are usually more convenient and flexible than break conditions
2982 for the purpose of performing side effects when a breakpoint is reached
2983 (*note Breakpoint command lists: Break Commands.).
2985 Break conditions can be specified when a breakpoint is set, by using
2986 `if' in the arguments to the `break' command. *Note Setting
2987 breakpoints: Set Breaks. They can also be changed at any time with the
2988 `condition' command.
2990 You can also use the `if' keyword with the `watch' command. The
2991 `catch' command does not recognize the `if' keyword; `condition' is the
2992 only way to impose a further condition on a catchpoint.
2994 `condition BNUM EXPRESSION'
2995 Specify EXPRESSION as the break condition for breakpoint,
2996 watchpoint, or catchpoint number BNUM. After you set a condition,
2997 breakpoint BNUM stops your program only if the value of EXPRESSION
2998 is true (nonzero, in C). When you use `condition', GDB checks
2999 EXPRESSION immediately for syntactic correctness, and to determine
3000 whether symbols in it have referents in the context of your
3001 breakpoint. If EXPRESSION uses symbols not referenced in the
3002 context of the breakpoint, GDB prints an error message:
3004 No symbol "foo" in current context.
3006 GDB does not actually evaluate EXPRESSION at the time the
3007 `condition' command (or a command that sets a breakpoint with a
3008 condition, like `break if ...') is given, however. *Note
3009 Expressions: Expressions.
3012 Remove the condition from breakpoint number BNUM. It becomes an
3013 ordinary unconditional breakpoint.
3015 A special case of a breakpoint condition is to stop only when the
3016 breakpoint has been reached a certain number of times. This is so
3017 useful that there is a special way to do it, using the "ignore count"
3018 of the breakpoint. Every breakpoint has an ignore count, which is an
3019 integer. Most of the time, the ignore count is zero, and therefore has
3020 no effect. But if your program reaches a breakpoint whose ignore count
3021 is positive, then instead of stopping, it just decrements the ignore
3022 count by one and continues. As a result, if the ignore count value is
3023 N, the breakpoint does not stop the next N times your program reaches
3027 Set the ignore count of breakpoint number BNUM to COUNT. The next
3028 COUNT times the breakpoint is reached, your program's execution
3029 does not stop; other than to decrement the ignore count, GDB takes
3032 To make the breakpoint stop the next time it is reached, specify a
3035 When you use `continue' to resume execution of your program from a
3036 breakpoint, you can specify an ignore count directly as an
3037 argument to `continue', rather than using `ignore'. *Note
3038 Continuing and stepping: Continuing and Stepping.
3040 If a breakpoint has a positive ignore count and a condition, the
3041 condition is not checked. Once the ignore count reaches zero, GDB
3042 resumes checking the condition.
3044 You could achieve the effect of the ignore count with a condition
3045 such as `$foo-- <= 0' using a debugger convenience variable that
3046 is decremented each time. *Note Convenience variables:
3049 Ignore counts apply to breakpoints, watchpoints, and catchpoints.
3052 File: gdb.info, Node: Break Commands, Next: Breakpoint Menus, Prev: Conditions, Up: Breakpoints
3054 5.1.7 Breakpoint command lists
3055 ------------------------------
3057 You can give any breakpoint (or watchpoint or catchpoint) a series of
3058 commands to execute when your program stops due to that breakpoint. For
3059 example, you might want to print the values of certain expressions, or
3060 enable other breakpoints.
3063 `... COMMAND-LIST ...'
3065 Specify a list of commands for breakpoint number BNUM. The
3066 commands themselves appear on the following lines. Type a line
3067 containing just `end' to terminate the commands.
3069 To remove all commands from a breakpoint, type `commands' and
3070 follow it immediately with `end'; that is, give no commands.
3072 With no BNUM argument, `commands' refers to the last breakpoint,
3073 watchpoint, or catchpoint set (not to the breakpoint most recently
3076 Pressing <RET> as a means of repeating the last GDB command is
3077 disabled within a COMMAND-LIST.
3079 You can use breakpoint commands to start your program up again.
3080 Simply use the `continue' command, or `step', or any other command that
3083 Any other commands in the command list, after a command that resumes
3084 execution, are ignored. This is because any time you resume execution
3085 (even with a simple `next' or `step'), you may encounter another
3086 breakpoint--which could have its own command list, leading to
3087 ambiguities about which list to execute.
3089 If the first command you specify in a command list is `silent', the
3090 usual message about stopping at a breakpoint is not printed. This may
3091 be desirable for breakpoints that are to print a specific message and
3092 then continue. If none of the remaining commands print anything, you
3093 see no sign that the breakpoint was reached. `silent' is meaningful
3094 only at the beginning of a breakpoint command list.
3096 The commands `echo', `output', and `printf' allow you to print
3097 precisely controlled output, and are often useful in silent
3098 breakpoints. *Note Commands for controlled output: Output.
3100 For example, here is how you could use breakpoint commands to print
3101 the value of `x' at entry to `foo' whenever `x' is positive.
3106 printf "x is %d\n",x
3110 One application for breakpoint commands is to compensate for one bug
3111 so you can test for another. Put a breakpoint just after the erroneous
3112 line of code, give it a condition to detect the case in which something
3113 erroneous has been done, and give it commands to assign correct values
3114 to any variables that need them. End with the `continue' command so
3115 that your program does not stop, and start with the `silent' command so
3116 that no output is produced. Here is an example:
3126 File: gdb.info, Node: Breakpoint Menus, Next: Error in Breakpoints, Prev: Break Commands, Up: Breakpoints
3128 5.1.8 Breakpoint menus
3129 ----------------------
3131 Some programming languages (notably C++ and Objective-C) permit a
3132 single function name to be defined several times, for application in
3133 different contexts. This is called "overloading". When a function
3134 name is overloaded, `break FUNCTION' is not enough to tell GDB where
3135 you want a breakpoint. If you realize this is a problem, you can use
3136 something like `break FUNCTION(TYPES)' to specify which particular
3137 version of the function you want. Otherwise, GDB offers you a menu of
3138 numbered choices for different possible breakpoints, and waits for your
3139 selection with the prompt `>'. The first two options are always `[0]
3140 cancel' and `[1] all'. Typing `1' sets a breakpoint at each definition
3141 of FUNCTION, and typing `0' aborts the `break' command without setting
3142 any new breakpoints.
3144 For example, the following session excerpt shows an attempt to set a
3145 breakpoint at the overloaded symbol `String::after'. We choose three
3146 particular definitions of that function name:
3148 (gdb) b String::after
3151 [2] file:String.cc; line number:867
3152 [3] file:String.cc; line number:860
3153 [4] file:String.cc; line number:875
3154 [5] file:String.cc; line number:853
3155 [6] file:String.cc; line number:846
3156 [7] file:String.cc; line number:735
3158 Breakpoint 1 at 0xb26c: file String.cc, line 867.
3159 Breakpoint 2 at 0xb344: file String.cc, line 875.
3160 Breakpoint 3 at 0xafcc: file String.cc, line 846.
3161 Multiple breakpoints were set.
3162 Use the "delete" command to delete unwanted
3167 File: gdb.info, Node: Error in Breakpoints, Next: Breakpoint related warnings, Prev: Breakpoint Menus, Up: Breakpoints
3169 5.1.9 "Cannot insert breakpoints"
3170 ---------------------------------
3172 Under some operating systems, breakpoints cannot be used in a program if
3173 any other process is running that program. In this situation,
3174 attempting to run or continue a program with a breakpoint causes GDB to
3175 print an error message:
3177 Cannot insert breakpoints.
3178 The same program may be running in another process.
3180 When this happens, you have three ways to proceed:
3182 1. Remove or disable the breakpoints, then continue.
3184 2. Suspend GDB, and copy the file containing your program to a new
3185 name. Resume GDB and use the `exec-file' command to specify that
3186 GDB should run your program under that name. Then start your
3189 3. Relink your program so that the text segment is nonsharable, using
3190 the linker option `-N'. The operating system limitation may not
3191 apply to nonsharable executables.
3193 A similar message can be printed if you request too many active
3194 hardware-assisted breakpoints and watchpoints:
3196 Stopped; cannot insert breakpoints.
3197 You may have requested too many hardware breakpoints and watchpoints.
3199 This message is printed when you attempt to resume the program, since
3200 only then GDB knows exactly how many hardware breakpoints and
3201 watchpoints it needs to insert.
3203 When this message is printed, you need to disable or remove some of
3204 the hardware-assisted breakpoints and watchpoints, and then continue.
3207 File: gdb.info, Node: Breakpoint related warnings, Prev: Error in Breakpoints, Up: Breakpoints
3209 5.1.10 "Breakpoint address adjusted..."
3210 ---------------------------------------
3212 Some processor architectures place constraints on the addresses at
3213 which breakpoints may be placed. For architectures thus constrained,
3214 GDB will attempt to adjust the breakpoint's address to comply with the
3215 constraints dictated by the architecture.
3217 One example of such an architecture is the Fujitsu FR-V. The FR-V is
3218 a VLIW architecture in which a number of RISC-like instructions may be
3219 bundled together for parallel execution. The FR-V architecture
3220 constrains the location of a breakpoint instruction within such a
3221 bundle to the instruction with the lowest address. GDB honors this
3222 constraint by adjusting a breakpoint's address to the first in the
3225 It is not uncommon for optimized code to have bundles which contain
3226 instructions from different source statements, thus it may happen that
3227 a breakpoint's address will be adjusted from one source statement to
3228 another. Since this adjustment may significantly alter GDB's
3229 breakpoint related behavior from what the user expects, a warning is
3230 printed when the breakpoint is first set and also when the breakpoint
3233 A warning like the one below is printed when setting a breakpoint
3234 that's been subject to address adjustment:
3236 warning: Breakpoint address adjusted from 0x00010414 to 0x00010410.
3238 Such warnings are printed both for user settable and GDB's internal
3239 breakpoints. If you see one of these warnings, you should verify that
3240 a breakpoint set at the adjusted address will have the desired affect.
3241 If not, the breakpoint in question may be removed and other breakpoints
3242 may be set which will have the desired behavior. E.g., it may be
3243 sufficient to place the breakpoint at a later instruction. A
3244 conditional breakpoint may also be useful in some cases to prevent the
3245 breakpoint from triggering too often.
3247 GDB will also issue a warning when stopping at one of these adjusted
3250 warning: Breakpoint 1 address previously adjusted from 0x00010414
3253 When this warning is encountered, it may be too late to take remedial
3254 action except in cases where the breakpoint is hit earlier or more
3255 frequently than expected.
3258 File: gdb.info, Node: Continuing and Stepping, Next: Signals, Prev: Breakpoints, Up: Stopping
3260 5.2 Continuing and stepping
3261 ===========================
3263 "Continuing" means resuming program execution until your program
3264 completes normally. In contrast, "stepping" means executing just one
3265 more "step" of your program, where "step" may mean either one line of
3266 source code, or one machine instruction (depending on what particular
3267 command you use). Either when continuing or when stepping, your
3268 program may stop even sooner, due to a breakpoint or a signal. (If it
3269 stops due to a signal, you may want to use `handle', or use `signal 0'
3270 to resume execution. *Note Signals: Signals.)
3272 `continue [IGNORE-COUNT]'
3275 Resume program execution, at the address where your program last
3276 stopped; any breakpoints set at that address are bypassed. The
3277 optional argument IGNORE-COUNT allows you to specify a further
3278 number of times to ignore a breakpoint at this location; its
3279 effect is like that of `ignore' (*note Break conditions:
3282 The argument IGNORE-COUNT is meaningful only when your program
3283 stopped due to a breakpoint. At other times, the argument to
3284 `continue' is ignored.
3286 The synonyms `c' and `fg' (for "foreground", as the debugged
3287 program is deemed to be the foreground program) are provided
3288 purely for convenience, and have exactly the same behavior as
3291 To resume execution at a different place, you can use `return'
3292 (*note Returning from a function: Returning.) to go back to the calling
3293 function; or `jump' (*note Continuing at a different address: Jumping.)
3294 to go to an arbitrary location in your program.
3296 A typical technique for using stepping is to set a breakpoint (*note
3297 Breakpoints; watchpoints; and catchpoints: Breakpoints.) at the
3298 beginning of the function or the section of your program where a problem
3299 is believed to lie, run your program until it stops at that breakpoint,
3300 and then step through the suspect area, examining the variables that are
3301 interesting, until you see the problem happen.
3304 Continue running your program until control reaches a different
3305 source line, then stop it and return control to GDB. This command
3308 _Warning:_ If you use the `step' command while control is
3309 within a function that was compiled without debugging
3310 information, execution proceeds until control reaches a
3311 function that does have debugging information. Likewise, it
3312 will not step into a function which is compiled without
3313 debugging information. To step through functions without
3314 debugging information, use the `stepi' command, described
3317 The `step' command only stops at the first instruction of a source
3318 line. This prevents the multiple stops that could otherwise occur
3319 in `switch' statements, `for' loops, etc. `step' continues to
3320 stop if a function that has debugging information is called within
3321 the line. In other words, `step' _steps inside_ any functions
3322 called within the line.
3324 Also, the `step' command only enters a function if there is line
3325 number information for the function. Otherwise it acts like the
3326 `next' command. This avoids problems when using `cc -gl' on MIPS
3327 machines. Previously, `step' entered subroutines if there was any
3328 debugging information about the routine.
3331 Continue running as in `step', but do so COUNT times. If a
3332 breakpoint is reached, or a signal not related to stepping occurs
3333 before COUNT steps, stepping stops right away.
3336 Continue to the next source line in the current (innermost) stack
3337 frame. This is similar to `step', but function calls that appear
3338 within the line of code are executed without stopping. Execution
3339 stops when control reaches a different line of code at the
3340 original stack level that was executing when you gave the `next'
3341 command. This command is abbreviated `n'.
3343 An argument COUNT is a repeat count, as for `step'.
3345 The `next' command only stops at the first instruction of a source
3346 line. This prevents multiple stops that could otherwise occur in
3347 `switch' statements, `for' loops, etc.
3351 The `set step-mode on' command causes the `step' command to stop
3352 at the first instruction of a function which contains no debug line
3353 information rather than stepping over it.
3355 This is useful in cases where you may be interested in inspecting
3356 the machine instructions of a function which has no symbolic info
3357 and do not want GDB to automatically skip over this function.
3360 Causes the `step' command to step over any functions which
3361 contains no debug information. This is the default.
3364 Show whether GDB will stop in or step over functions without
3365 source line debug information.
3368 Continue running until just after function in the selected stack
3369 frame returns. Print the returned value (if any).
3371 Contrast this with the `return' command (*note Returning from a
3372 function: Returning.).
3376 Continue running until a source line past the current line, in the
3377 current stack frame, is reached. This command is used to avoid
3378 single stepping through a loop more than once. It is like the
3379 `next' command, except that when `until' encounters a jump, it
3380 automatically continues execution until the program counter is
3381 greater than the address of the jump.
3383 This means that when you reach the end of a loop after single
3384 stepping though it, `until' makes your program continue execution
3385 until it exits the loop. In contrast, a `next' command at the end
3386 of a loop simply steps back to the beginning of the loop, which
3387 forces you to step through the next iteration.
3389 `until' always stops your program if it attempts to exit the
3390 current stack frame.
3392 `until' may produce somewhat counterintuitive results if the order
3393 of machine code does not match the order of the source lines. For
3394 example, in the following excerpt from a debugging session, the `f'
3395 (`frame') command shows that execution is stopped at line `206';
3396 yet when we use `until', we get to line `195':
3399 #0 main (argc=4, argv=0xf7fffae8) at m4.c:206
3402 195 for ( ; argc > 0; NEXTARG) {
3404 This happened because, for execution efficiency, the compiler had
3405 generated code for the loop closure test at the end, rather than
3406 the start, of the loop--even though the test in a C `for'-loop is
3407 written before the body of the loop. The `until' command appeared
3408 to step back to the beginning of the loop when it advanced to this
3409 expression; however, it has not really gone to an earlier
3410 statement--not in terms of the actual machine code.
3412 `until' with no argument works by means of single instruction
3413 stepping, and hence is slower than `until' with an argument.
3417 Continue running your program until either the specified location
3418 is reached, or the current stack frame returns. LOCATION is any of
3419 the forms of argument acceptable to `break' (*note Setting
3420 breakpoints: Set Breaks.). This form of the command uses
3421 breakpoints, and hence is quicker than `until' without an
3422 argument. The specified location is actually reached only if it
3423 is in the current frame. This implies that `until' can be used to
3424 skip over recursive function invocations. For instance in the
3425 code below, if the current location is line `96', issuing `until
3426 99' will execute the program up to line `99' in the same
3427 invocation of factorial, i.e. after the inner invocations have
3430 94 int factorial (int value)
3433 97 value *= factorial (value - 1);
3439 Continue running the program up to the given LOCATION. An
3440 argument is required, which should be of the same form as
3441 arguments for the `break' command. Execution will also stop upon
3442 exit from the current stack frame. This command is similar to
3443 `until', but `advance' will not skip over recursive function
3444 calls, and the target location doesn't have to be in the same
3445 frame as the current one.
3450 Execute one machine instruction, then stop and return to the
3453 It is often useful to do `display/i $pc' when stepping by machine
3454 instructions. This makes GDB automatically display the next
3455 instruction to be executed, each time your program stops. *Note
3456 Automatic display: Auto Display.
3458 An argument is a repeat count, as in `step'.
3463 Execute one machine instruction, but if it is a function call,
3464 proceed until the function returns.
3466 An argument is a repeat count, as in `next'.
3469 File: gdb.info, Node: Signals, Next: Thread Stops, Prev: Continuing and Stepping, Up: Stopping
3474 A signal is an asynchronous event that can happen in a program. The
3475 operating system defines the possible kinds of signals, and gives each
3476 kind a name and a number. For example, in Unix `SIGINT' is the signal
3477 a program gets when you type an interrupt character (often `Ctrl-c');
3478 `SIGSEGV' is the signal a program gets from referencing a place in
3479 memory far away from all the areas in use; `SIGALRM' occurs when the
3480 alarm clock timer goes off (which happens only if your program has
3481 requested an alarm).
3483 Some signals, including `SIGALRM', are a normal part of the
3484 functioning of your program. Others, such as `SIGSEGV', indicate
3485 errors; these signals are "fatal" (they kill your program immediately)
3486 if the program has not specified in advance some other way to handle
3487 the signal. `SIGINT' does not indicate an error in your program, but
3488 it is normally fatal so it can carry out the purpose of the interrupt:
3489 to kill the program.
3491 GDB has the ability to detect any occurrence of a signal in your
3492 program. You can tell GDB in advance what to do for each kind of
3495 Normally, GDB is set up to let the non-erroneous signals like
3496 `SIGALRM' be silently passed to your program (so as not to interfere
3497 with their role in the program's functioning) but to stop your program
3498 immediately whenever an error signal happens. You can change these
3499 settings with the `handle' command.
3503 Print a table of all the kinds of signals and how GDB has been
3504 told to handle each one. You can use this to see the signal
3505 numbers of all the defined types of signals.
3508 Similar, but print information only about the specified signal
3511 `info handle' is an alias for `info signals'.
3513 `handle SIGNAL [KEYWORDS...]'
3514 Change the way GDB handles signal SIGNAL. SIGNAL can be the
3515 number of a signal or its name (with or without the `SIG' at the
3516 beginning); a list of signal numbers of the form `LOW-HIGH'; or
3517 the word `all', meaning all the known signals. Optional arguments
3518 KEYWORDS, described below, say what change to make.
3520 The keywords allowed by the `handle' command can be abbreviated.
3521 Their full names are:
3524 GDB should not stop your program when this signal happens. It may
3525 still print a message telling you that the signal has come in.
3528 GDB should stop your program when this signal happens. This
3529 implies the `print' keyword as well.
3532 GDB should print a message when this signal happens.
3535 GDB should not mention the occurrence of the signal at all. This
3536 implies the `nostop' keyword as well.
3540 GDB should allow your program to see this signal; your program can
3541 handle the signal, or else it may terminate if the signal is fatal
3542 and not handled. `pass' and `noignore' are synonyms.
3546 GDB should not allow your program to see this signal. `nopass'
3547 and `ignore' are synonyms.
3549 When a signal stops your program, the signal is not visible to the
3550 program until you continue. Your program sees the signal then, if
3551 `pass' is in effect for the signal in question _at that time_. In
3552 other words, after GDB reports a signal, you can use the `handle'
3553 command with `pass' or `nopass' to control whether your program sees
3554 that signal when you continue.
3556 The default is set to `nostop', `noprint', `pass' for non-erroneous
3557 signals such as `SIGALRM', `SIGWINCH' and `SIGCHLD', and to `stop',
3558 `print', `pass' for the erroneous signals.
3560 You can also use the `signal' command to prevent your program from
3561 seeing a signal, or cause it to see a signal it normally would not see,
3562 or to give it any signal at any time. For example, if your program
3563 stopped due to some sort of memory reference error, you might store
3564 correct values into the erroneous variables and continue, hoping to see
3565 more execution; but your program would probably terminate immediately as
3566 a result of the fatal signal once it saw the signal. To prevent this,
3567 you can continue with `signal 0'. *Note Giving your program a signal:
3571 File: gdb.info, Node: Thread Stops, Prev: Signals, Up: Stopping
3573 5.4 Stopping and starting multi-thread programs
3574 ===============================================
3576 When your program has multiple threads (*note Debugging programs with
3577 multiple threads: Threads.), you can choose whether to set breakpoints
3578 on all threads, or on a particular thread.
3580 `break LINESPEC thread THREADNO'
3581 `break LINESPEC thread THREADNO if ...'
3582 LINESPEC specifies source lines; there are several ways of writing
3583 them, but the effect is always to specify some source line.
3585 Use the qualifier `thread THREADNO' with a breakpoint command to
3586 specify that you only want GDB to stop the program when a
3587 particular thread reaches this breakpoint. THREADNO is one of the
3588 numeric thread identifiers assigned by GDB, shown in the first
3589 column of the `info threads' display.
3591 If you do not specify `thread THREADNO' when you set a breakpoint,
3592 the breakpoint applies to _all_ threads of your program.
3594 You can use the `thread' qualifier on conditional breakpoints as
3595 well; in this case, place `thread THREADNO' before the breakpoint
3596 condition, like this:
3598 (gdb) break frik.c:13 thread 28 if bartab > lim
3601 Whenever your program stops under GDB for any reason, _all_ threads
3602 of execution stop, not just the current thread. This allows you to
3603 examine the overall state of the program, including switching between
3604 threads, without worrying that things may change underfoot.
3606 There is an unfortunate side effect. If one thread stops for a
3607 breakpoint, or for some other reason, and another thread is blocked in a
3608 system call, then the system call may return prematurely. This is a
3609 consequence of the interaction between multiple threads and the signals
3610 that GDB uses to implement breakpoints and other events that stop
3613 To handle this problem, your program should check the return value of
3614 each system call and react appropriately. This is good programming
3617 For example, do not write code like this:
3621 The call to `sleep' will return early if a different thread stops at
3622 a breakpoint or for some other reason.
3624 Instead, write this:
3628 unslept = sleep (unslept);
3630 A system call is allowed to return early, so the system is still
3631 conforming to its specification. But GDB does cause your
3632 multi-threaded program to behave differently than it would without GDB.
3634 Also, GDB uses internal breakpoints in the thread library to monitor
3635 certain events such as thread creation and thread destruction. When
3636 such an event happens, a system call in another thread may return
3637 prematurely, even though your program does not appear to stop.
3639 Conversely, whenever you restart the program, _all_ threads start
3640 executing. _This is true even when single-stepping_ with commands like
3643 In particular, GDB cannot single-step all threads in lockstep.
3644 Since thread scheduling is up to your debugging target's operating
3645 system (not controlled by GDB), other threads may execute more than one
3646 statement while the current thread completes a single step. Moreover,
3647 in general other threads stop in the middle of a statement, rather than
3648 at a clean statement boundary, when the program stops.
3650 You might even find your program stopped in another thread after
3651 continuing or even single-stepping. This happens whenever some other
3652 thread runs into a breakpoint, a signal, or an exception before the
3653 first thread completes whatever you requested.
3655 On some OSes, you can lock the OS scheduler and thus allow only a
3656 single thread to run.
3658 `set scheduler-locking MODE'
3659 Set the scheduler locking mode. If it is `off', then there is no
3660 locking and any thread may run at any time. If `on', then only the
3661 current thread may run when the inferior is resumed. The `step'
3662 mode optimizes for single-stepping. It stops other threads from
3663 "seizing the prompt" by preempting the current thread while you are
3664 stepping. Other threads will only rarely (or never) get a chance
3665 to run when you step. They are more likely to run when you `next'
3666 over a function call, and they are completely free to run when you
3667 use commands like `continue', `until', or `finish'. However,
3668 unless another thread hits a breakpoint during its timeslice, they
3669 will never steal the GDB prompt away from the thread that you are
3672 `show scheduler-locking'
3673 Display the current scheduler locking mode.
3676 File: gdb.info, Node: Stack, Next: Source, Prev: Stopping, Up: Top
3678 6 Examining the Stack
3679 *********************
3681 When your program has stopped, the first thing you need to know is
3682 where it stopped and how it got there.
3684 Each time your program performs a function call, information about
3685 the call is generated. That information includes the location of the
3686 call in your program, the arguments of the call, and the local
3687 variables of the function being called. The information is saved in a
3688 block of data called a "stack frame". The stack frames are allocated
3689 in a region of memory called the "call stack".
3691 When your program stops, the GDB commands for examining the stack
3692 allow you to see all of this information.
3694 One of the stack frames is "selected" by GDB and many GDB commands
3695 refer implicitly to the selected frame. In particular, whenever you
3696 ask GDB for the value of a variable in your program, the value is found
3697 in the selected frame. There are special GDB commands to select
3698 whichever frame you are interested in. *Note Selecting a frame:
3701 When your program stops, GDB automatically selects the currently
3702 executing frame and describes it briefly, similar to the `frame'
3703 command (*note Information about a frame: Frame Info.).
3707 * Frames:: Stack frames
3708 * Backtrace:: Backtraces
3709 * Selection:: Selecting a frame
3710 * Frame Info:: Information on a frame
3713 File: gdb.info, Node: Frames, Next: Backtrace, Up: Stack
3718 The call stack is divided up into contiguous pieces called "stack
3719 frames", or "frames" for short; each frame is the data associated with
3720 one call to one function. The frame contains the arguments given to
3721 the function, the function's local variables, and the address at which
3722 the function is executing.
3724 When your program is started, the stack has only one frame, that of
3725 the function `main'. This is called the "initial" frame or the
3726 "outermost" frame. Each time a function is called, a new frame is
3727 made. Each time a function returns, the frame for that function
3728 invocation is eliminated. If a function is recursive, there can be
3729 many frames for the same function. The frame for the function in which
3730 execution is actually occurring is called the "innermost" frame. This
3731 is the most recently created of all the stack frames that still exist.
3733 Inside your program, stack frames are identified by their addresses.
3734 A stack frame consists of many bytes, each of which has its own
3735 address; each kind of computer has a convention for choosing one byte
3736 whose address serves as the address of the frame. Usually this address
3737 is kept in a register called the "frame pointer register" (*note $fp:
3738 Registers.) while execution is going on in that frame.
3740 GDB assigns numbers to all existing stack frames, starting with zero
3741 for the innermost frame, one for the frame that called it, and so on
3742 upward. These numbers do not really exist in your program; they are
3743 assigned by GDB to give you a way of designating stack frames in GDB
3746 Some compilers provide a way to compile functions so that they
3747 operate without stack frames. (For example, the gcc option
3748 `-fomit-frame-pointer'
3749 generates functions without a frame.) This is occasionally done
3750 with heavily used library functions to save the frame setup time. GDB
3751 has limited facilities for dealing with these function invocations. If
3752 the innermost function invocation has no stack frame, GDB nevertheless
3753 regards it as though it had a separate frame, which is numbered zero as
3754 usual, allowing correct tracing of the function call chain. However,
3755 GDB has no provision for frameless functions elsewhere in the stack.
3758 The `frame' command allows you to move from one stack frame to
3759 another, and to print the stack frame you select. ARGS may be
3760 either the address of the frame or the stack frame number.
3761 Without an argument, `frame' prints the current stack frame.
3764 The `select-frame' command allows you to move from one stack frame
3765 to another without printing the frame. This is the silent version
3769 File: gdb.info, Node: Backtrace, Next: Selection, Prev: Frames, Up: Stack
3774 A backtrace is a summary of how your program got where it is. It shows
3775 one line per frame, for many frames, starting with the currently
3776 executing frame (frame zero), followed by its caller (frame one), and
3781 Print a backtrace of the entire stack: one line per frame for all
3782 frames in the stack.
3784 You can stop the backtrace at any time by typing the system
3785 interrupt character, normally `Ctrl-c'.
3789 Similar, but print only the innermost N frames.
3793 Similar, but print only the outermost N frames.
3799 Print the values of the local variables also. N specifies the
3800 number of frames to print, as described above.
3802 The names `where' and `info stack' (abbreviated `info s') are
3803 additional aliases for `backtrace'.
3805 In a multi-threaded program, GDB by default shows the backtrace only
3806 for the current thread. To display the backtrace for several or all of
3807 the threads, use the command `thread apply' (*note thread apply:
3808 Threads.). For example, if you type `thread apply all backtrace', GDB
3809 will display the backtrace for all the threads; this is handy when you
3810 debug a core dump of a multi-threaded program.
3812 Each line in the backtrace shows the frame number and the function
3813 name. The program counter value is also shown--unless you use `set
3814 print address off'. The backtrace also shows the source file name and
3815 line number, as well as the arguments to the function. The program
3816 counter value is omitted if it is at the beginning of the code for that
3819 Here is an example of a backtrace. It was made with the command `bt
3820 3', so it shows the innermost three frames.
3822 #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
3824 #1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
3825 #2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
3827 (More stack frames follow...)
3829 The display for frame zero does not begin with a program counter value,
3830 indicating that your program has stopped at the beginning of the code
3831 for line `993' of `builtin.c'.
3833 If your program was compiled with optimizations, some compilers will
3834 optimize away arguments passed to functions if those arguments are
3835 never used after the call. Such optimizations generate code that
3836 passes arguments through registers, but doesn't store those arguments
3837 in the stack frame. GDB has no way of displaying such arguments in
3838 stack frames other than the innermost one. Here's what such a
3839 backtrace might look like:
3841 #0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
3843 #1 0x6e38 in expand_macro (sym=<value optimized out>) at macro.c:242
3844 #2 0x6840 in expand_token (obs=0x0, t=<value optimized out>, td=0xf7fffb08)
3846 (More stack frames follow...)
3848 The values of arguments that were not saved in their stack frames are
3849 shown as `<value optimized out>'.
3851 If you need to display the values of such optimized-out arguments,
3852 either deduce that from other variables whose values depend on the one
3853 you are interested in, or recompile without optimizations.
3855 Most programs have a standard user entry point--a place where system
3856 libraries and startup code transition into user code. For C this is
3857 `main'(1). When GDB finds the entry function in a backtrace it will
3858 terminate the backtrace, to avoid tracing into highly system-specific
3859 (and generally uninteresting) code.
3861 If you need to examine the startup code, or limit the number of
3862 levels in a backtrace, you can change this behavior:
3864 `set backtrace past-main'
3865 `set backtrace past-main on'
3866 Backtraces will continue past the user entry point.
3868 `set backtrace past-main off'
3869 Backtraces will stop when they encounter the user entry point.
3870 This is the default.
3872 `show backtrace past-main'
3873 Display the current user entry point backtrace policy.
3875 `set backtrace past-entry'
3876 `set backtrace past-entry on'
3877 Backtraces will continue past the internal entry point of an
3878 application. This entry point is encoded by the linker when the
3879 application is built, and is likely before the user entry point
3880 `main' (or equivalent) is called.
3882 `set backtrace past-entry off'
3883 Backtraces will stop when they encouter the internal entry point
3884 of an application. This is the default.
3886 `show backtrace past-entry'
3887 Display the current internal entry point backtrace policy.
3889 `set backtrace limit N'
3890 `set backtrace limit 0'
3891 Limit the backtrace to N levels. A value of zero means unlimited.
3893 `show backtrace limit'
3894 Display the current limit on backtrace levels.
3896 ---------- Footnotes ----------
3898 (1) Note that embedded programs (the so-called "free-standing"
3899 environment) are not required to have a `main' function as the entry
3900 point. They could even have multiple entry points.
3903 File: gdb.info, Node: Selection, Next: Frame Info, Prev: Backtrace, Up: Stack
3905 6.3 Selecting a frame
3906 =====================
3908 Most commands for examining the stack and other data in your program
3909 work on whichever stack frame is selected at the moment. Here are the
3910 commands for selecting a stack frame; all of them finish by printing a
3911 brief description of the stack frame just selected.
3915 Select frame number N. Recall that frame zero is the innermost
3916 (currently executing) frame, frame one is the frame that called the
3917 innermost one, and so on. The highest-numbered frame is the one
3922 Select the frame at address ADDR. This is useful mainly if the
3923 chaining of stack frames has been damaged by a bug, making it
3924 impossible for GDB to assign numbers properly to all frames. In
3925 addition, this can be useful when your program has multiple stacks
3926 and switches between them.
3928 On the SPARC architecture, `frame' needs two addresses to select
3929 an arbitrary frame: a frame pointer and a stack pointer.
3931 On the MIPS and Alpha architecture, it needs two addresses: a stack
3932 pointer and a program counter.
3934 On the 29k architecture, it needs three addresses: a register stack
3935 pointer, a program counter, and a memory stack pointer.
3938 Move N frames up the stack. For positive numbers N, this advances
3939 toward the outermost frame, to higher frame numbers, to frames
3940 that have existed longer. N defaults to one.
3943 Move N frames down the stack. For positive numbers N, this
3944 advances toward the innermost frame, to lower frame numbers, to
3945 frames that were created more recently. N defaults to one. You
3946 may abbreviate `down' as `do'.
3948 All of these commands end by printing two lines of output describing
3949 the frame. The first line shows the frame number, the function name,
3950 the arguments, and the source file and line number of execution in that
3951 frame. The second line shows the text of that source line.
3956 #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
3958 10 read_input_file (argv[i]);
3960 After such a printout, the `list' command with no arguments prints
3961 ten lines centered on the point of execution in the frame. You can
3962 also edit the program at the point of execution with your favorite
3963 editing program by typing `edit'. *Note Printing source lines: List,
3968 These two commands are variants of `up' and `down', respectively;
3969 they differ in that they do their work silently, without causing
3970 display of the new frame. They are intended primarily for use in
3971 GDB command scripts, where the output might be unnecessary and
3975 File: gdb.info, Node: Frame Info, Prev: Selection, Up: Stack
3977 6.4 Information about a frame
3978 =============================
3980 There are several other commands to print information about the selected
3985 When used without any argument, this command does not change which
3986 frame is selected, but prints a brief description of the currently
3987 selected stack frame. It can be abbreviated `f'. With an
3988 argument, this command is used to select a stack frame. *Note
3989 Selecting a frame: Selection.
3993 This command prints a verbose description of the selected stack
3996 * the address of the frame
3998 * the address of the next frame down (called by this frame)
4000 * the address of the next frame up (caller of this frame)
4002 * the language in which the source code corresponding to this
4005 * the address of the frame's arguments
4007 * the address of the frame's local variables
4009 * the program counter saved in it (the address of execution in
4012 * which registers were saved in the frame
4014 The verbose description is useful when something has gone wrong
4015 that has made the stack format fail to fit the usual conventions.
4019 Print a verbose description of the frame at address ADDR, without
4020 selecting that frame. The selected frame remains unchanged by this
4021 command. This requires the same kind of address (more than one
4022 for some architectures) that you specify in the `frame' command.
4023 *Note Selecting a frame: Selection.
4026 Print the arguments of the selected frame, each on a separate line.
4029 Print the local variables of the selected frame, each on a separate
4030 line. These are all variables (declared either static or
4031 automatic) accessible at the point of execution of the selected
4035 Print a list of all the exception handlers that are active in the
4036 current stack frame at the current point of execution. To see
4037 other exception handlers, visit the associated frame (using the
4038 `up', `down', or `frame' commands); then type `info catch'. *Note
4039 Setting catchpoints: Set Catchpoints.
4043 File: gdb.info, Node: Source, Next: Data, Prev: Stack, Up: Top
4045 7 Examining Source Files
4046 ************************
4048 GDB can print parts of your program's source, since the debugging
4049 information recorded in the program tells GDB what source files were
4050 used to build it. When your program stops, GDB spontaneously prints
4051 the line where it stopped. Likewise, when you select a stack frame
4052 (*note Selecting a frame: Selection.), GDB prints the line where
4053 execution in that frame has stopped. You can print other portions of
4054 source files by explicit command.
4056 If you use GDB through its GNU Emacs interface, you may prefer to
4057 use Emacs facilities to view source; see *Note Using GDB under GNU
4062 * List:: Printing source lines
4063 * Edit:: Editing source files
4064 * Search:: Searching source files
4065 * Source Path:: Specifying source directories
4066 * Machine Code:: Source and machine code
4069 File: gdb.info, Node: List, Next: Edit, Up: Source
4071 7.1 Printing source lines
4072 =========================
4074 To print lines from a source file, use the `list' command (abbreviated
4075 `l'). By default, ten lines are printed. There are several ways to
4076 specify what part of the file you want to print.
4078 Here are the forms of the `list' command most commonly used:
4081 Print lines centered around line number LINENUM in the current
4085 Print lines centered around the beginning of function FUNCTION.
4088 Print more lines. If the last lines printed were printed with a
4089 `list' command, this prints lines following the last lines
4090 printed; however, if the last line printed was a solitary line
4091 printed as part of displaying a stack frame (*note Examining the
4092 Stack: Stack.), this prints lines centered around that line.
4095 Print lines just before the lines last printed.
4097 By default, GDB prints ten source lines with any of these forms of
4098 the `list' command. You can change this using `set listsize':
4100 `set listsize COUNT'
4101 Make the `list' command display COUNT source lines (unless the
4102 `list' argument explicitly specifies some other number).
4105 Display the number of lines that `list' prints.
4107 Repeating a `list' command with <RET> discards the argument, so it
4108 is equivalent to typing just `list'. This is more useful than listing
4109 the same lines again. An exception is made for an argument of `-';
4110 that argument is preserved in repetition so that each repetition moves
4111 up in the source file.
4113 In general, the `list' command expects you to supply zero, one or two
4114 "linespecs". Linespecs specify source lines; there are several ways of
4115 writing them, but the effect is always to specify some source line.
4116 Here is a complete description of the possible arguments for `list':
4119 Print lines centered around the line specified by LINESPEC.
4122 Print lines from FIRST to LAST. Both arguments are linespecs.
4125 Print lines ending with LAST.
4128 Print lines starting with FIRST.
4131 Print lines just after the lines last printed.
4134 Print lines just before the lines last printed.
4137 As described in the preceding table.
4139 Here are the ways of specifying a single source line--all the kinds
4143 Specifies line NUMBER of the current source file. When a `list'
4144 command has two linespecs, this refers to the same source file as
4148 Specifies the line OFFSET lines after the last line printed. When
4149 used as the second linespec in a `list' command that has two, this
4150 specifies the line OFFSET lines down from the first linespec.
4153 Specifies the line OFFSET lines before the last line printed.
4156 Specifies line NUMBER in the source file FILENAME.
4159 Specifies the line that begins the body of the function FUNCTION.
4160 For example: in C, this is the line with the open brace.
4163 Specifies the line of the open-brace that begins the body of the
4164 function FUNCTION in the file FILENAME. You only need the file
4165 name with a function name to avoid ambiguity when there are
4166 identically named functions in different source files.
4169 Specifies the line containing the program address ADDRESS.
4170 ADDRESS may be any expression.
4173 File: gdb.info, Node: Edit, Next: Search, Prev: List, Up: Source
4175 7.2 Editing source files
4176 ========================
4178 To edit the lines in a source file, use the `edit' command. The
4179 editing program of your choice is invoked with the current line set to
4180 the active line in the program. Alternatively, there are several ways
4181 to specify what part of the file you want to print if you want to see
4182 other parts of the program.
4184 Here are the forms of the `edit' command most commonly used:
4187 Edit the current source file at the active line number in the
4191 Edit the current source file with NUMBER as the active line number.
4194 Edit the file containing FUNCTION at the beginning of its
4197 `edit FILENAME:NUMBER'
4198 Specifies line NUMBER in the source file FILENAME.
4200 `edit FILENAME:FUNCTION'
4201 Specifies the line that begins the body of the function FUNCTION
4202 in the file FILENAME. You only need the file name with a function
4203 name to avoid ambiguity when there are identically named functions
4204 in different source files.
4207 Specifies the line containing the program address ADDRESS.
4208 ADDRESS may be any expression.
4210 7.2.1 Choosing your editor
4211 --------------------------
4213 You can customize GDB to use any editor you want (1). By default, it
4214 is `/bin/ex', but you can change this by setting the environment
4215 variable `EDITOR' before using GDB. For example, to configure GDB to
4216 use the `vi' editor, you could use these commands with the `sh' shell:
4220 or in the `csh' shell,
4221 setenv EDITOR /usr/bin/vi
4224 ---------- Footnotes ----------
4226 (1) The only restriction is that your editor (say `ex'), recognizes
4227 the following command-line syntax:
4229 The optional numeric value +NUMBER specifies the number of the line
4230 in the file where to start editing.
4233 File: gdb.info, Node: Search, Next: Source Path, Prev: Edit, Up: Source
4235 7.3 Searching source files
4236 ==========================
4238 There are two commands for searching through the current source file
4239 for a regular expression.
4241 `forward-search REGEXP'
4243 The command `forward-search REGEXP' checks each line, starting
4244 with the one following the last line listed, for a match for
4245 REGEXP. It lists the line that is found. You can use the synonym
4246 `search REGEXP' or abbreviate the command name as `fo'.
4248 `reverse-search REGEXP'
4249 The command `reverse-search REGEXP' checks each line, starting
4250 with the one before the last line listed and going backward, for a
4251 match for REGEXP. It lists the line that is found. You can
4252 abbreviate this command as `rev'.
4255 File: gdb.info, Node: Source Path, Next: Machine Code, Prev: Search, Up: Source
4257 7.4 Specifying source directories
4258 =================================
4260 Executable programs sometimes do not record the directories of the
4261 source files from which they were compiled, just the names. Even when
4262 they do, the directories could be moved between the compilation and
4263 your debugging session. GDB has a list of directories to search for
4264 source files; this is called the "source path". Each time GDB wants a
4265 source file, it tries all the directories in the list, in the order
4266 they are present in the list, until it finds a file with the desired
4269 For example, suppose an executable references the file
4270 `/usr/src/foo-1.0/lib/foo.c', and our source path is `/mnt/cross'. The
4271 file is first looked up literally; if this fails,
4272 `/mnt/cross/usr/src/foo-1.0/lib/foo.c' is tried; if this fails,
4273 `/mnt/cross/foo.c' is opened; if this fails, an error message is
4274 printed. GDB does not look up the parts of the source file name, such
4275 as `/mnt/cross/src/foo-1.0/lib/foo.c'. Likewise, the subdirectories of
4276 the source path are not searched: if the source path is `/mnt/cross',
4277 and the binary refers to `foo.c', GDB would not find it under
4278 `/mnt/cross/usr/src/foo-1.0/lib'.
4280 Plain file names, relative file names with leading directories, file
4281 names containing dots, etc. are all treated as described above; for
4282 instance, if the source path is `/mnt/cross', and the source file is
4283 recorded as `../lib/foo.c', GDB would first try `../lib/foo.c', then
4284 `/mnt/cross/../lib/foo.c', and after that--`/mnt/cross/foo.c'.
4286 Note that the executable search path is _not_ used to locate the
4289 Whenever you reset or rearrange the source path, GDB clears out any
4290 information it has cached about where source files are found and where
4291 each line is in the file.
4293 When you start GDB, its source path includes only `cdir' and `cwd',
4294 in that order. To add other directories, use the `directory' command.
4296 The search path is used to find both program source files and GDB
4297 script files (read using the `-command' option and `source' command).
4299 In addition to the source path, GDB provides a set of commands that
4300 manage a list of source path substitution rules. A "substitution rule"
4301 specifies how to rewrite source directories stored in the program's
4302 debug information in case the sources were moved to a different
4303 directory between compilation and debugging. A rule is made of two
4304 strings, the first specifying what needs to be rewritten in the path,
4305 and the second specifying how it should be rewritten. In *Note set
4306 substitute-path::, we name these two parts FROM and TO respectively.
4307 GDB does a simple string replacement of FROM with TO at the start of
4308 the directory part of the source file name, and uses that result
4309 instead of the original file name to look up the sources.
4311 Using the previous example, suppose the `foo-1.0' tree has been
4312 moved from `/usr/src' to `/mnt/cross', then you can tell GDB to replace
4313 `/usr/src' in all source path names with `/mnt/cross'. The first
4314 lookup will then be `/mnt/cross/foo-1.0/lib/foo.c' in place of the
4315 original location of `/usr/src/foo-1.0/lib/foo.c'. To define a source
4316 path substitution rule, use the `set substitute-path' command (*note
4317 set substitute-path::).
4319 To avoid unexpected substitution results, a rule is applied only if
4320 the FROM part of the directory name ends at a directory separator. For
4321 instance, a rule substituting `/usr/source' into `/mnt/cross' will be
4322 applied to `/usr/source/foo-1.0' but not to `/usr/sourceware/foo-2.0'.
4323 And because the substitution is applied only at the begining of the
4324 directory name, this rule will not be applied to
4325 `/root/usr/source/baz.c' either.
4327 In many cases, you can achieve the same result using the `directory'
4328 command. However, `set substitute-path' can be more efficient in the
4329 case where the sources are organized in a complex tree with multiple
4330 subdirectories. With the `directory' command, you need to add each
4331 subdirectory of your project. If you moved the entire tree while
4332 preserving its internal organization, then `set substitute-path' allows
4333 you to direct the debugger to all the sources with one single command.
4335 `set substitute-path' is also more than just a shortcut command.
4336 The source path is only used if the file at the original location no
4337 longer exists. On the other hand, `set substitute-path' modifies the
4338 debugger behavior to look at the rewritten location instead. So, if
4339 for any reason a source file that is not relevant to your executable is
4340 located at the original location, a substitution rule is the only
4341 method available to point GDB at the new location.
4343 `directory DIRNAME ...'
4346 Add directory DIRNAME to the front of the source path. Several
4347 directory names may be given to this command, separated by `:'
4348 (`;' on MS-DOS and MS-Windows, where `:' usually appears as part
4349 of absolute file names) or whitespace. You may specify a
4350 directory that is already in the source path; this moves it
4351 forward, so GDB searches it sooner.
4353 You can use the string `$cdir' to refer to the compilation
4354 directory (if one is recorded), and `$cwd' to refer to the current
4355 working directory. `$cwd' is not the same as `.'--the former
4356 tracks the current working directory as it changes during your GDB
4357 session, while the latter is immediately expanded to the current
4358 directory at the time you add an entry to the source path.
4361 Reset the source path to its default value (`$cdir:$cwd' on Unix
4362 systems). This requires confirmation.
4365 Print the source path: show which directories it contains.
4367 `set substitute-path FROM TO'
4368 Define a source path substitution rule, and add it at the end of
4369 the current list of existing substitution rules. If a rule with
4370 the same FROM was already defined, then the old rule is also
4373 For example, if the file `/foo/bar/baz.c' was moved to
4374 `/mnt/cross/baz.c', then the command
4376 (gdb) set substitute-path /usr/src /mnt/cross
4378 will tell GDB to replace `/usr/src' with `/mnt/cross', which will
4379 allow GDB to find the file `baz.c' even though it was moved.
4381 In the case when more than one substitution rule have been defined,
4382 the rules are evaluated one by one in the order where they have
4383 been defined. The first one matching, if any, is selected to
4384 perform the substitution.
4386 For instance, if we had entered the following commands:
4388 (gdb) set substitute-path /usr/src/include /mnt/include
4389 (gdb) set substitute-path /usr/src /mnt/src
4391 GDB would then rewrite `/usr/src/include/defs.h' into
4392 `/mnt/include/defs.h' by using the first rule. However, it would
4393 use the second rule to rewrite `/usr/src/lib/foo.c' into
4394 `/mnt/src/lib/foo.c'.
4396 `unset substitute-path [path]'
4397 If a path is specified, search the current list of substitution
4398 rules for a rule that would rewrite that path. Delete that rule
4399 if found. A warning is emitted by the debugger if no rule could
4402 If no path is specified, then all substitution rules are deleted.
4404 `show substitute-path [path]'
4405 If a path is specified, then print the source path substitution
4406 rule which would rewrite that path, if any.
4408 If no path is specified, then print all existing source path
4412 If your source path is cluttered with directories that are no longer
4413 of interest, GDB may sometimes cause confusion by finding the wrong
4414 versions of source. You can correct the situation as follows:
4416 1. Use `directory' with no argument to reset the source path to its
4419 2. Use `directory' with suitable arguments to reinstall the
4420 directories you want in the source path. You can add all the
4421 directories in one command.
4424 File: gdb.info, Node: Machine Code, Prev: Source Path, Up: Source
4426 7.5 Source and machine code
4427 ===========================
4429 You can use the command `info line' to map source lines to program
4430 addresses (and vice versa), and the command `disassemble' to display a
4431 range of addresses as machine instructions. When run under GNU Emacs
4432 mode, the `info line' command causes the arrow to point to the line
4433 specified. Also, `info line' prints addresses in symbolic form as well
4436 `info line LINESPEC'
4437 Print the starting and ending addresses of the compiled code for
4438 source line LINESPEC. You can specify source lines in any of the
4439 ways understood by the `list' command (*note Printing source
4442 For example, we can use `info line' to discover the location of the
4443 object code for the first line of function `m4_changequote':
4445 (gdb) info line m4_changequote
4446 Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350.
4448 We can also inquire (using `*ADDR' as the form for LINESPEC) what
4449 source line covers a particular address:
4450 (gdb) info line *0x63ff
4451 Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.
4453 After `info line', the default address for the `x' command is
4454 changed to the starting address of the line, so that `x/i' is
4455 sufficient to begin examining the machine code (*note Examining memory:
4456 Memory.). Also, this address is saved as the value of the convenience
4457 variable `$_' (*note Convenience variables: Convenience Vars.).
4460 This specialized command dumps a range of memory as machine
4461 instructions. The default memory range is the function
4462 surrounding the program counter of the selected frame. A single
4463 argument to this command is a program counter value; GDB dumps the
4464 function surrounding this value. Two arguments specify a range of
4465 addresses (first inclusive, second exclusive) to dump.
4467 The following example shows the disassembly of a range of addresses
4468 of HP PA-RISC 2.0 code:
4470 (gdb) disas 0x32c4 0x32e4
4471 Dump of assembler code from 0x32c4 to 0x32e4:
4472 0x32c4 <main+204>: addil 0,dp
4473 0x32c8 <main+208>: ldw 0x22c(sr0,r1),r26
4474 0x32cc <main+212>: ldil 0x3000,r31
4475 0x32d0 <main+216>: ble 0x3f8(sr4,r31)
4476 0x32d4 <main+220>: ldo 0(r31),rp
4477 0x32d8 <main+224>: addil -0x800,dp
4478 0x32dc <main+228>: ldo 0x588(r1),r26
4479 0x32e0 <main+232>: ldil 0x3000,r31
4480 End of assembler dump.
4482 Some architectures have more than one commonly-used set of
4483 instruction mnemonics or other syntax.
4485 For programs that were dynamically linked and use shared libraries,
4486 instructions that call functions or branch to locations in the shared
4487 libraries might show a seemingly bogus location--it's actually a
4488 location of the relocation table. On some architectures, GDB might be
4489 able to resolve these to actual function names.
4491 `set disassembly-flavor INSTRUCTION-SET'
4492 Select the instruction set to use when disassembling the program
4493 via the `disassemble' or `x/i' commands.
4495 Currently this command is only defined for the Intel x86 family.
4496 You can set INSTRUCTION-SET to either `intel' or `att'. The
4497 default is `att', the AT&T flavor used by default by Unix
4498 assemblers for x86-based targets.
4500 `show disassembly-flavor'
4501 Show the current setting of the disassembly flavor.
4504 File: gdb.info, Node: Data, Next: Macros, Prev: Source, Up: Top
4509 The usual way to examine data in your program is with the `print'
4510 command (abbreviated `p'), or its synonym `inspect'. It evaluates and
4511 prints the value of an expression of the language your program is
4512 written in (*note Using GDB with Different Languages: Languages.).
4516 EXPR is an expression (in the source language). By default the
4517 value of EXPR is printed in a format appropriate to its data type;
4518 you can choose a different format by specifying `/F', where F is a
4519 letter specifying the format; see *Note Output formats: Output
4524 If you omit EXPR, GDB displays the last value again (from the
4525 "value history"; *note Value history: Value History.). This
4526 allows you to conveniently inspect the same value in an
4529 A more low-level way of examining data is with the `x' command. It
4530 examines data in memory at a specified address and prints it in a
4531 specified format. *Note Examining memory: Memory.
4533 If you are interested in information about types, or about how the
4534 fields of a struct or a class are declared, use the `ptype EXP' command
4535 rather than `print'. *Note Examining the Symbol Table: Symbols.
4539 * Expressions:: Expressions
4540 * Variables:: Program variables
4541 * Arrays:: Artificial arrays
4542 * Output Formats:: Output formats
4543 * Memory:: Examining memory
4544 * Auto Display:: Automatic display
4545 * Print Settings:: Print settings
4546 * Value History:: Value history
4547 * Convenience Vars:: Convenience variables
4548 * Registers:: Registers
4549 * Floating Point Hardware:: Floating point hardware
4550 * Vector Unit:: Vector Unit
4551 * OS Information:: Auxiliary data provided by operating system
4552 * Memory Region Attributes:: Memory region attributes
4553 * Dump/Restore Files:: Copy between memory and a file
4554 * Core File Generation:: Cause a program dump its core
4555 * Character Sets:: Debugging programs that use a different
4556 character set than GDB does
4557 * Caching Remote Data:: Data caching for remote targets
4560 File: gdb.info, Node: Expressions, Next: Variables, Up: Data
4565 `print' and many other GDB commands accept an expression and compute
4566 its value. Any kind of constant, variable or operator defined by the
4567 programming language you are using is valid in an expression in GDB.
4568 This includes conditional expressions, function calls, casts, and
4569 string constants. It also includes preprocessor macros, if you
4570 compiled your program to include this information; see *Note
4573 GDB supports array constants in expressions input by the user. The
4574 syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
4575 `print {1, 2, 3}' to build up an array in memory that is `malloc'ed in
4578 Because C is so widespread, most of the expressions shown in
4579 examples in this manual are in C. *Note Using GDB with Different
4580 Languages: Languages, for information on how to use expressions in other
4583 In this section, we discuss operators that you can use in GDB
4584 expressions regardless of your programming language.
4586 Casts are supported in all languages, not just in C, because it is so
4587 useful to cast a number into a pointer in order to examine a structure
4588 at that address in memory.
4590 GDB supports these operators, in addition to those common to
4591 programming languages:
4594 `@' is a binary operator for treating parts of memory as arrays.
4595 *Note Artificial arrays: Arrays, for more information.
4598 `::' allows you to specify a variable in terms of the file or
4599 function where it is defined. *Note Program variables: Variables.
4602 Refers to an object of type TYPE stored at address ADDR in memory.
4603 ADDR may be any expression whose value is an integer or pointer
4604 (but parentheses are required around binary operators, just as in
4605 a cast). This construct is allowed regardless of what kind of
4606 data is normally supposed to reside at ADDR.
4609 File: gdb.info, Node: Variables, Next: Arrays, Prev: Expressions, Up: Data
4611 8.2 Program variables
4612 =====================
4614 The most common kind of expression to use is the name of a variable in
4617 Variables in expressions are understood in the selected stack frame
4618 (*note Selecting a frame: Selection.); they must be either:
4620 * global (or file-static)
4624 * visible according to the scope rules of the programming language
4625 from the point of execution in that frame
4627 This means that in the function
4639 you can examine and use the variable `a' whenever your program is
4640 executing within the function `foo', but you can only use or examine
4641 the variable `b' while your program is executing inside the block where
4644 There is an exception: you can refer to a variable or function whose
4645 scope is a single source file even if the current execution point is not
4646 in this file. But it is possible to have more than one such variable or
4647 function with the same name (in different source files). If that
4648 happens, referring to that name has unpredictable effects. If you wish,
4649 you can specify a static variable in a particular function or file,
4650 using the colon-colon (`::') notation:
4655 Here FILE or FUNCTION is the name of the context for the static
4656 VARIABLE. In the case of file names, you can use quotes to make sure
4657 GDB parses the file name as a single word--for example, to print a
4658 global value of `x' defined in `f2.c':
4662 This use of `::' is very rarely in conflict with the very similar
4663 use of the same notation in C++. GDB also supports use of the C++
4664 scope resolution operator in GDB expressions.
4666 _Warning:_ Occasionally, a local variable may appear to have the
4667 wrong value at certain points in a function--just after entry to a
4668 new scope, and just before exit.
4669 You may see this problem when you are stepping by machine
4670 instructions. This is because, on most machines, it takes more than
4671 one instruction to set up a stack frame (including local variable
4672 definitions); if you are stepping by machine instructions, variables
4673 may appear to have the wrong values until the stack frame is completely
4674 built. On exit, it usually also takes more than one machine
4675 instruction to destroy a stack frame; after you begin stepping through
4676 that group of instructions, local variable definitions may be gone.
4678 This may also happen when the compiler does significant
4679 optimizations. To be sure of always seeing accurate values, turn off
4680 all optimization when compiling.
4682 Another possible effect of compiler optimizations is to optimize
4683 unused variables out of existence, or assign variables to registers (as
4684 opposed to memory addresses). Depending on the support for such cases
4685 offered by the debug info format used by the compiler, GDB might not be
4686 able to display values for such local variables. If that happens, GDB
4687 will print a message like this:
4689 No symbol "foo" in current context.
4691 To solve such problems, either recompile without optimizations, or
4692 use a different debug info format, if the compiler supports several such
4693 formats. For example, GCC, the GNU C/C++ compiler, usually supports
4694 the `-gstabs+' option. `-gstabs+' produces debug info in a format that
4695 is superior to formats such as COFF. You may be able to use DWARF 2
4696 (`-gdwarf-2'), which is also an effective form for debug info. *Note
4697 Options for Debugging Your Program or GNU CC: (gcc.info)Debugging
4698 Options. *Note Debugging C++: C, for more info about debug info formats
4699 that are best suited to C++ programs.
4701 If you ask to print an object whose contents are unknown to GDB,
4702 e.g., because its data type is not completely specified by the debug
4703 information, GDB will say `<incomplete type>'. *Note incomplete type:
4704 Symbols, for more about this.
4707 File: gdb.info, Node: Arrays, Next: Output Formats, Prev: Variables, Up: Data
4709 8.3 Artificial arrays
4710 =====================
4712 It is often useful to print out several successive objects of the same
4713 type in memory; a section of an array, or an array of dynamically
4714 determined size for which only a pointer exists in the program.
4716 You can do this by referring to a contiguous span of memory as an
4717 "artificial array", using the binary operator `@'. The left operand of
4718 `@' should be the first element of the desired array and be an
4719 individual object. The right operand should be the desired length of
4720 the array. The result is an array value whose elements are all of the
4721 type of the left argument. The first element is actually the left
4722 argument; the second element comes from bytes of memory immediately
4723 following those that hold the first element, and so on. Here is an
4724 example. If a program says
4726 int *array = (int *) malloc (len * sizeof (int));
4728 you can print the contents of `array' with
4732 The left operand of `@' must reside in memory. Array values made
4733 with `@' in this way behave just like other arrays in terms of
4734 subscripting, and are coerced to pointers when used in expressions.
4735 Artificial arrays most often appear in expressions via the value history
4736 (*note Value history: Value History.), after printing one out.
4738 Another way to create an artificial array is to use a cast. This
4739 re-interprets a value as if it were an array. The value need not be in
4741 (gdb) p/x (short[2])0x12345678
4742 $1 = {0x1234, 0x5678}
4744 As a convenience, if you leave the array length out (as in
4745 `(TYPE[])VALUE') GDB calculates the size to fill the value (as
4746 `sizeof(VALUE)/sizeof(TYPE)':
4747 (gdb) p/x (short[])0x12345678
4748 $2 = {0x1234, 0x5678}
4750 Sometimes the artificial array mechanism is not quite enough; in
4751 moderately complex data structures, the elements of interest may not
4752 actually be adjacent--for example, if you are interested in the values
4753 of pointers in an array. One useful work-around in this situation is
4754 to use a convenience variable (*note Convenience variables: Convenience
4755 Vars.) as a counter in an expression that prints the first interesting
4756 value, and then repeat that expression via <RET>. For instance,
4757 suppose you have an array `dtab' of pointers to structures, and you are
4758 interested in the values of a field `fv' in each structure. Here is an
4759 example of what you might type:
4768 File: gdb.info, Node: Output Formats, Next: Memory, Prev: Arrays, Up: Data
4773 By default, GDB prints a value according to its data type. Sometimes
4774 this is not what you want. For example, you might want to print a
4775 number in hex, or a pointer in decimal. Or you might want to view data
4776 in memory at a certain address as a character string or as an
4777 instruction. To do these things, specify an "output format" when you
4780 The simplest use of output formats is to say how to print a value
4781 already computed. This is done by starting the arguments of the
4782 `print' command with a slash and a format letter. The format letters
4786 Regard the bits of the value as an integer, and print the integer
4790 Print as integer in signed decimal.
4793 Print as integer in unsigned decimal.
4796 Print as integer in octal.
4799 Print as integer in binary. The letter `t' stands for "two". (1)
4802 Print as an address, both absolute in hexadecimal and as an offset
4803 from the nearest preceding symbol. You can use this format used
4804 to discover where (in what function) an unknown address is located:
4807 $3 = 0x54320 <_initialize_vx+396>
4809 The command `info symbol 0x54320' yields similar results. *Note
4810 info symbol: Symbols.
4813 Regard as an integer and print it as a character constant. This
4814 prints both the numerical value and its character representation.
4815 The character representation is replaced with the octal escape
4816 `\nnn' for characters outside the 7-bit ASCII range.
4819 Regard the bits of the value as a floating point number and print
4820 using typical floating point syntax.
4822 For example, to print the program counter in hex (*note
4827 Note that no space is required before the slash; this is because command
4828 names in GDB cannot contain a slash.
4830 To reprint the last value in the value history with a different
4831 format, you can use the `print' command with just a format and no
4832 expression. For example, `p/x' reprints the last value in hex.
4834 ---------- Footnotes ----------
4836 (1) `b' cannot be used because these format letters are also used
4837 with the `x' command, where `b' stands for "byte"; see *Note Examining
4841 File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
4843 8.5 Examining memory
4844 ====================
4846 You can use the command `x' (for "examine") to examine memory in any of
4847 several formats, independently of your program's data types.
4852 Use the `x' command to examine memory.
4854 N, F, and U are all optional parameters that specify how much memory
4855 to display and how to format it; ADDR is an expression giving the
4856 address where you want to start displaying memory. If you use defaults
4857 for NFU, you need not type the slash `/'. Several commands set
4858 convenient defaults for ADDR.
4861 The repeat count is a decimal integer; the default is 1. It
4862 specifies how much memory (counting by units U) to display.
4864 F, the display format
4865 The display format is one of the formats used by `print' (`x',
4866 `d', `u', `o', `t', `a', `c', `f'), and in addition `s' (for
4867 null-terminated strings) and `i' (for machine instructions). The
4868 default is `x' (hexadecimal) initially. The default changes each
4869 time you use either `x' or `print'.
4872 The unit size is any of
4878 Halfwords (two bytes).
4881 Words (four bytes). This is the initial default.
4884 Giant words (eight bytes).
4886 Each time you specify a unit size with `x', that size becomes the
4887 default unit the next time you use `x'. (For the `s' and `i'
4888 formats, the unit size is ignored and is normally not written.)
4890 ADDR, starting display address
4891 ADDR is the address where you want GDB to begin displaying memory.
4892 The expression need not have a pointer value (though it may); it
4893 is always interpreted as an integer address of a byte of memory.
4894 *Note Expressions: Expressions, for more information on
4895 expressions. The default for ADDR is usually just after the last
4896 address examined--but several other commands also set the default
4897 address: `info breakpoints' (to the address of the last breakpoint
4898 listed), `info line' (to the starting address of a line), and
4899 `print' (if you use it to display a value from memory).
4901 For example, `x/3uh 0x54320' is a request to display three halfwords
4902 (`h') of memory, formatted as unsigned decimal integers (`u'), starting
4903 at address `0x54320'. `x/4xw $sp' prints the four words (`w') of
4904 memory above the stack pointer (here, `$sp'; *note Registers:
4905 Registers.) in hexadecimal (`x').
4907 Since the letters indicating unit sizes are all distinct from the
4908 letters specifying output formats, you do not have to remember whether
4909 unit size or format comes first; either order works. The output
4910 specifications `4xw' and `4wx' mean exactly the same thing. (However,
4911 the count N must come first; `wx4' does not work.)
4913 Even though the unit size U is ignored for the formats `s' and `i',
4914 you might still want to use a count N; for example, `3i' specifies that
4915 you want to see three machine instructions, including any operands.
4916 The command `disassemble' gives an alternative way of inspecting
4917 machine instructions; see *Note Source and machine code: Machine Code.
4919 All the defaults for the arguments to `x' are designed to make it
4920 easy to continue scanning memory with minimal specifications each time
4921 you use `x'. For example, after you have inspected three machine
4922 instructions with `x/3i ADDR', you can inspect the next seven with just
4923 `x/7'. If you use <RET> to repeat the `x' command, the repeat count N
4924 is used again; the other arguments default as for successive uses of
4927 The addresses and contents printed by the `x' command are not saved
4928 in the value history because there is often too much of them and they
4929 would get in the way. Instead, GDB makes these values available for
4930 subsequent use in expressions as values of the convenience variables
4931 `$_' and `$__'. After an `x' command, the last address examined is
4932 available for use in expressions in the convenience variable `$_'. The
4933 contents of that address, as examined, are available in the convenience
4936 If the `x' command has a repeat count, the address and contents saved
4937 are from the last memory unit printed; this is not the same as the last
4938 address printed if several units were printed on the last line of
4941 When you are debugging a program running on a remote target machine
4942 (*note Remote::), you may wish to verify the program's image in the
4943 remote machine's memory against the executable file you downloaded to
4944 the target. The `compare-sections' command is provided for such
4947 `compare-sections [SECTION-NAME]'
4948 Compare the data of a loadable section SECTION-NAME in the
4949 executable file of the program being debugged with the same
4950 section in the remote machine's memory, and report any mismatches.
4951 With no arguments, compares all loadable sections. This command's
4952 availability depends on the target's support for the `"qCRC"'
4956 File: gdb.info, Node: Auto Display, Next: Print Settings, Prev: Memory, Up: Data
4958 8.6 Automatic display
4959 =====================
4961 If you find that you want to print the value of an expression frequently
4962 (to see how it changes), you might want to add it to the "automatic
4963 display list" so that GDB prints its value each time your program stops.
4964 Each expression added to the list is given a number to identify it; to
4965 remove an expression from the list, you specify that number. The
4966 automatic display looks like this:
4969 3: bar[5] = (struct hack *) 0x3804
4971 This display shows item numbers, expressions and their current values.
4972 As with displays you request manually using `x' or `print', you can
4973 specify the output format you prefer; in fact, `display' decides
4974 whether to use `print' or `x' depending on how elaborate your format
4975 specification is--it uses `x' if you specify a unit size, or one of the
4976 two formats (`i' and `s') that are only supported by `x'; otherwise it
4980 Add the expression EXPR to the list of expressions to display each
4981 time your program stops. *Note Expressions: Expressions.
4983 `display' does not repeat if you press <RET> again after using it.
4986 For FMT specifying only a display format and not a size or count,
4987 add the expression EXPR to the auto-display list but arrange to
4988 display it each time in the specified format FMT. *Note Output
4989 formats: Output Formats.
4992 For FMT `i' or `s', or including a unit-size or a number of units,
4993 add the expression ADDR as a memory address to be examined each
4994 time your program stops. Examining means in effect doing `x/FMT
4995 ADDR'. *Note Examining memory: Memory.
4997 For example, `display/i $pc' can be helpful, to see the machine
4998 instruction about to be executed each time execution stops (`$pc' is a
4999 common name for the program counter; *note Registers: Registers.).
5001 `undisplay DNUMS...'
5002 `delete display DNUMS...'
5003 Remove item numbers DNUMS from the list of expressions to display.
5005 `undisplay' does not repeat if you press <RET> after using it.
5006 (Otherwise you would just get the error `No display number ...'.)
5008 `disable display DNUMS...'
5009 Disable the display of item numbers DNUMS. A disabled display
5010 item is not printed automatically, but is not forgotten. It may be
5011 enabled again later.
5013 `enable display DNUMS...'
5014 Enable display of item numbers DNUMS. It becomes effective once
5015 again in auto display of its expression, until you specify
5019 Display the current values of the expressions on the list, just as
5020 is done when your program stops.
5023 Print the list of expressions previously set up to display
5024 automatically, each one with its item number, but without showing
5025 the values. This includes disabled expressions, which are marked
5026 as such. It also includes expressions which would not be
5027 displayed right now because they refer to automatic variables not
5028 currently available.
5030 If a display expression refers to local variables, then it does not
5031 make sense outside the lexical context for which it was set up. Such an
5032 expression is disabled when execution enters a context where one of its
5033 variables is not defined. For example, if you give the command
5034 `display last_char' while inside a function with an argument
5035 `last_char', GDB displays this argument while your program continues to
5036 stop inside that function. When it stops elsewhere--where there is no
5037 variable `last_char'--the display is disabled automatically. The next
5038 time your program stops where `last_char' is meaningful, you can enable
5039 the display expression once again.
5042 File: gdb.info, Node: Print Settings, Next: Value History, Prev: Auto Display, Up: Data
5047 GDB provides the following ways to control how arrays, structures, and
5048 symbols are printed.
5050 These settings are useful for debugging programs in any language:
5053 `set print address on'
5054 GDB prints memory addresses showing the location of stack traces,
5055 structure values, pointer values, breakpoints, and so forth, even
5056 when it also displays the contents of those addresses. The default
5057 is `on'. For example, this is what a stack frame display looks
5058 like with `set print address on':
5061 #0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
5063 530 if (lquote != def_lquote)
5065 `set print address off'
5066 Do not print addresses when displaying their contents. For
5067 example, this is the same stack frame displayed with `set print
5070 (gdb) set print addr off
5072 #0 set_quotes (lq="<<", rq=">>") at input.c:530
5073 530 if (lquote != def_lquote)
5075 You can use `set print address off' to eliminate all machine
5076 dependent displays from the GDB interface. For example, with
5077 `print address off', you should get the same text for backtraces on
5078 all machines--whether or not they involve pointer arguments.
5080 `show print address'
5081 Show whether or not addresses are to be printed.
5083 When GDB prints a symbolic address, it normally prints the closest
5084 earlier symbol plus an offset. If that symbol does not uniquely
5085 identify the address (for example, it is a name whose scope is a single
5086 source file), you may need to clarify. One way to do this is with
5087 `info line', for example `info line *0x4537'. Alternately, you can set
5088 GDB to print the source file and line number when it prints a symbolic
5091 `set print symbol-filename on'
5092 Tell GDB to print the source file name and line number of a symbol
5093 in the symbolic form of an address.
5095 `set print symbol-filename off'
5096 Do not print source file name and line number of a symbol. This
5099 `show print symbol-filename'
5100 Show whether or not GDB will print the source file name and line
5101 number of a symbol in the symbolic form of an address.
5103 Another situation where it is helpful to show symbol filenames and
5104 line numbers is when disassembling code; GDB shows you the line number
5105 and source file that corresponds to each instruction.
5107 Also, you may wish to see the symbolic form only if the address being
5108 printed is reasonably close to the closest earlier symbol:
5110 `set print max-symbolic-offset MAX-OFFSET'
5111 Tell GDB to only display the symbolic form of an address if the
5112 offset between the closest earlier symbol and the address is less
5113 than MAX-OFFSET. The default is 0, which tells GDB to always
5114 print the symbolic form of an address if any symbol precedes it.
5116 `show print max-symbolic-offset'
5117 Ask how large the maximum offset is that GDB prints in a symbolic
5120 If you have a pointer and you are not sure where it points, try `set
5121 print symbol-filename on'. Then you can determine the name and source
5122 file location of the variable where it points, using `p/a POINTER'.
5123 This interprets the address in symbolic form. For example, here GDB
5124 shows that a variable `ptt' points at another variable `t', defined in
5127 (gdb) set print symbol-filename on
5129 $4 = 0xe008 <t in hi2.c>
5131 _Warning:_ For pointers that point to a local variable, `p/a' does
5132 not show the symbol name and filename of the referent, even with
5133 the appropriate `set print' options turned on.
5135 Other settings control how different kinds of objects are printed:
5138 `set print array on'
5139 Pretty print arrays. This format is more convenient to read, but
5140 uses more space. The default is off.
5142 `set print array off'
5143 Return to compressed format for arrays.
5146 Show whether compressed or pretty format is selected for displaying
5149 `set print array-indexes'
5150 `set print array-indexes on'
5151 Print the index of each element when displaying arrays. May be
5152 more convenient to locate a given element in the array or quickly
5153 find the index of a given element in that printed array. The
5156 `set print array-indexes off'
5157 Stop printing element indexes when displaying arrays.
5159 `show print array-indexes'
5160 Show whether the index of each element is printed when displaying
5163 `set print elements NUMBER-OF-ELEMENTS'
5164 Set a limit on how many elements of an array GDB will print. If
5165 GDB is printing a large array, it stops printing after it has
5166 printed the number of elements set by the `set print elements'
5167 command. This limit also applies to the display of strings. When
5168 GDB starts, this limit is set to 200. Setting NUMBER-OF-ELEMENTS
5169 to zero means that the printing is unlimited.
5171 `show print elements'
5172 Display the number of elements of a large array that GDB will
5173 print. If the number is 0, then the printing is unlimited.
5176 Set the threshold for suppressing display of repeated array
5177 elelments. When the number of consecutive identical elements of an
5178 array exceeds the threshold, GDB prints the string `"<repeats N
5179 times>"', where N is the number of identical repetitions, instead
5180 of displaying the identical elements themselves. Setting the
5181 threshold to zero will cause all elements to be individually
5182 printed. The default threshold is 10.
5184 `show print repeats'
5185 Display the current threshold for printing repeated identical
5188 `set print null-stop'
5189 Cause GDB to stop printing the characters of an array when the
5190 first NULL is encountered. This is useful when large arrays
5191 actually contain only short strings. The default is off.
5193 `show print null-stop'
5194 Show whether GDB stops printing an array on the first NULL
5197 `set print pretty on'
5198 Cause GDB to print structures in an indented format with one member
5199 per line, like this:
5210 `set print pretty off'
5211 Cause GDB to print structures in a compact format, like this:
5213 $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
5216 This is the default format.
5219 Show which format GDB is using to print structures.
5221 `set print sevenbit-strings on'
5222 Print using only seven-bit characters; if this option is set, GDB
5223 displays any eight-bit characters (in strings or character values)
5224 using the notation `\'NNN. This setting is best if you are
5225 working in English (ASCII) and you use the high-order bit of
5226 characters as a marker or "meta" bit.
5228 `set print sevenbit-strings off'
5229 Print full eight-bit characters. This allows the use of more
5230 international character sets, and is the default.
5232 `show print sevenbit-strings'
5233 Show whether or not GDB is printing only seven-bit characters.
5235 `set print union on'
5236 Tell GDB to print unions which are contained in structures and
5237 other unions. This is the default setting.
5239 `set print union off'
5240 Tell GDB not to print unions which are contained in structures and
5241 other unions. GDB will print `"{...}"' instead.
5244 Ask GDB whether or not it will print unions which are contained in
5245 structures and other unions.
5247 For example, given the declarations
5249 typedef enum {Tree, Bug} Species;
5250 typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
5251 typedef enum {Caterpillar, Cocoon, Butterfly}
5262 struct thing foo = {Tree, {Acorn}};
5264 with `set print union on' in effect `p foo' would print
5266 $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
5268 and with `set print union off' in effect it would print
5270 $1 = {it = Tree, form = {...}}
5272 `set print union' affects programs written in C-like languages and
5275 These settings are of interest when debugging C++ programs:
5277 `set print demangle'
5278 `set print demangle on'
5279 Print C++ names in their source form rather than in the encoded
5280 ("mangled") form passed to the assembler and linker for type-safe
5281 linkage. The default is on.
5283 `show print demangle'
5284 Show whether C++ names are printed in mangled or demangled form.
5286 `set print asm-demangle'
5287 `set print asm-demangle on'
5288 Print C++ names in their source form rather than their mangled
5289 form, even in assembler code printouts such as instruction
5290 disassemblies. The default is off.
5292 `show print asm-demangle'
5293 Show whether C++ names in assembly listings are printed in mangled
5296 `set demangle-style STYLE'
5297 Choose among several encoding schemes used by different compilers
5298 to represent C++ names. The choices for STYLE are currently:
5301 Allow GDB to choose a decoding style by inspecting your
5305 Decode based on the GNU C++ compiler (`g++') encoding
5306 algorithm. This is the default.
5309 Decode based on the HP ANSI C++ (`aCC') encoding algorithm.
5312 Decode based on the Lucid C++ compiler (`lcc') encoding
5316 Decode using the algorithm in the `C++ Annotated Reference
5317 Manual'. *Warning:* this setting alone is not sufficient to
5318 allow debugging `cfront'-generated executables. GDB would
5319 require further enhancement to permit that.
5321 If you omit STYLE, you will see a list of possible formats.
5323 `show demangle-style'
5324 Display the encoding style currently in use for decoding C++
5328 `set print object on'
5329 When displaying a pointer to an object, identify the _actual_
5330 (derived) type of the object rather than the _declared_ type, using
5331 the virtual function table.
5333 `set print object off'
5334 Display only the declared type of objects, without reference to the
5335 virtual function table. This is the default setting.
5338 Show whether actual, or declared, object types are displayed.
5340 `set print static-members'
5341 `set print static-members on'
5342 Print static members when displaying a C++ object. The default is
5345 `set print static-members off'
5346 Do not print static members when displaying a C++ object.
5348 `show print static-members'
5349 Show whether C++ static members are printed or not.
5351 `set print pascal_static-members'
5352 `set print pascal_static-members on'
5353 Print static members when displaying a Pascal object. The default
5356 `set print pascal_static-members off'
5357 Do not print static members when displaying a Pascal object.
5359 `show print pascal_static-members'
5360 Show whether Pascal static members are printed or not.
5364 Pretty print C++ virtual function tables. The default is off.
5365 (The `vtbl' commands do not work on programs compiled with the HP
5366 ANSI C++ compiler (`aCC').)
5368 `set print vtbl off'
5369 Do not pretty print C++ virtual function tables.
5372 Show whether C++ virtual function tables are pretty printed, or
5376 File: gdb.info, Node: Value History, Next: Convenience Vars, Prev: Print Settings, Up: Data
5381 Values printed by the `print' command are saved in the GDB "value
5382 history". This allows you to refer to them in other expressions.
5383 Values are kept until the symbol table is re-read or discarded (for
5384 example with the `file' or `symbol-file' commands). When the symbol
5385 table changes, the value history is discarded, since the values may
5386 contain pointers back to the types defined in the symbol table.
5388 The values printed are given "history numbers" by which you can
5389 refer to them. These are successive integers starting with one.
5390 `print' shows you the history number assigned to a value by printing
5391 `$NUM = ' before the value; here NUM is the history number.
5393 To refer to any previous value, use `$' followed by the value's
5394 history number. The way `print' labels its output is designed to
5395 remind you of this. Just `$' refers to the most recent value in the
5396 history, and `$$' refers to the value before that. `$$N' refers to the
5397 Nth value from the end; `$$2' is the value just prior to `$$', `$$1' is
5398 equivalent to `$$', and `$$0' is equivalent to `$'.
5400 For example, suppose you have just printed a pointer to a structure
5401 and want to see the contents of the structure. It suffices to type
5405 If you have a chain of structures where the component `next' points
5406 to the next one, you can print the contents of the next one with this:
5410 You can print successive links in the chain by repeating this
5411 command--which you can do by just typing <RET>.
5413 Note that the history records values, not expressions. If the value
5414 of `x' is 4 and you type these commands:
5419 then the value recorded in the value history by the `print' command
5420 remains 4 even though the value of `x' has changed.
5423 Print the last ten values in the value history, with their item
5424 numbers. This is like `p $$9' repeated ten times, except that
5425 `show values' does not change the history.
5428 Print ten history values centered on history item number N.
5431 Print ten history values just after the values last printed. If
5432 no more values are available, `show values +' produces no display.
5434 Pressing <RET> to repeat `show values N' has exactly the same effect
5438 File: gdb.info, Node: Convenience Vars, Next: Registers, Prev: Value History, Up: Data
5440 8.9 Convenience variables
5441 =========================
5443 GDB provides "convenience variables" that you can use within GDB to
5444 hold on to a value and refer to it later. These variables exist
5445 entirely within GDB; they are not part of your program, and setting a
5446 convenience variable has no direct effect on further execution of your
5447 program. That is why you can use them freely.
5449 Convenience variables are prefixed with `$'. Any name preceded by
5450 `$' can be used for a convenience variable, unless it is one of the
5451 predefined machine-specific register names (*note Registers:
5452 Registers.). (Value history references, in contrast, are _numbers_
5453 preceded by `$'. *Note Value history: Value History.)
5455 You can save a value in a convenience variable with an assignment
5456 expression, just as you would set a variable in your program. For
5459 set $foo = *object_ptr
5461 would save in `$foo' the value contained in the object pointed to by
5464 Using a convenience variable for the first time creates it, but its
5465 value is `void' until you assign a new value. You can alter the value
5466 with another assignment at any time.
5468 Convenience variables have no fixed types. You can assign a
5469 convenience variable any type of value, including structures and
5470 arrays, even if that variable already has a value of a different type.
5471 The convenience variable, when used as an expression, has the type of
5475 Print a list of convenience variables used so far, and their
5476 values. Abbreviated `show conv'.
5478 `init-if-undefined $VARIABLE = EXPRESSION'
5479 Set a convenience variable if it has not already been set. This
5480 is useful for user-defined commands that keep some state. It is
5481 similar, in concept, to using local static variables with
5482 initializers in C (except that convenience variables are global).
5483 It can also be used to allow users to override default values used
5484 in a command script.
5486 If the variable is already defined then the expression is not
5487 evaluated so any side-effects do not occur.
5489 One of the ways to use a convenience variable is as a counter to be
5490 incremented or a pointer to be advanced. For example, to print a field
5491 from successive elements of an array of structures:
5494 print bar[$i++]->contents
5496 Repeat that command by typing <RET>.
5498 Some convenience variables are created automatically by GDB and given
5499 values likely to be useful.
5502 The variable `$_' is automatically set by the `x' command to the
5503 last address examined (*note Examining memory: Memory.). Other
5504 commands which provide a default address for `x' to examine also
5505 set `$_' to that address; these commands include `info line' and
5506 `info breakpoint'. The type of `$_' is `void *' except when set
5507 by the `x' command, in which case it is a pointer to the type of
5511 The variable `$__' is automatically set by the `x' command to the
5512 value found in the last address examined. Its type is chosen to
5513 match the format in which the data was printed.
5516 The variable `$_exitcode' is automatically set to the exit code
5517 when the program being debugged terminates.
5519 On HP-UX systems, if you refer to a function or variable name that
5520 begins with a dollar sign, GDB searches for a user or system name
5521 first, before it searches for a convenience variable.
5524 File: gdb.info, Node: Registers, Next: Floating Point Hardware, Prev: Convenience Vars, Up: Data
5529 You can refer to machine register contents, in expressions, as variables
5530 with names starting with `$'. The names of registers are different for
5531 each machine; use `info registers' to see the names used on your
5535 Print the names and values of all registers except floating-point
5536 and vector registers (in the selected stack frame).
5538 `info all-registers'
5539 Print the names and values of all registers, including
5540 floating-point and vector registers (in the selected stack frame).
5542 `info registers REGNAME ...'
5543 Print the "relativized" value of each specified register REGNAME.
5544 As discussed in detail below, register values are normally
5545 relative to the selected stack frame. REGNAME may be any register
5546 name valid on the machine you are using, with or without the
5549 GDB has four "standard" register names that are available (in
5550 expressions) on most machines--whenever they do not conflict with an
5551 architecture's canonical mnemonics for registers. The register names
5552 `$pc' and `$sp' are used for the program counter register and the stack
5553 pointer. `$fp' is used for a register that contains a pointer to the
5554 current stack frame, and `$ps' is used for a register that contains the
5555 processor status. For example, you could print the program counter in
5560 or print the instruction to be executed next with
5564 or add four to the stack pointer(1) with
5568 Whenever possible, these four standard register names are available
5569 on your machine even though the machine has different canonical
5570 mnemonics, so long as there is no conflict. The `info registers'
5571 command shows the canonical names. For example, on the SPARC, `info
5572 registers' displays the processor status register as `$psr' but you can
5573 also refer to it as `$ps'; and on x86-based machines `$ps' is an alias
5574 for the EFLAGS register.
5576 GDB always considers the contents of an ordinary register as an
5577 integer when the register is examined in this way. Some machines have
5578 special registers which can hold nothing but floating point; these
5579 registers are considered to have floating point values. There is no way
5580 to refer to the contents of an ordinary register as floating point value
5581 (although you can _print_ it as a floating point value with `print/f
5584 Some registers have distinct "raw" and "virtual" data formats. This
5585 means that the data format in which the register contents are saved by
5586 the operating system is not the same one that your program normally
5587 sees. For example, the registers of the 68881 floating point
5588 coprocessor are always saved in "extended" (raw) format, but all C
5589 programs expect to work with "double" (virtual) format. In such cases,
5590 GDB normally works with the virtual format only (the format that makes
5591 sense for your program), but the `info registers' command prints the
5592 data in both formats.
5594 Some machines have special registers whose contents can be
5595 interpreted in several different ways. For example, modern x86-based
5596 machines have SSE and MMX registers that can hold several values packed
5597 together in several different formats. GDB refers to such registers in
5602 v4_float = {0, 3.43859137e-038, 1.54142831e-044, 1.821688e-044},
5603 v2_double = {9.92129282474342e-303, 2.7585945287983262e-313},
5604 v16_int8 = "\000\000\000\000\3706;\001\v\000\000\000\r\000\000",
5605 v8_int16 = {0, 0, 14072, 315, 11, 0, 13, 0},
5606 v4_int32 = {0, 20657912, 11, 13},
5607 v2_int64 = {88725056443645952, 55834574859},
5608 uint128 = 0x0000000d0000000b013b36f800000000
5611 To set values of such registers, you need to tell GDB which view of the
5612 register you wish to change, as if you were assigning value to a
5615 (gdb) set $xmm1.uint128 = 0x000000000000000000000000FFFFFFFF
5617 Normally, register values are relative to the selected stack frame
5618 (*note Selecting a frame: Selection.). This means that you get the
5619 value that the register would contain if all stack frames farther in
5620 were exited and their saved registers restored. In order to see the
5621 true contents of hardware registers, you must select the innermost
5622 frame (with `frame 0').
5624 However, GDB must deduce where registers are saved, from the machine
5625 code generated by your compiler. If some registers are not saved, or if
5626 GDB is unable to locate the saved registers, the selected stack frame
5627 makes no difference.
5629 ---------- Footnotes ----------
5631 (1) This is a way of removing one word from the stack, on machines
5632 where stacks grow downward in memory (most machines, nowadays). This
5633 assumes that the innermost stack frame is selected; setting `$sp' is
5634 not allowed when other stack frames are selected. To pop entire frames
5635 off the stack, regardless of machine architecture, use `return'; see
5636 *Note Returning from a function: Returning.
5639 File: gdb.info, Node: Floating Point Hardware, Next: Vector Unit, Prev: Registers, Up: Data
5641 8.11 Floating point hardware
5642 ============================
5644 Depending on the configuration, GDB may be able to give you more
5645 information about the status of the floating point hardware.
5648 Display hardware-dependent information about the floating point
5649 unit. The exact contents and layout vary depending on the
5650 floating point chip. Currently, `info float' is supported on the
5651 ARM and x86 machines.
5654 File: gdb.info, Node: Vector Unit, Next: OS Information, Prev: Floating Point Hardware, Up: Data
5659 Depending on the configuration, GDB may be able to give you more
5660 information about the status of the vector unit.
5663 Display information about the vector unit. The exact contents and
5664 layout vary depending on the hardware.
5667 File: gdb.info, Node: OS Information, Next: Memory Region Attributes, Prev: Vector Unit, Up: Data
5669 8.13 Operating system auxiliary information
5670 ===========================================
5672 GDB provides interfaces to useful OS facilities that can help you debug
5675 When GDB runs on a "Posix system" (such as GNU or Unix machines), it
5676 interfaces with the inferior via the `ptrace' system call. The
5677 operating system creates a special sata structure, called `struct
5678 user', for this interface. You can use the command `info udot' to
5679 display the contents of this data structure.
5682 Display the contents of the `struct user' maintained by the OS
5683 kernel for the program being debugged. GDB displays the contents
5684 of `struct user' as a list of hex numbers, similar to the
5687 Some operating systems supply an "auxiliary vector" to programs at
5688 startup. This is akin to the arguments and environment that you
5689 specify for a program, but contains a system-dependent variety of
5690 binary values that tell system libraries important details about the
5691 hardware, operating system, and process. Each value's purpose is
5692 identified by an integer tag; the meanings are well-known but
5693 system-specific. Depending on the configuration and operating system
5694 facilities, GDB may be able to show you this information. For remote
5695 targets, this functionality may further depend on the remote stub's
5696 support of the `qXfer:auxv:read' packet, see *Note qXfer auxiliary
5700 Display the auxiliary vector of the inferior, which can be either a
5701 live process or a core dump file. GDB prints each tag value
5702 numerically, and also shows names and text descriptions for
5703 recognized tags. Some values in the vector are numbers, some bit
5704 masks, and some pointers to strings or other data. GDB displays
5705 each value in the most appropriate form for a recognized tag, and
5706 in hexadecimal for an unrecognized tag.
5709 File: gdb.info, Node: Memory Region Attributes, Next: Dump/Restore Files, Prev: OS Information, Up: Data
5711 8.14 Memory region attributes
5712 =============================
5714 "Memory region attributes" allow you to describe special handling
5715 required by regions of your target's memory. GDB uses attributes to
5716 determine whether to allow certain types of memory accesses; whether to
5717 use specific width accesses; and whether to cache target memory. By
5718 default the description of memory regions is fetched from the target
5719 (if the current target supports this), but the user can override the
5722 Defined memory regions can be individually enabled and disabled.
5723 When a memory region is disabled, GDB uses the default attributes when
5724 accessing memory in that region. Similarly, if no memory regions have
5725 been defined, GDB uses the default attributes when accessing all memory.
5727 When a memory region is defined, it is given a number to identify it;
5728 to enable, disable, or remove a memory region, you specify that number.
5730 `mem LOWER UPPER ATTRIBUTES...'
5731 Define a memory region bounded by LOWER and UPPER with attributes
5732 ATTRIBUTES..., and add it to the list of regions monitored by GDB.
5733 Note that UPPER == 0 is a special case: it is treated as the the
5734 target's maximum memory address. (0xffff on 16 bit targets,
5735 0xffffffff on 32 bit targets, etc.)
5738 Discard any user changes to the memory regions and use
5739 target-supplied regions, if available, or no regions if the target
5742 `delete mem NUMS...'
5743 Remove memory regions NUMS... from the list of regions monitored
5746 `disable mem NUMS...'
5747 Disable monitoring of memory regions NUMS.... A disabled memory
5748 region is not forgotten. It may be enabled again later.
5750 `enable mem NUMS...'
5751 Enable monitoring of memory regions NUMS....
5754 Print a table of all defined memory regions, with the following
5755 columns for each region:
5757 _Memory Region Number_
5759 _Enabled or Disabled._
5760 Enabled memory regions are marked with `y'. Disabled memory
5761 regions are marked with `n'.
5764 The address defining the inclusive lower bound of the memory
5768 The address defining the exclusive upper bound of the memory
5772 The list of attributes set for this memory region.
5777 8.14.1.1 Memory Access Mode
5778 ...........................
5780 The access mode attributes set whether GDB may make read or write
5781 accesses to a memory region.
5783 While these attributes prevent GDB from performing invalid memory
5784 accesses, they do nothing to prevent the target system, I/O DMA, etc.
5785 from accessing memory.
5788 Memory is read only.
5791 Memory is write only.
5794 Memory is read/write. This is the default.
5796 8.14.1.2 Memory Access Size
5797 ...........................
5799 The acccess size attributes tells GDB to use specific sized accesses in
5800 the memory region. Often memory mapped device registers require
5801 specific sized accesses. If no access size attribute is specified, GDB
5802 may use accesses of any size.
5805 Use 8 bit memory accesses.
5808 Use 16 bit memory accesses.
5811 Use 32 bit memory accesses.
5814 Use 64 bit memory accesses.
5819 The data cache attributes set whether GDB will cache target memory.
5820 While this generally improves performance by reducing debug protocol
5821 overhead, it can lead to incorrect results because GDB does not know
5822 about volatile variables or memory mapped device registers.
5825 Enable GDB to cache target memory.
5828 Disable GDB from caching target memory. This is the default.
5831 File: gdb.info, Node: Dump/Restore Files, Next: Core File Generation, Prev: Memory Region Attributes, Up: Data
5833 8.15 Copy between memory and a file
5834 ===================================
5836 You can use the commands `dump', `append', and `restore' to copy data
5837 between target memory and a file. The `dump' and `append' commands
5838 write data to a file, and the `restore' command reads data from a file
5839 back into the inferior's memory. Files may be in binary, Motorola
5840 S-record, Intel hex, or Tektronix Hex format; however, GDB can only
5841 append to binary files.
5843 `dump [FORMAT] memory FILENAME START_ADDR END_ADDR'
5844 `dump [FORMAT] value FILENAME EXPR'
5845 Dump the contents of memory from START_ADDR to END_ADDR, or the
5846 value of EXPR, to FILENAME in the given format.
5848 The FORMAT parameter may be any one of:
5856 Motorola S-record format.
5859 Tektronix Hex format.
5861 GDB uses the same definitions of these formats as the GNU binary
5862 utilities, like `objdump' and `objcopy'. If FORMAT is omitted,
5863 GDB dumps the data in raw binary form.
5865 `append [binary] memory FILENAME START_ADDR END_ADDR'
5866 `append [binary] value FILENAME EXPR'
5867 Append the contents of memory from START_ADDR to END_ADDR, or the
5868 value of EXPR, to the file FILENAME, in raw binary form. (GDB can
5869 only append data to files in raw binary form.)
5871 `restore FILENAME [binary] BIAS START END'
5872 Restore the contents of file FILENAME into memory. The `restore'
5873 command can automatically recognize any known BFD file format,
5874 except for raw binary. To restore a raw binary file you must
5875 specify the optional keyword `binary' after the filename.
5877 If BIAS is non-zero, its value will be added to the addresses
5878 contained in the file. Binary files always start at address zero,
5879 so they will be restored at address BIAS. Other bfd files have a
5880 built-in location; they will be restored at offset BIAS from that
5883 If START and/or END are non-zero, then only data between file
5884 offset START and file offset END will be restored. These offsets
5885 are relative to the addresses in the file, before the BIAS
5886 argument is applied.
5890 File: gdb.info, Node: Core File Generation, Next: Character Sets, Prev: Dump/Restore Files, Up: Data
5892 8.16 How to Produce a Core File from Your Program
5893 =================================================
5895 A "core file" or "core dump" is a file that records the memory image of
5896 a running process and its process status (register values etc.). Its
5897 primary use is post-mortem debugging of a program that crashed while it
5898 ran outside a debugger. A program that crashes automatically produces
5899 a core file, unless this feature is disabled by the user. *Note
5900 Files::, for information on invoking GDB in the post-mortem debugging
5903 Occasionally, you may wish to produce a core file of the program you
5904 are debugging in order to preserve a snapshot of its state. GDB has a
5905 special command for that.
5907 `generate-core-file [FILE]'
5909 Produce a core dump of the inferior process. The optional argument
5910 FILE specifies the file name where to put the core dump. If not
5911 specified, the file name defaults to `core.PID', where PID is the
5912 inferior process ID.
5914 Note that this command is implemented only for some systems (as of
5915 this writing, GNU/Linux, FreeBSD, Solaris, Unixware, and S390).
5918 File: gdb.info, Node: Character Sets, Next: Caching Remote Data, Prev: Core File Generation, Up: Data
5923 If the program you are debugging uses a different character set to
5924 represent characters and strings than the one GDB uses itself, GDB can
5925 automatically translate between the character sets for you. The
5926 character set GDB uses we call the "host character set"; the one the
5927 inferior program uses we call the "target character set".
5929 For example, if you are running GDB on a GNU/Linux system, which
5930 uses the ISO Latin 1 character set, but you are using GDB's remote
5931 protocol (*note Remote Debugging: Remote.) to debug a program running
5932 on an IBM mainframe, which uses the EBCDIC character set, then the host
5933 character set is Latin-1, and the target character set is EBCDIC. If
5934 you give GDB the command `set target-charset EBCDIC-US', then GDB
5935 translates between EBCDIC and Latin 1 as you print character or string
5936 values, or use character and string literals in expressions.
5938 GDB has no way to automatically recognize which character set the
5939 inferior program uses; you must tell it, using the `set target-charset'
5940 command, described below.
5942 Here are the commands for controlling GDB's character set support:
5944 `set target-charset CHARSET'
5945 Set the current target character set to CHARSET. We list the
5946 character set names GDB recognizes below, but if you type `set
5947 target-charset' followed by <TAB><TAB>, GDB will list the target
5948 character sets it supports.
5950 `set host-charset CHARSET'
5951 Set the current host character set to CHARSET.
5953 By default, GDB uses a host character set appropriate to the
5954 system it is running on; you can override that default using the
5955 `set host-charset' command.
5957 GDB can only use certain character sets as its host character set.
5958 We list the character set names GDB recognizes below, and
5959 indicate which can be host character sets, but if you type `set
5960 target-charset' followed by <TAB><TAB>, GDB will list the host
5961 character sets it supports.
5963 `set charset CHARSET'
5964 Set the current host and target character sets to CHARSET. As
5965 above, if you type `set charset' followed by <TAB><TAB>, GDB will
5966 list the name of the character sets that can be used for both host
5970 Show the names of the current host and target charsets.
5973 Show the name of the current host charset.
5975 `show target-charset'
5976 Show the name of the current target charset.
5979 GDB currently includes support for the following character sets:
5982 Seven-bit U.S. ASCII. GDB can use this as its host character set.
5985 The ISO Latin 1 character set. This extends ASCII with accented
5986 characters needed for French, German, and Spanish. GDB can use
5987 this as its host character set.
5991 Variants of the EBCDIC character set, used on some of IBM's
5992 mainframe operating systems. (GNU/Linux on the S/390 uses U.S.
5993 ASCII.) GDB cannot use these as its host character set.
5996 Note that these are all single-byte character sets. More work inside
5997 GDB is needed to support multi-byte or variable-width character
5998 encodings, like the UTF-8 and UCS-2 encodings of Unicode.
6000 Here is an example of GDB's character set support in action. Assume
6001 that the following source code has been placed in the file
6007 = {72, 101, 108, 108, 111, 44, 32, 119,
6008 111, 114, 108, 100, 33, 10, 0};
6009 char ibm1047_hello[]
6010 = {200, 133, 147, 147, 150, 107, 64, 166,
6011 150, 153, 147, 132, 90, 37, 0};
6015 printf ("Hello, world!\n");
6018 In this program, `ascii_hello' and `ibm1047_hello' are arrays
6019 containing the string `Hello, world!' followed by a newline, encoded in
6020 the ASCII and IBM1047 character sets.
6022 We compile the program, and invoke the debugger on it:
6024 $ gcc -g charset-test.c -o charset-test
6025 $ gdb -nw charset-test
6026 GNU gdb 2001-12-19-cvs
6027 Copyright 2001 Free Software Foundation, Inc.
6031 We can use the `show charset' command to see what character sets GDB
6032 is currently using to interpret and display characters and strings:
6035 The current host and target character set is `ISO-8859-1'.
6038 For the sake of printing this manual, let's use ASCII as our initial
6040 (gdb) set charset ASCII
6042 The current host and target character set is `ASCII'.
6045 Let's assume that ASCII is indeed the correct character set for our
6046 host system -- in other words, let's assume that if GDB prints
6047 characters using the ASCII character set, our terminal will display
6048 them properly. Since our current target character set is also ASCII,
6049 the contents of `ascii_hello' print legibly:
6051 (gdb) print ascii_hello
6052 $1 = 0x401698 "Hello, world!\n"
6053 (gdb) print ascii_hello[0]
6057 GDB uses the target character set for character and string literals
6058 you use in expressions:
6064 The ASCII character set uses the number 43 to encode the `+'
6067 GDB relies on the user to tell it which character set the target
6068 program uses. If we print `ibm1047_hello' while our target character
6069 set is still ASCII, we get jibberish:
6071 (gdb) print ibm1047_hello
6072 $4 = 0x4016a8 "\310\205\223\223\226k@\246\226\231\223\204Z%"
6073 (gdb) print ibm1047_hello[0]
6077 If we invoke the `set target-charset' followed by <TAB><TAB>, GDB
6078 tells us the character sets it supports:
6080 (gdb) set target-charset
6081 ASCII EBCDIC-US IBM1047 ISO-8859-1
6082 (gdb) set target-charset
6084 We can select IBM1047 as our target character set, and examine the
6085 program's strings again. Now the ASCII string is wrong, but GDB
6086 translates the contents of `ibm1047_hello' from the target character
6087 set, IBM1047, to the host character set, ASCII, and they display
6090 (gdb) set target-charset IBM1047
6092 The current host character set is `ASCII'.
6093 The current target character set is `IBM1047'.
6094 (gdb) print ascii_hello
6095 $6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
6096 (gdb) print ascii_hello[0]
6098 (gdb) print ibm1047_hello
6099 $8 = 0x4016a8 "Hello, world!\n"
6100 (gdb) print ibm1047_hello[0]
6104 As above, GDB uses the target character set for character and string
6105 literals you use in expressions:
6111 The IBM1047 character set uses the number 78 to encode the `+'
6115 File: gdb.info, Node: Caching Remote Data, Prev: Character Sets, Up: Data
6117 8.18 Caching Data of Remote Targets
6118 ===================================
6120 GDB can cache data exchanged between the debugger and a remote target
6121 (*note Remote::). Such caching generally improves performance, because
6122 it reduces the overhead of the remote protocol by bundling memory reads
6123 and writes into large chunks. Unfortunately, GDB does not currently
6124 know anything about volatile registers, and thus data caching will
6125 produce incorrect results when volatile registers are in use.
6127 `set remotecache on'
6128 `set remotecache off'
6129 Set caching state for remote targets. When `ON', use data
6130 caching. By default, this option is `OFF'.
6133 Show the current state of data caching for remote targets.
6136 Print the information about the data cache performance. The
6137 information displayed includes: the dcache width and depth; and for
6138 each cache line, how many times it was referenced, and its data and
6139 state (dirty, bad, ok, etc.). This command is useful for debugging
6140 the data cache operation.
6143 File: gdb.info, Node: Macros, Next: Tracepoints, Prev: Data, Up: Top
6145 9 C Preprocessor Macros
6146 ***********************
6148 Some languages, such as C and C++, provide a way to define and invoke
6149 "preprocessor macros" which expand into strings of tokens. GDB can
6150 evaluate expressions containing macro invocations, show the result of
6151 macro expansion, and show a macro's definition, including where it was
6154 You may need to compile your program specially to provide GDB with
6155 information about preprocessor macros. Most compilers do not include
6156 macros in their debugging information, even when you compile with the
6157 `-g' flag. *Note Compilation::.
6159 A program may define a macro at one point, remove that definition
6160 later, and then provide a different definition after that. Thus, at
6161 different points in the program, a macro may have different
6162 definitions, or have no definition at all. If there is a current stack
6163 frame, GDB uses the macros in scope at that frame's source code line.
6164 Otherwise, GDB uses the macros in scope at the current listing location;
6167 At the moment, GDB does not support the `##' token-splicing
6168 operator, the `#' stringification operator, or variable-arity macros.
6170 Whenever GDB evaluates an expression, it always expands any macro
6171 invocations present in the expression. GDB also provides the following
6172 commands for working with macros explicitly.
6174 `macro expand EXPRESSION'
6175 `macro exp EXPRESSION'
6176 Show the results of expanding all preprocessor macro invocations in
6177 EXPRESSION. Since GDB simply expands macros, but does not parse
6178 the result, EXPRESSION need not be a valid expression; it can be
6179 any string of tokens.
6181 `macro expand-once EXPRESSION'
6182 `macro exp1 EXPRESSION'
6183 (This command is not yet implemented.) Show the results of
6184 expanding those preprocessor macro invocations that appear
6185 explicitly in EXPRESSION. Macro invocations appearing in that
6186 expansion are left unchanged. This command allows you to see the
6187 effect of a particular macro more clearly, without being confused
6188 by further expansions. Since GDB simply expands macros, but does
6189 not parse the result, EXPRESSION need not be a valid expression; it
6190 can be any string of tokens.
6193 Show the definition of the macro named MACRO, and describe the
6194 source location where that definition was established.
6196 `macro define MACRO REPLACEMENT-LIST'
6197 `macro define MACRO(ARGLIST) REPLACEMENT-LIST'
6198 (This command is not yet implemented.) Introduce a definition for
6199 a preprocessor macro named MACRO, invocations of which are replaced
6200 by the tokens given in REPLACEMENT-LIST. The first form of this
6201 command defines an "object-like" macro, which takes no arguments;
6202 the second form defines a "function-like" macro, which takes the
6203 arguments given in ARGLIST.
6205 A definition introduced by this command is in scope in every
6206 expression evaluated in GDB, until it is removed with the `macro
6207 undef' command, described below. The definition overrides all
6208 definitions for MACRO present in the program being debugged, as
6209 well as any previous user-supplied definition.
6212 (This command is not yet implemented.) Remove any user-supplied
6213 definition for the macro named MACRO. This command only affects
6214 definitions provided with the `macro define' command, described
6215 above; it cannot remove definitions present in the program being
6219 (This command is not yet implemented.) List all the macros
6220 defined using the `macro define' command.
6222 Here is a transcript showing the above commands in action. First, we
6223 show our source files:
6230 #define ADD(x) (M + x)
6235 printf ("Hello, world!\n");
6237 printf ("We're so creative.\n");
6239 printf ("Goodbye, world!\n");
6245 Now, we compile the program using the GNU C compiler, GCC. We pass
6246 the `-gdwarf-2' and `-g3' flags to ensure the compiler includes
6247 information about preprocessor macros in the debugging information.
6249 $ gcc -gdwarf-2 -g3 sample.c -o sample
6252 Now, we start GDB on our sample program:
6255 GNU gdb 2002-05-06-cvs
6256 Copyright 2002 Free Software Foundation, Inc.
6257 GDB is free software, ...
6260 We can expand macros and examine their definitions, even when the
6261 program is not running. GDB uses the current listing position to
6262 decide which macro definitions are in scope:
6267 5 #define ADD(x) (M + x)
6272 10 printf ("Hello, world!\n");
6274 12 printf ("We're so creative.\n");
6275 (gdb) info macro ADD
6276 Defined at /home/jimb/gdb/macros/play/sample.c:5
6277 #define ADD(x) (M + x)
6279 Defined at /home/jimb/gdb/macros/play/sample.h:1
6280 included at /home/jimb/gdb/macros/play/sample.c:2
6282 (gdb) macro expand ADD(1)
6283 expands to: (42 + 1)
6284 (gdb) macro expand-once ADD(1)
6285 expands to: once (M + 1)
6288 In the example above, note that `macro expand-once' expands only the
6289 macro invocation explicit in the original text -- the invocation of
6290 `ADD' -- but does not expand the invocation of the macro `M', which was
6291 introduced by `ADD'.
6293 Once the program is running, GDB uses the macro definitions in force
6294 at the source line of the current stack frame:
6297 Breakpoint 1 at 0x8048370: file sample.c, line 10.
6299 Starting program: /home/jimb/gdb/macros/play/sample
6301 Breakpoint 1, main () at sample.c:10
6302 10 printf ("Hello, world!\n");
6305 At line 10, the definition of the macro `N' at line 9 is in force:
6308 Defined at /home/jimb/gdb/macros/play/sample.c:9
6310 (gdb) macro expand N Q M
6316 As we step over directives that remove `N''s definition, and then
6317 give it a new definition, GDB finds the definition (or lack thereof) in
6318 force at each point:
6322 12 printf ("We're so creative.\n");
6324 The symbol `N' has no definition as a C/C++ preprocessor macro
6325 at /home/jimb/gdb/macros/play/sample.c:12
6328 14 printf ("Goodbye, world!\n");
6330 Defined at /home/jimb/gdb/macros/play/sample.c:13
6332 (gdb) macro expand N Q M
6333 expands to: 1729 < 42
6339 File: gdb.info, Node: Tracepoints, Next: Overlays, Prev: Macros, Up: Top
6344 In some applications, it is not feasible for the debugger to interrupt
6345 the program's execution long enough for the developer to learn anything
6346 helpful about its behavior. If the program's correctness depends on
6347 its real-time behavior, delays introduced by a debugger might cause the
6348 program to change its behavior drastically, or perhaps fail, even when
6349 the code itself is correct. It is useful to be able to observe the
6350 program's behavior without interrupting it.
6352 Using GDB's `trace' and `collect' commands, you can specify
6353 locations in the program, called "tracepoints", and arbitrary
6354 expressions to evaluate when those tracepoints are reached. Later,
6355 using the `tfind' command, you can examine the values those expressions
6356 had when the program hit the tracepoints. The expressions may also
6357 denote objects in memory--structures or arrays, for example--whose
6358 values GDB should record; while visiting a particular tracepoint, you
6359 may inspect those objects as if they were in memory at that moment.
6360 However, because GDB records these values without interacting with you,
6361 it can do so quickly and unobtrusively, hopefully not disturbing the
6364 The tracepoint facility is currently available only for remote
6365 targets. *Note Targets::. In addition, your remote target must know
6366 how to collect trace data. This functionality is implemented in the
6367 remote stub; however, none of the stubs distributed with GDB support
6368 tracepoints as of this writing. The format of the remote packets used
6369 to implement tracepoints are described in *Note Tracepoint Packets::.
6371 This chapter describes the tracepoint commands and features.
6376 * Analyze Collected Data::
6377 * Tracepoint Variables::
6380 File: gdb.info, Node: Set Tracepoints, Next: Analyze Collected Data, Up: Tracepoints
6382 10.1 Commands to Set Tracepoints
6383 ================================
6385 Before running such a "trace experiment", an arbitrary number of
6386 tracepoints can be set. Like a breakpoint (*note Set Breaks::), a
6387 tracepoint has a number assigned to it by GDB. Like with breakpoints,
6388 tracepoint numbers are successive integers starting from one. Many of
6389 the commands associated with tracepoints take the tracepoint number as
6390 their argument, to identify which tracepoint to work on.
6392 For each tracepoint, you can specify, in advance, some arbitrary set
6393 of data that you want the target to collect in the trace buffer when it
6394 hits that tracepoint. The collected data can include registers, local
6395 variables, or global data. Later, you can use GDB commands to examine
6396 the values these data had at the time the tracepoint was hit.
6398 This section describes commands to set tracepoints and associated
6399 conditions and actions.
6403 * Create and Delete Tracepoints::
6404 * Enable and Disable Tracepoints::
6405 * Tracepoint Passcounts::
6406 * Tracepoint Actions::
6407 * Listing Tracepoints::
6408 * Starting and Stopping Trace Experiment::
6411 File: gdb.info, Node: Create and Delete Tracepoints, Next: Enable and Disable Tracepoints, Up: Set Tracepoints
6413 10.1.1 Create and Delete Tracepoints
6414 ------------------------------------
6417 The `trace' command is very similar to the `break' command. Its
6418 argument can be a source line, a function name, or an address in
6419 the target program. *Note Set Breaks::. The `trace' command
6420 defines a tracepoint, which is a point in the target program where
6421 the debugger will briefly stop, collect some data, and then allow
6422 the program to continue. Setting a tracepoint or changing its
6423 commands doesn't take effect until the next `tstart' command;
6424 thus, you cannot change the tracepoint attributes once a trace
6425 experiment is running.
6427 Here are some examples of using the `trace' command:
6429 (gdb) trace foo.c:121 // a source file and line number
6431 (gdb) trace +2 // 2 lines forward
6433 (gdb) trace my_function // first source line of function
6435 (gdb) trace *my_function // EXACT start address of function
6437 (gdb) trace *0x2117c4 // an address
6439 You can abbreviate `trace' as `tr'.
6441 The convenience variable `$tpnum' records the tracepoint number of
6442 the most recently set tracepoint.
6444 `delete tracepoint [NUM]'
6445 Permanently delete one or more tracepoints. With no argument, the
6446 default is to delete all tracepoints.
6450 (gdb) delete trace 1 2 3 // remove three tracepoints
6452 (gdb) delete trace // remove all tracepoints
6454 You can abbreviate this command as `del tr'.
6457 File: gdb.info, Node: Enable and Disable Tracepoints, Next: Tracepoint Passcounts, Prev: Create and Delete Tracepoints, Up: Set Tracepoints
6459 10.1.2 Enable and Disable Tracepoints
6460 -------------------------------------
6462 `disable tracepoint [NUM]'
6463 Disable tracepoint NUM, or all tracepoints if no argument NUM is
6464 given. A disabled tracepoint will have no effect during the next
6465 trace experiment, but it is not forgotten. You can re-enable a
6466 disabled tracepoint using the `enable tracepoint' command.
6468 `enable tracepoint [NUM]'
6469 Enable tracepoint NUM, or all tracepoints. The enabled
6470 tracepoints will become effective the next time a trace experiment
6474 File: gdb.info, Node: Tracepoint Passcounts, Next: Tracepoint Actions, Prev: Enable and Disable Tracepoints, Up: Set Tracepoints
6476 10.1.3 Tracepoint Passcounts
6477 ----------------------------
6479 `passcount [N [NUM]]'
6480 Set the "passcount" of a tracepoint. The passcount is a way to
6481 automatically stop a trace experiment. If a tracepoint's
6482 passcount is N, then the trace experiment will be automatically
6483 stopped on the N'th time that tracepoint is hit. If the
6484 tracepoint number NUM is not specified, the `passcount' command
6485 sets the passcount of the most recently defined tracepoint. If no
6486 passcount is given, the trace experiment will run until stopped
6487 explicitly by the user.
6491 (gdb) passcount 5 2 // Stop on the 5th execution of
6494 (gdb) passcount 12 // Stop on the 12th execution of the
6495 `// most recently defined tracepoint.'
6501 (gdb) pass 1 // Stop tracing when foo has been
6502 `// executed 3 times OR when bar has'
6503 `// been executed 2 times'
6504 `// OR when baz has been executed 1 time.'
6508 File: gdb.info, Node: Tracepoint Actions, Next: Listing Tracepoints, Prev: Tracepoint Passcounts, Up: Set Tracepoints
6510 10.1.4 Tracepoint Action Lists
6511 ------------------------------
6514 This command will prompt for a list of actions to be taken when the
6515 tracepoint is hit. If the tracepoint number NUM is not specified,
6516 this command sets the actions for the one that was most recently
6517 defined (so that you can define a tracepoint and then say
6518 `actions' without bothering about its number). You specify the
6519 actions themselves on the following lines, one action at a time,
6520 and terminate the actions list with a line containing just `end'.
6521 So far, the only defined actions are `collect' and
6524 To remove all actions from a tracepoint, type `actions NUM' and
6525 follow it immediately with `end'.
6527 (gdb) collect DATA // collect some data
6529 (gdb) while-stepping 5 // single-step 5 times, collect data
6531 (gdb) end // signals the end of actions.
6533 In the following example, the action list begins with `collect'
6534 commands indicating the things to be collected when the tracepoint
6535 is hit. Then, in order to single-step and collect additional data
6536 following the tracepoint, a `while-stepping' command is used,
6537 followed by the list of things to be collected while stepping. The
6538 `while-stepping' command is terminated by its own separate `end'
6539 command. Lastly, the action list is terminated by an `end'
6544 Enter actions for tracepoint 1, one per line:
6552 `collect EXPR1, EXPR2, ...'
6553 Collect values of the given expressions when the tracepoint is hit.
6554 This command accepts a comma-separated list of any valid
6555 expressions. In addition to global, static, or local variables,
6556 the following special arguments are supported:
6559 collect all registers
6562 collect all function arguments
6565 collect all local variables.
6567 You can give several consecutive `collect' commands, each one with
6568 a single argument, or one `collect' command with several arguments
6569 separated by commas: the effect is the same.
6571 The command `info scope' (*note info scope: Symbols.) is
6572 particularly useful for figuring out what data to collect.
6575 Perform N single-step traces after the tracepoint, collecting new
6576 data at each step. The `while-stepping' command is followed by
6577 the list of what to collect while stepping (followed by its own
6581 > collect $regs, myglobal
6585 You may abbreviate `while-stepping' as `ws' or `stepping'.
6588 File: gdb.info, Node: Listing Tracepoints, Next: Starting and Stopping Trace Experiment, Prev: Tracepoint Actions, Up: Set Tracepoints
6590 10.1.5 Listing Tracepoints
6591 --------------------------
6593 `info tracepoints [NUM]'
6594 Display information about the tracepoint NUM. If you don't specify
6595 a tracepoint number, displays information about all the tracepoints
6596 defined so far. For each tracepoint, the following information is
6601 * whether it is enabled or disabled
6605 * its passcount as given by the `passcount N' command
6607 * its step count as given by the `while-stepping N' command
6609 * where in the source files is the tracepoint set
6611 * its action list as given by the `actions' command
6614 Num Enb Address PassC StepC What
6615 1 y 0x002117c4 0 0 <gdb_asm>
6616 2 y 0x0020dc64 0 0 in g_test at g_test.c:1375
6617 3 y 0x0020b1f4 0 0 in get_data at ../foo.c:41
6620 This command can be abbreviated `info tp'.
6623 File: gdb.info, Node: Starting and Stopping Trace Experiment, Prev: Listing Tracepoints, Up: Set Tracepoints
6625 10.1.6 Starting and Stopping Trace Experiment
6626 ---------------------------------------------
6629 This command takes no arguments. It starts the trace experiment,
6630 and begins collecting data. This has the side effect of
6631 discarding all the data collected in the trace buffer during the
6632 previous trace experiment.
6635 This command takes no arguments. It ends the trace experiment, and
6636 stops collecting data.
6638 *Note*: a trace experiment and data collection may stop
6639 automatically if any tracepoint's passcount is reached (*note
6640 Tracepoint Passcounts::), or if the trace buffer becomes full.
6643 This command displays the status of the current trace data
6646 Here is an example of the commands we described so far:
6648 (gdb) trace gdb_c_test
6650 Enter actions for tracepoint #1, one per line.
6651 > collect $regs,$locals,$args
6661 File: gdb.info, Node: Analyze Collected Data, Next: Tracepoint Variables, Prev: Set Tracepoints, Up: Tracepoints
6663 10.2 Using the collected data
6664 =============================
6666 After the tracepoint experiment ends, you use GDB commands for
6667 examining the trace data. The basic idea is that each tracepoint
6668 collects a trace "snapshot" every time it is hit and another snapshot
6669 every time it single-steps. All these snapshots are consecutively
6670 numbered from zero and go into a buffer, and you can examine them
6671 later. The way you examine them is to "focus" on a specific trace
6672 snapshot. When the remote stub is focused on a trace snapshot, it will
6673 respond to all GDB requests for memory and registers by reading from
6674 the buffer which belongs to that snapshot, rather than from _real_
6675 memory or registers of the program being debugged. This means that
6676 *all* GDB commands (`print', `info registers', `backtrace', etc.) will
6677 behave as if we were currently debugging the program state as it was
6678 when the tracepoint occurred. Any requests for data that are not in
6679 the buffer will fail.
6683 * tfind:: How to select a trace snapshot
6684 * tdump:: How to display all data for a snapshot
6685 * save-tracepoints:: How to save tracepoints for a future run
6688 File: gdb.info, Node: tfind, Next: tdump, Up: Analyze Collected Data
6693 The basic command for selecting a trace snapshot from the buffer is
6694 `tfind N', which finds trace snapshot number N, counting from zero. If
6695 no argument N is given, the next snapshot is selected.
6697 Here are the various forms of using the `tfind' command.
6700 Find the first snapshot in the buffer. This is a synonym for
6701 `tfind 0' (since 0 is the number of the first snapshot).
6704 Stop debugging trace snapshots, resume _live_ debugging.
6707 Same as `tfind none'.
6710 No argument means find the next trace snapshot.
6713 Find the previous trace snapshot before the current one. This
6714 permits retracing earlier steps.
6716 `tfind tracepoint NUM'
6717 Find the next snapshot associated with tracepoint NUM. Search
6718 proceeds forward from the last examined trace snapshot. If no
6719 argument NUM is given, it means find the next snapshot collected
6720 for the same tracepoint as the current snapshot.
6723 Find the next snapshot associated with the value ADDR of the
6724 program counter. Search proceeds forward from the last examined
6725 trace snapshot. If no argument ADDR is given, it means find the
6726 next snapshot with the same value of PC as the current snapshot.
6728 `tfind outside ADDR1, ADDR2'
6729 Find the next snapshot whose PC is outside the given range of
6732 `tfind range ADDR1, ADDR2'
6733 Find the next snapshot whose PC is between ADDR1 and ADDR2.
6735 `tfind line [FILE:]N'
6736 Find the next snapshot associated with the source line N. If the
6737 optional argument FILE is given, refer to line N in that source
6738 file. Search proceeds forward from the last examined trace
6739 snapshot. If no argument N is given, it means find the next line
6740 other than the one currently being examined; thus saying `tfind
6741 line' repeatedly can appear to have the same effect as stepping
6742 from line to line in a _live_ debugging session.
6744 The default arguments for the `tfind' commands are specifically
6745 designed to make it easy to scan through the trace buffer. For
6746 instance, `tfind' with no argument selects the next trace snapshot, and
6747 `tfind -' with no argument selects the previous trace snapshot. So, by
6748 giving one `tfind' command, and then simply hitting <RET> repeatedly
6749 you can examine all the trace snapshots in order. Or, by saying `tfind
6750 -' and then hitting <RET> repeatedly you can examine the snapshots in
6751 reverse order. The `tfind line' command with no argument selects the
6752 snapshot for the next source line executed. The `tfind pc' command with
6753 no argument selects the next snapshot with the same program counter
6754 (PC) as the current frame. The `tfind tracepoint' command with no
6755 argument selects the next trace snapshot collected by the same
6756 tracepoint as the current one.
6758 In addition to letting you scan through the trace buffer manually,
6759 these commands make it easy to construct GDB scripts that scan through
6760 the trace buffer and print out whatever collected data you are
6761 interested in. Thus, if we want to examine the PC, FP, and SP
6762 registers from each trace frame in the buffer, we can say this:
6765 (gdb) while ($trace_frame != -1)
6766 > printf "Frame %d, PC = %08X, SP = %08X, FP = %08X\n", \
6767 $trace_frame, $pc, $sp, $fp
6771 Frame 0, PC = 0020DC64, SP = 0030BF3C, FP = 0030BF44
6772 Frame 1, PC = 0020DC6C, SP = 0030BF38, FP = 0030BF44
6773 Frame 2, PC = 0020DC70, SP = 0030BF34, FP = 0030BF44
6774 Frame 3, PC = 0020DC74, SP = 0030BF30, FP = 0030BF44
6775 Frame 4, PC = 0020DC78, SP = 0030BF2C, FP = 0030BF44
6776 Frame 5, PC = 0020DC7C, SP = 0030BF28, FP = 0030BF44
6777 Frame 6, PC = 0020DC80, SP = 0030BF24, FP = 0030BF44
6778 Frame 7, PC = 0020DC84, SP = 0030BF20, FP = 0030BF44
6779 Frame 8, PC = 0020DC88, SP = 0030BF1C, FP = 0030BF44
6780 Frame 9, PC = 0020DC8E, SP = 0030BF18, FP = 0030BF44
6781 Frame 10, PC = 00203F6C, SP = 0030BE3C, FP = 0030BF14
6783 Or, if we want to examine the variable `X' at each source line in
6787 (gdb) while ($trace_frame != -1)
6788 > printf "Frame %d, X == %d\n", $trace_frame, X
6797 File: gdb.info, Node: tdump, Next: save-tracepoints, Prev: tfind, Up: Analyze Collected Data
6802 This command takes no arguments. It prints all the data collected at
6803 the current trace snapshot.
6807 Enter actions for tracepoint #2, one per line:
6808 > collect $regs, $locals, $args, gdb_long_test
6813 (gdb) tfind line 444
6814 #0 gdb_test (p1=0x11, p2=0x22, p3=0x33, p4=0x44, p5=0x55, p6=0x66)
6816 444 printp( "%s: arguments = 0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n", )
6819 Data collected at tracepoint 2, trace frame 1:
6820 d0 0xc4aa0085 -995491707
6824 d4 0x71aea3d 119204413
6829 a1 0x3000668 50333288
6832 a4 0x3000698 50333336
6834 fp 0x30bf3c 0x30bf3c
6835 sp 0x30bf34 0x30bf34
6837 pc 0x20b2c8 0x20b2c8
6841 p = 0x20e5b4 "gdb-test"
6848 gdb_long_test = 17 '\021'
6853 File: gdb.info, Node: save-tracepoints, Prev: tdump, Up: Analyze Collected Data
6855 10.2.3 `save-tracepoints FILENAME'
6856 ----------------------------------
6858 This command saves all current tracepoint definitions together with
6859 their actions and passcounts, into a file `FILENAME' suitable for use
6860 in a later debugging session. To read the saved tracepoint
6861 definitions, use the `source' command (*note Command Files::).
6864 File: gdb.info, Node: Tracepoint Variables, Prev: Analyze Collected Data, Up: Tracepoints
6866 10.3 Convenience Variables for Tracepoints
6867 ==========================================
6869 `(int) $trace_frame'
6870 The current trace snapshot (a.k.a. "frame") number, or -1 if no
6871 snapshot is selected.
6874 The tracepoint for the current trace snapshot.
6877 The line number for the current trace snapshot.
6879 `(char []) $trace_file'
6880 The source file for the current trace snapshot.
6882 `(char []) $trace_func'
6883 The name of the function containing `$tracepoint'.
6885 Note: `$trace_file' is not suitable for use in `printf', use
6888 Here's a simple example of using these convenience variables for
6889 stepping through all the trace snapshots and printing some of their
6894 (gdb) while $trace_frame != -1
6895 > output $trace_file
6896 > printf ", line %d (tracepoint #%d)\n", $trace_line, $tracepoint
6901 File: gdb.info, Node: Overlays, Next: Languages, Prev: Tracepoints, Up: Top
6903 11 Debugging Programs That Use Overlays
6904 ***************************************
6906 If your program is too large to fit completely in your target system's
6907 memory, you can sometimes use "overlays" to work around this problem.
6908 GDB provides some support for debugging programs that use overlays.
6912 * How Overlays Work:: A general explanation of overlays.
6913 * Overlay Commands:: Managing overlays in GDB.
6914 * Automatic Overlay Debugging:: GDB can find out which overlays are
6915 mapped by asking the inferior.
6916 * Overlay Sample Program:: A sample program using overlays.
6919 File: gdb.info, Node: How Overlays Work, Next: Overlay Commands, Up: Overlays
6921 11.1 How Overlays Work
6922 ======================
6924 Suppose you have a computer whose instruction address space is only 64
6925 kilobytes long, but which has much more memory which can be accessed by
6926 other means: special instructions, segment registers, or memory
6927 management hardware, for example. Suppose further that you want to
6928 adapt a program which is larger than 64 kilobytes to run on this system.
6930 One solution is to identify modules of your program which are
6931 relatively independent, and need not call each other directly; call
6932 these modules "overlays". Separate the overlays from the main program,
6933 and place their machine code in the larger memory. Place your main
6934 program in instruction memory, but leave at least enough space there to
6935 hold the largest overlay as well.
6937 Now, to call a function located in an overlay, you must first copy
6938 that overlay's machine code from the large memory into the space set
6939 aside for it in the instruction memory, and then jump to its entry point
6942 Data Instruction Larger
6943 Address Space Address Space Address Space
6944 +-----------+ +-----------+ +-----------+
6946 +-----------+ +-----------+ +-----------+<-- overlay 1
6947 | program | | main | .----| overlay 1 | load address
6948 | variables | | program | | +-----------+
6949 | and heap | | | | | |
6950 +-----------+ | | | +-----------+<-- overlay 2
6951 | | +-----------+ | | | load address
6952 +-----------+ | | | .-| overlay 2 |
6954 mapped --->+-----------+ | | +-----------+
6956 | overlay | <-' | | |
6957 | area | <---' +-----------+<-- overlay 3
6958 | | <---. | | load address
6959 +-----------+ `--| overlay 3 |
6968 The diagram (*note A code overlay::) shows a system with separate
6969 data and instruction address spaces. To map an overlay, the program
6970 copies its code from the larger address space to the instruction
6971 address space. Since the overlays shown here all use the same mapped
6972 address, only one may be mapped at a time. For a system with a single
6973 address space for data and instructions, the diagram would be similar,
6974 except that the program variables and heap would share an address space
6975 with the main program and the overlay area.
6977 An overlay loaded into instruction memory and ready for use is
6978 called a "mapped" overlay; its "mapped address" is its address in the
6979 instruction memory. An overlay not present (or only partially present)
6980 in instruction memory is called "unmapped"; its "load address" is its
6981 address in the larger memory. The mapped address is also called the
6982 "virtual memory address", or "VMA"; the load address is also called the
6983 "load memory address", or "LMA".
6985 Unfortunately, overlays are not a completely transparent way to
6986 adapt a program to limited instruction memory. They introduce a new
6987 set of global constraints you must keep in mind as you design your
6990 * Before calling or returning to a function in an overlay, your
6991 program must make sure that overlay is actually mapped.
6992 Otherwise, the call or return will transfer control to the right
6993 address, but in the wrong overlay, and your program will probably
6996 * If the process of mapping an overlay is expensive on your system,
6997 you will need to choose your overlays carefully to minimize their
6998 effect on your program's performance.
7000 * The executable file you load onto your system must contain each
7001 overlay's instructions, appearing at the overlay's load address,
7002 not its mapped address. However, each overlay's instructions must
7003 be relocated and its symbols defined as if the overlay were at its
7004 mapped address. You can use GNU linker scripts to specify
7005 different load and relocation addresses for pieces of your
7006 program; see *Note Overlay Description: (ld.info)Overlay
7009 * The procedure for loading executable files onto your system must
7010 be able to load their contents into the larger address space as
7011 well as the instruction and data spaces.
7014 The overlay system described above is rather simple, and could be
7015 improved in many ways:
7017 * If your system has suitable bank switch registers or memory
7018 management hardware, you could use those facilities to make an
7019 overlay's load area contents simply appear at their mapped address
7020 in instruction space. This would probably be faster than copying
7021 the overlay to its mapped area in the usual way.
7023 * If your overlays are small enough, you could set aside more than
7024 one overlay area, and have more than one overlay mapped at a time.
7026 * You can use overlays to manage data, as well as instructions. In
7027 general, data overlays are even less transparent to your design
7028 than code overlays: whereas code overlays only require care when
7029 you call or return to functions, data overlays require care every
7030 time you access the data. Also, if you change the contents of a
7031 data overlay, you must copy its contents back out to its load
7032 address before you can copy a different data overlay into the same
7037 File: gdb.info, Node: Overlay Commands, Next: Automatic Overlay Debugging, Prev: How Overlays Work, Up: Overlays
7039 11.2 Overlay Commands
7040 =====================
7042 To use GDB's overlay support, each overlay in your program must
7043 correspond to a separate section of the executable file. The section's
7044 virtual memory address and load memory address must be the overlay's
7045 mapped and load addresses. Identifying overlays with sections allows
7046 GDB to determine the appropriate address of a function or variable,
7047 depending on whether the overlay is mapped or not.
7049 GDB's overlay commands all start with the word `overlay'; you can
7050 abbreviate this as `ov' or `ovly'. The commands are:
7053 Disable GDB's overlay support. When overlay support is disabled,
7054 GDB assumes that all functions and variables are always present at
7055 their mapped addresses. By default, GDB's overlay support is
7059 Enable "manual" overlay debugging. In this mode, GDB relies on
7060 you to tell it which overlays are mapped, and which are not, using
7061 the `overlay map-overlay' and `overlay unmap-overlay' commands
7064 `overlay map-overlay OVERLAY'
7065 `overlay map OVERLAY'
7066 Tell GDB that OVERLAY is now mapped; OVERLAY must be the name of
7067 the object file section containing the overlay. When an overlay
7068 is mapped, GDB assumes it can find the overlay's functions and
7069 variables at their mapped addresses. GDB assumes that any other
7070 overlays whose mapped ranges overlap that of OVERLAY are now
7073 `overlay unmap-overlay OVERLAY'
7074 `overlay unmap OVERLAY'
7075 Tell GDB that OVERLAY is no longer mapped; OVERLAY must be the
7076 name of the object file section containing the overlay. When an
7077 overlay is unmapped, GDB assumes it can find the overlay's
7078 functions and variables at their load addresses.
7081 Enable "automatic" overlay debugging. In this mode, GDB consults
7082 a data structure the overlay manager maintains in the inferior to
7083 see which overlays are mapped. For details, see *Note Automatic
7084 Overlay Debugging::.
7086 `overlay load-target'
7088 Re-read the overlay table from the inferior. Normally, GDB
7089 re-reads the table GDB automatically each time the inferior stops,
7090 so this command should only be necessary if you have changed the
7091 overlay mapping yourself using GDB. This command is only useful
7092 when using automatic overlay debugging.
7094 `overlay list-overlays'
7096 Display a list of the overlays currently mapped, along with their
7097 mapped addresses, load addresses, and sizes.
7100 Normally, when GDB prints a code address, it includes the name of
7101 the function the address falls in:
7104 $3 = {int ()} 0x11a0 <main>
7105 When overlay debugging is enabled, GDB recognizes code in unmapped
7106 overlays, and prints the names of unmapped functions with asterisks
7107 around them. For example, if `foo' is a function in an unmapped
7108 overlay, GDB prints it this way:
7111 No sections are mapped.
7113 $5 = {int (int)} 0x100000 <*foo*>
7114 When `foo''s overlay is mapped, GDB prints the function's name
7118 Section .ov.foo.text, loaded at 0x100000 - 0x100034,
7119 mapped at 0x1016 - 0x104a
7121 $6 = {int (int)} 0x1016 <foo>
7123 When overlay debugging is enabled, GDB can find the correct address
7124 for functions and variables in an overlay, whether or not the overlay
7125 is mapped. This allows most GDB commands, like `break' and
7126 `disassemble', to work normally, even on unmapped code. However, GDB's
7127 breakpoint support has some limitations:
7129 * You can set breakpoints in functions in unmapped overlays, as long
7130 as GDB can write to the overlay at its load address.
7132 * GDB can not set hardware or simulator-based breakpoints in
7133 unmapped overlays. However, if you set a breakpoint at the end of
7134 your overlay manager (and tell GDB which overlays are now mapped,
7135 if you are using manual overlay management), GDB will re-set its
7136 breakpoints properly.
7139 File: gdb.info, Node: Automatic Overlay Debugging, Next: Overlay Sample Program, Prev: Overlay Commands, Up: Overlays
7141 11.3 Automatic Overlay Debugging
7142 ================================
7144 GDB can automatically track which overlays are mapped and which are
7145 not, given some simple co-operation from the overlay manager in the
7146 inferior. If you enable automatic overlay debugging with the `overlay
7147 auto' command (*note Overlay Commands::), GDB looks in the inferior's
7148 memory for certain variables describing the current state of the
7151 Here are the variables your overlay manager must define to support
7152 GDB's automatic overlay debugging:
7155 This variable must be an array of the following structures:
7159 /* The overlay's mapped address. */
7162 /* The size of the overlay, in bytes. */
7165 /* The overlay's load address. */
7168 /* Non-zero if the overlay is currently mapped;
7170 unsigned long mapped;
7174 This variable must be a four-byte signed integer, holding the total
7175 number of elements in `_ovly_table'.
7178 To decide whether a particular overlay is mapped or not, GDB looks
7179 for an entry in `_ovly_table' whose `vma' and `lma' members equal the
7180 VMA and LMA of the overlay's section in the executable file. When GDB
7181 finds a matching entry, it consults the entry's `mapped' member to
7182 determine whether the overlay is currently mapped.
7184 In addition, your overlay manager may define a function called
7185 `_ovly_debug_event'. If this function is defined, GDB will silently
7186 set a breakpoint there. If the overlay manager then calls this
7187 function whenever it has changed the overlay table, this will enable
7188 GDB to accurately keep track of which overlays are in program memory,
7189 and update any breakpoints that may be set in overlays. This will
7190 allow breakpoints to work even if the overlays are kept in ROM or other
7191 non-writable memory while they are not being executed.
7194 File: gdb.info, Node: Overlay Sample Program, Prev: Automatic Overlay Debugging, Up: Overlays
7196 11.4 Overlay Sample Program
7197 ===========================
7199 When linking a program which uses overlays, you must place the overlays
7200 at their load addresses, while relocating them to run at their mapped
7201 addresses. To do this, you must write a linker script (*note Overlay
7202 Description: (ld.info)Overlay Description.). Unfortunately, since
7203 linker scripts are specific to a particular host system, target
7204 architecture, and target memory layout, this manual cannot provide
7205 portable sample code demonstrating GDB's overlay support.
7207 However, the GDB source distribution does contain an overlaid
7208 program, with linker scripts for a few systems, as part of its test
7209 suite. The program consists of the following files from
7210 `gdb/testsuite/gdb.base':
7213 The main program file.
7216 A simple overlay manager, used by `overlays.c'.
7222 Overlay modules, loaded and used by `overlays.c'.
7226 Linker scripts for linking the test program on the `d10v-elf' and
7229 You can build the test program using the `d10v-elf' GCC
7230 cross-compiler like this:
7232 $ d10v-elf-gcc -g -c overlays.c
7233 $ d10v-elf-gcc -g -c ovlymgr.c
7234 $ d10v-elf-gcc -g -c foo.c
7235 $ d10v-elf-gcc -g -c bar.c
7236 $ d10v-elf-gcc -g -c baz.c
7237 $ d10v-elf-gcc -g -c grbx.c
7238 $ d10v-elf-gcc -g overlays.o ovlymgr.o foo.o bar.o \
7239 baz.o grbx.o -Wl,-Td10v.ld -o overlays
7241 The build process is identical for any other architecture, except
7242 that you must substitute the appropriate compiler and linker script for
7243 the target system for `d10v-elf-gcc' and `d10v.ld'.
7246 File: gdb.info, Node: Languages, Next: Symbols, Prev: Overlays, Up: Top
7248 12 Using GDB with Different Languages
7249 *************************************
7251 Although programming languages generally have common aspects, they are
7252 rarely expressed in the same manner. For instance, in ANSI C,
7253 dereferencing a pointer `p' is accomplished by `*p', but in Modula-2,
7254 it is accomplished by `p^'. Values can also be represented (and
7255 displayed) differently. Hex numbers in C appear as `0x1ae', while in
7256 Modula-2 they appear as `1AEH'.
7258 Language-specific information is built into GDB for some languages,
7259 allowing you to express operations like the above in your program's
7260 native language, and allowing GDB to output values in a manner
7261 consistent with the syntax of your program's native language. The
7262 language you use to build expressions is called the "working language".
7266 * Setting:: Switching between source languages
7267 * Show:: Displaying the language
7268 * Checks:: Type and range checks
7269 * Supported languages:: Supported languages
7270 * Unsupported languages:: Unsupported languages
7273 File: gdb.info, Node: Setting, Next: Show, Up: Languages
7275 12.1 Switching between source languages
7276 =======================================
7278 There are two ways to control the working language--either have GDB set
7279 it automatically, or select it manually yourself. You can use the `set
7280 language' command for either purpose. On startup, GDB defaults to
7281 setting the language automatically. The working language is used to
7282 determine how expressions you type are interpreted, how values are
7285 In addition to the working language, every source file that GDB
7286 knows about has its own working language. For some object file
7287 formats, the compiler might indicate which language a particular source
7288 file is in. However, most of the time GDB infers the language from the
7289 name of the file. The language of a source file controls whether C++
7290 names are demangled--this way `backtrace' can show each frame
7291 appropriately for its own language. There is no way to set the
7292 language of a source file from within GDB, but you can set the language
7293 associated with a filename extension. *Note Displaying the language:
7296 This is most commonly a problem when you use a program, such as
7297 `cfront' or `f2c', that generates C but is written in another language.
7298 In that case, make the program use `#line' directives in its C output;
7299 that way GDB will know the correct language of the source code of the
7300 original program, and will display that source code, not the generated
7305 * Filenames:: Filename extensions and languages.
7306 * Manually:: Setting the working language manually
7307 * Automatically:: Having GDB infer the source language
7310 File: gdb.info, Node: Filenames, Next: Manually, Up: Setting
7312 12.1.1 List of filename extensions and languages
7313 ------------------------------------------------
7315 If a source file name ends in one of the following extensions, then GDB
7316 infers that its language is the one indicated.
7336 Objective-C source file
7343 Modula-2 source file
7347 Assembler source file. This actually behaves almost like C, but
7348 GDB does not skip over function prologues when stepping.
7350 In addition, you may set the language associated with a filename
7351 extension. *Note Displaying the language: Show.
7354 File: gdb.info, Node: Manually, Next: Automatically, Prev: Filenames, Up: Setting
7356 12.1.2 Setting the working language
7357 -----------------------------------
7359 If you allow GDB to set the language automatically, expressions are
7360 interpreted the same way in your debugging session and your program.
7362 If you wish, you may set the language manually. To do this, issue
7363 the command `set language LANG', where LANG is the name of a language,
7364 such as `c' or `modula-2'. For a list of the supported languages, type
7367 Setting the language manually prevents GDB from updating the working
7368 language automatically. This can lead to confusion if you try to debug
7369 a program when the working language is not the same as the source
7370 language, when an expression is acceptable to both languages--but means
7371 different things. For instance, if the current source file were
7372 written in C, and GDB was parsing Modula-2, a command such as:
7376 might not have the effect you intended. In C, this means to add `b'
7377 and `c' and place the result in `a'. The result printed would be the
7378 value of `a'. In Modula-2, this means to compare `a' to the result of
7379 `b+c', yielding a `BOOLEAN' value.
7382 File: gdb.info, Node: Automatically, Prev: Manually, Up: Setting
7384 12.1.3 Having GDB infer the source language
7385 -------------------------------------------
7387 To have GDB set the working language automatically, use `set language
7388 local' or `set language auto'. GDB then infers the working language.
7389 That is, when your program stops in a frame (usually by encountering a
7390 breakpoint), GDB sets the working language to the language recorded for
7391 the function in that frame. If the language for a frame is unknown
7392 (that is, if the function or block corresponding to the frame was
7393 defined in a source file that does not have a recognized extension),
7394 the current working language is not changed, and GDB issues a warning.
7396 This may not seem necessary for most programs, which are written
7397 entirely in one source language. However, program modules and libraries
7398 written in one source language can be used by a main program written in
7399 a different source language. Using `set language auto' in this case
7400 frees you from having to set the working language manually.
7403 File: gdb.info, Node: Show, Next: Checks, Prev: Setting, Up: Languages
7405 12.2 Displaying the language
7406 ============================
7408 The following commands help you find out which language is the working
7409 language, and also what language source files were written in.
7412 Display the current working language. This is the language you
7413 can use with commands such as `print' to build and compute
7414 expressions that may involve variables in your program.
7417 Display the source language for this frame. This language becomes
7418 the working language if you use an identifier from this frame.
7419 *Note Information about a frame: Frame Info, to identify the other
7420 information listed here.
7423 Display the source language of this source file. *Note Examining
7424 the Symbol Table: Symbols, to identify the other information
7427 In unusual circumstances, you may have source files with extensions
7428 not in the standard list. You can then set the extension associated
7429 with a language explicitly:
7431 `set extension-language EXT LANGUAGE'
7432 Tell GDB that source files with extension EXT are to be assumed as
7433 written in the source language LANGUAGE.
7436 List all the filename extensions and the associated languages.
7439 File: gdb.info, Node: Checks, Next: Supported languages, Prev: Show, Up: Languages
7441 12.3 Type and range checking
7442 ============================
7444 _Warning:_ In this release, the GDB commands for type and range
7445 checking are included, but they do not yet have any effect. This
7446 section documents the intended facilities.
7448 Some languages are designed to guard you against making seemingly
7449 common errors through a series of compile- and run-time checks. These
7450 include checking the type of arguments to functions and operators, and
7451 making sure mathematical overflows are caught at run time. Checks such
7452 as these help to ensure a program's correctness once it has been
7453 compiled by eliminating type mismatches, and providing active checks
7454 for range errors when your program is running.
7456 GDB can check for conditions like the above if you wish. Although
7457 GDB does not check the statements in your program, it can check
7458 expressions entered directly into GDB for evaluation via the `print'
7459 command, for example. As with the working language, GDB can also
7460 decide whether or not to check automatically based on your program's
7461 source language. *Note Supported languages: Supported languages, for
7462 the default settings of supported languages.
7466 * Type Checking:: An overview of type checking
7467 * Range Checking:: An overview of range checking
7470 File: gdb.info, Node: Type Checking, Next: Range Checking, Up: Checks
7472 12.3.1 An overview of type checking
7473 -----------------------------------
7475 Some languages, such as Modula-2, are strongly typed, meaning that the
7476 arguments to operators and functions have to be of the correct type,
7477 otherwise an error occurs. These checks prevent type mismatch errors
7478 from ever causing any run-time problems. For example,
7484 The second example fails because the `CARDINAL' 1 is not
7485 type-compatible with the `REAL' 2.3.
7487 For the expressions you use in GDB commands, you can tell the GDB
7488 type checker to skip checking; to treat any mismatches as errors and
7489 abandon the expression; or to only issue warnings when type mismatches
7490 occur, but evaluate the expression anyway. When you choose the last of
7491 these, GDB evaluates expressions like the second example above, but
7492 also issues a warning.
7494 Even if you turn type checking off, there may be other reasons
7495 related to type that prevent GDB from evaluating an expression. For
7496 instance, GDB does not know how to add an `int' and a `struct foo'.
7497 These particular type errors have nothing to do with the language in
7498 use, and usually arise from expressions, such as the one described
7499 above, which make little sense to evaluate anyway.
7501 Each language defines to what degree it is strict about type. For
7502 instance, both Modula-2 and C require the arguments to arithmetical
7503 operators to be numbers. In C, enumerated types and pointers can be
7504 represented as numbers, so that they are valid arguments to mathematical
7505 operators. *Note Supported languages: Supported languages, for further
7506 details on specific languages.
7508 GDB provides some additional commands for controlling the type
7511 `set check type auto'
7512 Set type checking on or off based on the current working language.
7513 *Note Supported languages: Supported languages, for the default
7514 settings for each language.
7517 `set check type off'
7518 Set type checking on or off, overriding the default setting for the
7519 current working language. Issue a warning if the setting does not
7520 match the language default. If any type mismatches occur in
7521 evaluating an expression while type checking is on, GDB prints a
7522 message and aborts evaluation of the expression.
7524 `set check type warn'
7525 Cause the type checker to issue warnings, but to always attempt to
7526 evaluate the expression. Evaluating the expression may still be
7527 impossible for other reasons. For example, GDB cannot add numbers
7531 Show the current setting of the type checker, and whether or not
7532 GDB is setting it automatically.
7535 File: gdb.info, Node: Range Checking, Prev: Type Checking, Up: Checks
7537 12.3.2 An overview of range checking
7538 ------------------------------------
7540 In some languages (such as Modula-2), it is an error to exceed the
7541 bounds of a type; this is enforced with run-time checks. Such range
7542 checking is meant to ensure program correctness by making sure
7543 computations do not overflow, or indices on an array element access do
7544 not exceed the bounds of the array.
7546 For expressions you use in GDB commands, you can tell GDB to treat
7547 range errors in one of three ways: ignore them, always treat them as
7548 errors and abandon the expression, or issue warnings but evaluate the
7551 A range error can result from numerical overflow, from exceeding an
7552 array index bound, or when you type a constant that is not a member of
7553 any type. Some languages, however, do not treat overflows as an error.
7554 In many implementations of C, mathematical overflow causes the result
7555 to "wrap around" to lower values--for example, if M is the largest
7556 integer value, and S is the smallest, then
7560 This, too, is specific to individual languages, and in some cases
7561 specific to individual compilers or machines. *Note Supported
7562 languages: Supported languages, for further details on specific
7565 GDB provides some additional commands for controlling the range
7568 `set check range auto'
7569 Set range checking on or off based on the current working language.
7570 *Note Supported languages: Supported languages, for the default
7571 settings for each language.
7573 `set check range on'
7574 `set check range off'
7575 Set range checking on or off, overriding the default setting for
7576 the current working language. A warning is issued if the setting
7577 does not match the language default. If a range error occurs and
7578 range checking is on, then a message is printed and evaluation of
7579 the expression is aborted.
7581 `set check range warn'
7582 Output messages when the GDB range checker detects a range error,
7583 but attempt to evaluate the expression anyway. Evaluating the
7584 expression may still be impossible for other reasons, such as
7585 accessing memory that the process does not own (a typical example
7586 from many Unix systems).
7589 Show the current setting of the range checker, and whether or not
7590 it is being set automatically by GDB.
7593 File: gdb.info, Node: Supported languages, Next: Unsupported languages, Prev: Checks, Up: Languages
7595 12.4 Supported languages
7596 ========================
7598 GDB supports C, C++, Objective-C, Fortran, Java, Pascal, assembly,
7599 Modula-2, and Ada. Some GDB features may be used in expressions
7600 regardless of the language you use: the GDB `@' and `::' operators, and
7601 the `{type}addr' construct (*note Expressions: Expressions.) can be
7602 used with the constructs of any supported language.
7604 The following sections detail to what degree each source language is
7605 supported by GDB. These sections are not meant to be language
7606 tutorials or references, but serve only as a reference guide to what the
7607 GDB expression parser accepts, and what input and output formats should
7608 look like for different languages. There are many good books written
7609 on each of these languages; please look to these for a language
7610 reference or tutorial.
7615 * Objective-C:: Objective-C
7618 * Modula-2:: Modula-2
7622 File: gdb.info, Node: C, Next: Objective-C, Up: Supported languages
7627 Since C and C++ are so closely related, many features of GDB apply to
7628 both languages. Whenever this is the case, we discuss those languages
7631 The C++ debugging facilities are jointly implemented by the C++
7632 compiler and GDB. Therefore, to debug your C++ code effectively, you
7633 must compile your C++ programs with a supported C++ compiler, such as
7634 GNU `g++', or the HP ANSI C++ compiler (`aCC').
7636 For best results when using GNU C++, use the DWARF 2 debugging
7637 format; if it doesn't work on your system, try the stabs+ debugging
7638 format. You can select those formats explicitly with the `g++'
7639 command-line options `-gdwarf-2' and `-gstabs+'. *Note Options for
7640 Debugging Your Program or GNU CC: (gcc.info)Debugging Options.
7644 * C Operators:: C and C++ operators
7645 * C Constants:: C and C++ constants
7646 * C plus plus expressions:: C++ expressions
7647 * C Defaults:: Default settings for C and C++
7648 * C Checks:: C and C++ type and range checks
7649 * Debugging C:: GDB and C
7650 * Debugging C plus plus:: GDB features for C++
7653 File: gdb.info, Node: C Operators, Next: C Constants, Up: C
7655 12.4.1.1 C and C++ operators
7656 ............................
7658 Operators must be defined on values of specific types. For instance,
7659 `+' is defined on numbers, but not on structures. Operators are often
7660 defined on groups of types.
7662 For the purposes of C and C++, the following definitions hold:
7664 * _Integral types_ include `int' with any of its storage-class
7665 specifiers; `char'; `enum'; and, for C++, `bool'.
7667 * _Floating-point types_ include `float', `double', and `long
7668 double' (if supported by the target platform).
7670 * _Pointer types_ include all types defined as `(TYPE *)'.
7672 * _Scalar types_ include all of the above.
7675 The following operators are supported. They are listed here in order
7676 of increasing precedence:
7679 The comma or sequencing operator. Expressions in a
7680 comma-separated list are evaluated from left to right, with the
7681 result of the entire expression being the last expression
7685 Assignment. The value of an assignment expression is the value
7686 assigned. Defined on scalar types.
7689 Used in an expression of the form `A OP= B', and translated to
7690 `A = A OP B'. `OP=' and `=' have the same precedence. OP is any
7691 one of the operators `|', `^', `&', `<<', `>>', `+', `-', `*',
7695 The ternary operator. `A ? B : C' can be thought of as: if A
7696 then B else C. A should be of an integral type.
7699 Logical OR. Defined on integral types.
7702 Logical AND. Defined on integral types.
7705 Bitwise OR. Defined on integral types.
7708 Bitwise exclusive-OR. Defined on integral types.
7711 Bitwise AND. Defined on integral types.
7714 Equality and inequality. Defined on scalar types. The value of
7715 these expressions is 0 for false and non-zero for true.
7718 Less than, greater than, less than or equal, greater than or equal.
7719 Defined on scalar types. The value of these expressions is 0 for
7720 false and non-zero for true.
7723 left shift, and right shift. Defined on integral types.
7726 The GDB "artificial array" operator (*note Expressions:
7730 Addition and subtraction. Defined on integral types,
7731 floating-point types and pointer types.
7734 Multiplication, division, and modulus. Multiplication and
7735 division are defined on integral and floating-point types.
7736 Modulus is defined on integral types.
7739 Increment and decrement. When appearing before a variable, the
7740 operation is performed before the variable is used in an
7741 expression; when appearing after it, the variable's value is used
7742 before the operation takes place.
7745 Pointer dereferencing. Defined on pointer types. Same precedence
7749 Address operator. Defined on variables. Same precedence as `++'.
7751 For debugging C++, GDB implements a use of `&' beyond what is
7752 allowed in the C++ language itself: you can use `&(&REF)' (or, if
7753 you prefer, simply `&&REF') to examine the address where a C++
7754 reference variable (declared with `&REF') is stored.
7757 Negative. Defined on integral and floating-point types. Same
7761 Logical negation. Defined on integral types. Same precedence as
7765 Bitwise complement operator. Defined on integral types. Same
7769 Structure member, and pointer-to-structure member. For
7770 convenience, GDB regards the two as equivalent, choosing whether
7771 to dereference a pointer based on the stored type information.
7772 Defined on `struct' and `union' data.
7775 Dereferences of pointers to members.
7778 Array indexing. `A[I]' is defined as `*(A+I)'. Same precedence
7782 Function parameter list. Same precedence as `->'.
7785 C++ scope resolution operator. Defined on `struct', `union', and
7789 Doubled colons also represent the GDB scope operator (*note
7790 Expressions: Expressions.). Same precedence as `::', above.
7792 If an operator is redefined in the user code, GDB usually attempts
7793 to invoke the redefined version instead of using the operator's
7801 File: gdb.info, Node: C Constants, Next: C plus plus expressions, Prev: C Operators, Up: C
7803 12.4.1.2 C and C++ constants
7804 ............................
7806 GDB allows you to express the constants of C and C++ in the following
7809 * Integer constants are a sequence of digits. Octal constants are
7810 specified by a leading `0' (i.e. zero), and hexadecimal constants
7811 by a leading `0x' or `0X'. Constants may also end with a letter
7812 `l', specifying that the constant should be treated as a `long'
7815 * Floating point constants are a sequence of digits, followed by a
7816 decimal point, followed by a sequence of digits, and optionally
7817 followed by an exponent. An exponent is of the form:
7818 `e[[+]|-]NNN', where NNN is another sequence of digits. The `+'
7819 is optional for positive exponents. A floating-point constant may
7820 also end with a letter `f' or `F', specifying that the constant
7821 should be treated as being of the `float' (as opposed to the
7822 default `double') type; or with a letter `l' or `L', which
7823 specifies a `long double' constant.
7825 * Enumerated constants consist of enumerated identifiers, or their
7826 integral equivalents.
7828 * Character constants are a single character surrounded by single
7829 quotes (`''), or a number--the ordinal value of the corresponding
7830 character (usually its ASCII value). Within quotes, the single
7831 character may be represented by a letter or by "escape sequences",
7832 which are of the form `\NNN', where NNN is the octal representation
7833 of the character's ordinal value; or of the form `\X', where `X'
7834 is a predefined special character--for example, `\n' for newline.
7836 * String constants are a sequence of character constants surrounded
7837 by double quotes (`"'). Any valid character constant (as described
7838 above) may appear. Double quotes within the string must be
7839 preceded by a backslash, so for instance `"a\"b'c"' is a string of
7842 * Pointer constants are an integral value. You can also write
7843 pointers to constants using the C operator `&'.
7845 * Array constants are comma-separated lists surrounded by braces `{'
7846 and `}'; for example, `{1,2,3}' is a three-element array of
7847 integers, `{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
7848 `{&"hi", &"there", &"fred"}' is a three-element array of pointers.
7852 * C plus plus expressions::
7859 File: gdb.info, Node: C plus plus expressions, Next: C Defaults, Prev: C Constants, Up: C
7861 12.4.1.3 C++ expressions
7862 ........................
7864 GDB expression handling can interpret most C++ expressions.
7866 _Warning:_ GDB can only debug C++ code if you use the proper
7867 compiler and the proper debug format. Currently, GDB works best
7868 when debugging C++ code that is compiled with GCC 2.95.3 or with
7869 GCC 3.1 or newer, using the options `-gdwarf-2' or `-gstabs+'.
7870 DWARF 2 is preferred over stabs+. Most configurations of GCC emit
7871 either DWARF 2 or stabs+ as their default debug format, so you
7872 usually don't need to specify a debug format explicitly. Other
7873 compilers and/or debug formats are likely to work badly or not at
7874 all when using GDB to debug C++ code.
7876 1. Member function calls are allowed; you can use expressions like
7878 count = aml->GetOriginal(x, y)
7880 2. While a member function is active (in the selected stack frame),
7881 your expressions have the same namespace available as the member
7882 function; that is, GDB allows implicit references to the class
7883 instance pointer `this' following the same rules as C++.
7885 3. You can call overloaded functions; GDB resolves the function call
7886 to the right definition, with some restrictions. GDB does not
7887 perform overload resolution involving user-defined type
7888 conversions, calls to constructors, or instantiations of templates
7889 that do not exist in the program. It also cannot handle ellipsis
7890 argument lists or default arguments.
7892 It does perform integral conversions and promotions, floating-point
7893 promotions, arithmetic conversions, pointer conversions,
7894 conversions of class objects to base classes, and standard
7895 conversions such as those of functions or arrays to pointers; it
7896 requires an exact match on the number of function arguments.
7898 Overload resolution is always performed, unless you have specified
7899 `set overload-resolution off'. *Note GDB features for C++:
7900 Debugging C plus plus.
7902 You must specify `set overload-resolution off' in order to use an
7903 explicit function signature to call an overloaded function, as in
7904 p 'foo(char,int)'('x', 13)
7906 The GDB command-completion facility can simplify this; see *Note
7907 Command completion: Completion.
7909 4. GDB understands variables declared as C++ references; you can use
7910 them in expressions just as you do in C++ source--they are
7911 automatically dereferenced.
7913 In the parameter list shown when GDB displays a frame, the values
7914 of reference variables are not displayed (unlike other variables);
7915 this avoids clutter, since references are often used for large
7916 structures. The _address_ of a reference variable is always
7917 shown, unless you have specified `set print address off'.
7919 5. GDB supports the C++ name resolution operator `::'--your
7920 expressions can use it just as expressions in your program do.
7921 Since one scope may be defined in another, you can use `::'
7922 repeatedly if necessary, for example in an expression like
7923 `SCOPE1::SCOPE2::NAME'. GDB also allows resolving name scope by
7924 reference to source files, in both C and C++ debugging (*note
7925 Program variables: Variables.).
7927 In addition, when used with HP's C++ compiler, GDB supports calling
7928 virtual functions correctly, printing out virtual bases of objects,
7929 calling functions in a base subobject, casting objects, and invoking
7930 user-defined operators.
7933 File: gdb.info, Node: C Defaults, Next: C Checks, Prev: C plus plus expressions, Up: C
7935 12.4.1.4 C and C++ defaults
7936 ...........................
7938 If you allow GDB to set type and range checking automatically, they
7939 both default to `off' whenever the working language changes to C or
7940 C++. This happens regardless of whether you or GDB selects the working
7943 If you allow GDB to set the language automatically, it recognizes
7944 source files whose names end with `.c', `.C', or `.cc', etc, and when
7945 GDB enters code compiled from one of these files, it sets the working
7946 language to C or C++. *Note Having GDB infer the source language:
7947 Automatically, for further details.
7950 File: gdb.info, Node: C Checks, Next: Debugging C, Prev: C Defaults, Up: C
7952 12.4.1.5 C and C++ type and range checks
7953 ........................................
7955 By default, when GDB parses C or C++ expressions, type checking is not
7956 used. However, if you turn type checking on, GDB considers two
7957 variables type equivalent if:
7959 * The two variables are structured and have the same structure,
7960 union, or enumerated tag.
7962 * The two variables have the same type name, or types that have been
7963 declared equivalent through `typedef'.
7966 Range checking, if turned on, is done on mathematical operations.
7967 Array indices are not checked, since they are often used to index a
7968 pointer that is not itself an array.
7971 File: gdb.info, Node: Debugging C, Next: Debugging C plus plus, Prev: C Checks, Up: C
7976 The `set print union' and `show print union' commands apply to the
7977 `union' type. When set to `on', any `union' that is inside a `struct'
7978 or `class' is also printed. Otherwise, it appears as `{...}'.
7980 The `@' operator aids in the debugging of dynamic arrays, formed
7981 with pointers and a memory allocation function. *Note Expressions:
7986 * Debugging C plus plus::
7989 File: gdb.info, Node: Debugging C plus plus, Prev: Debugging C, Up: C
7991 12.4.1.7 GDB features for C++
7992 .............................
7994 Some GDB commands are particularly useful with C++, and some are
7995 designed specifically for use with C++. Here is a summary:
7998 When you want a breakpoint in a function whose name is overloaded,
7999 GDB breakpoint menus help you specify which function definition
8000 you want. *Note Breakpoint menus: Breakpoint Menus.
8003 Setting breakpoints using regular expressions is helpful for
8004 setting breakpoints on overloaded functions that are not members
8005 of any special classes. *Note Setting breakpoints: Set Breaks.
8009 Debug C++ exception handling using these commands. *Note Setting
8010 catchpoints: Set Catchpoints.
8013 Print inheritance relationships as well as other information for
8014 type TYPENAME. *Note Examining the Symbol Table: Symbols.
8016 `set print demangle'
8017 `show print demangle'
8018 `set print asm-demangle'
8019 `show print asm-demangle'
8020 Control whether C++ symbols display in their source form, both when
8021 displaying code as C++ source and when displaying disassemblies.
8022 *Note Print settings: Print Settings.
8026 Choose whether to print derived (actual) or declared types of
8027 objects. *Note Print settings: Print Settings.
8031 Control the format for printing virtual function tables. *Note
8032 Print settings: Print Settings. (The `vtbl' commands do not work
8033 on programs compiled with the HP ANSI C++ compiler (`aCC').)
8035 `set overload-resolution on'
8036 Enable overload resolution for C++ expression evaluation. The
8037 default is on. For overloaded functions, GDB evaluates the
8038 arguments and searches for a function whose signature matches the
8039 argument types, using the standard C++ conversion rules (see *Note
8040 C++ expressions: C plus plus expressions, for details). If it
8041 cannot find a match, it emits a message.
8043 `set overload-resolution off'
8044 Disable overload resolution for C++ expression evaluation. For
8045 overloaded functions that are not class member functions, GDB
8046 chooses the first function of the specified name that it finds in
8047 the symbol table, whether or not its arguments are of the correct
8048 type. For overloaded functions that are class member functions,
8049 GDB searches for a function whose signature _exactly_ matches the
8052 `show overload-resolution'
8053 Show the current setting of overload resolution.
8055 `Overloaded symbol names'
8056 You can specify a particular definition of an overloaded symbol,
8057 using the same notation that is used to declare such symbols in
8058 C++: type `SYMBOL(TYPES)' rather than just SYMBOL. You can also
8059 use the GDB command-line word completion facilities to list the
8060 available choices, or to finish the type list for you. *Note
8061 Command completion: Completion, for details on how to do this.
8064 File: gdb.info, Node: Objective-C, Next: Fortran, Prev: C, Up: Supported languages
8069 This section provides information about some commands and command
8070 options that are useful for debugging Objective-C code. See also *Note
8071 info classes: Symbols, and *Note info selectors: Symbols, for a few
8072 more commands specific to Objective-C support.
8076 * Method Names in Commands::
8077 * The Print Command with Objective-C::
8080 File: gdb.info, Node: Method Names in Commands, Next: The Print Command with Objective-C, Prev: Objective-C, Up: Objective-C
8082 12.4.2.1 Method Names in Commands
8083 .................................
8085 The following commands have been extended to accept Objective-C method
8086 names as line specifications:
8098 A fully qualified Objective-C method name is specified as
8102 where the minus sign is used to indicate an instance method and a
8103 plus sign (not shown) is used to indicate a class method. The class
8104 name CLASS and method name METHODNAME are enclosed in brackets, similar
8105 to the way messages are specified in Objective-C source code. For
8106 example, to set a breakpoint at the `create' instance method of class
8107 `Fruit' in the program currently being debugged, enter:
8109 break -[Fruit create]
8111 To list ten program lines around the `initialize' class method,
8114 list +[NSText initialize]
8116 In the current version of GDB, the plus or minus sign is required.
8117 In future versions of GDB, the plus or minus sign will be optional, but
8118 you can use it to narrow the search. It is also possible to specify
8123 You must specify the complete method name, including any colons. If
8124 your program's source files contain more than one `create' method,
8125 you'll be presented with a numbered list of classes that implement that
8126 method. Indicate your choice by number, or type `0' to exit if none
8129 As another example, to clear a breakpoint established at the
8130 `makeKeyAndOrderFront:' method of the `NSWindow' class, enter:
8132 clear -[NSWindow makeKeyAndOrderFront:]
8135 File: gdb.info, Node: The Print Command with Objective-C, Prev: Method Names in Commands, Up: Objective-C
8137 12.4.2.2 The Print Command With Objective-C
8138 ...........................................
8140 The print command has also been extended to accept methods. For
8143 print -[OBJECT hash]
8145 will tell GDB to send the `hash' message to OBJECT and print the
8146 result. Also, an additional command has been added, `print-object' or
8147 `po' for short, which is meant to print the description of an object.
8148 However, this command may only work with certain Objective-C libraries
8149 that have a particular hook function, `_NSPrintForDebugger', defined.
8152 File: gdb.info, Node: Fortran, Next: Pascal, Prev: Objective-C, Up: Supported languages
8157 GDB can be used to debug programs written in Fortran, but it currently
8158 supports only the features of Fortran 77 language.
8160 Some Fortran compilers (GNU Fortran 77 and Fortran 95 compilers
8161 among them) append an underscore to the names of variables and
8162 functions. When you debug programs compiled by those compilers, you
8163 will need to refer to variables and functions with a trailing
8168 * Fortran Operators:: Fortran operators and expressions
8169 * Fortran Defaults:: Default settings for Fortran
8170 * Special Fortran commands:: Special GDB commands for Fortran
8173 File: gdb.info, Node: Fortran Operators, Next: Fortran Defaults, Up: Fortran
8175 12.4.3.1 Fortran operators and expressions
8176 ..........................................
8178 Operators must be defined on values of specific types. For instance,
8179 `+' is defined on numbers, but not on characters or other non-
8180 arithmetic types. Operators are often defined on groups of types.
8183 The exponentiation operator. It raises the first operand to the
8184 power of the second one.
8187 The range operator. Normally used in the form of array(low:high)
8188 to represent a section of array.
8191 File: gdb.info, Node: Fortran Defaults, Next: Special Fortran commands, Prev: Fortran Operators, Up: Fortran
8193 12.4.3.2 Fortran Defaults
8194 .........................
8196 Fortran symbols are usually case-insensitive, so GDB by default uses
8197 case-insensitive matches for Fortran symbols. You can change that with
8198 the `set case-insensitive' command, see *Note Symbols::, for the
8202 File: gdb.info, Node: Special Fortran commands, Prev: Fortran Defaults, Up: Fortran
8204 12.4.3.3 Special Fortran commands
8205 .................................
8207 GDB had some commands to support Fortran specific feature, such as
8208 common block displaying.
8210 `info common [COMMON-NAME]'
8211 This command prints the values contained in the Fortran `COMMON'
8212 block whose name is COMMON-NAME. With no argument, the names of
8213 all `COMMON' blocks visible at current program location are
8217 File: gdb.info, Node: Pascal, Next: Modula-2, Prev: Fortran, Up: Supported languages
8222 Debugging Pascal programs which use sets, subranges, file variables, or
8223 nested functions does not currently work. GDB does not support
8224 entering expressions, printing values, or similar features using Pascal
8227 The Pascal-specific command `set print pascal_static-members'
8228 controls whether static members of Pascal objects are displayed. *Note
8229 pascal_static-members: Print Settings.
8232 File: gdb.info, Node: Modula-2, Next: Ada, Prev: Pascal, Up: Supported languages
8237 The extensions made to GDB to support Modula-2 only support output from
8238 the GNU Modula-2 compiler (which is currently being developed). Other
8239 Modula-2 compilers are not currently supported, and attempting to debug
8240 executables produced by them is most likely to give an error as GDB
8241 reads in the executable's symbol table.
8245 * M2 Operators:: Built-in operators
8246 * Built-In Func/Proc:: Built-in functions and procedures
8247 * M2 Constants:: Modula-2 constants
8248 * M2 Types:: Modula-2 types
8249 * M2 Defaults:: Default settings for Modula-2
8250 * Deviations:: Deviations from standard Modula-2
8251 * M2 Checks:: Modula-2 type and range checks
8252 * M2 Scope:: The scope operators `::' and `.'
8253 * GDB/M2:: GDB and Modula-2
8256 File: gdb.info, Node: M2 Operators, Next: Built-In Func/Proc, Up: Modula-2
8261 Operators must be defined on values of specific types. For instance,
8262 `+' is defined on numbers, but not on structures. Operators are often
8263 defined on groups of types. For the purposes of Modula-2, the
8264 following definitions hold:
8266 * _Integral types_ consist of `INTEGER', `CARDINAL', and their
8269 * _Character types_ consist of `CHAR' and its subranges.
8271 * _Floating-point types_ consist of `REAL'.
8273 * _Pointer types_ consist of anything declared as `POINTER TO TYPE'.
8275 * _Scalar types_ consist of all of the above.
8277 * _Set types_ consist of `SET' and `BITSET' types.
8279 * _Boolean types_ consist of `BOOLEAN'.
8281 The following operators are supported, and appear in order of
8282 increasing precedence:
8285 Function argument or array index separator.
8288 Assignment. The value of VAR `:=' VALUE is VALUE.
8291 Less than, greater than on integral, floating-point, or enumerated
8295 Less than or equal to, greater than or equal to on integral,
8296 floating-point and enumerated types, or set inclusion on set
8297 types. Same precedence as `<'.
8300 Equality and two ways of expressing inequality, valid on scalar
8301 types. Same precedence as `<'. In GDB scripts, only `<>' is
8302 available for inequality, since `#' conflicts with the script
8306 Set membership. Defined on set types and the types of their
8307 members. Same precedence as `<'.
8310 Boolean disjunction. Defined on boolean types.
8313 Boolean conjunction. Defined on boolean types.
8316 The GDB "artificial array" operator (*note Expressions:
8320 Addition and subtraction on integral and floating-point types, or
8321 union and difference on set types.
8324 Multiplication on integral and floating-point types, or set
8325 intersection on set types.
8328 Division on floating-point types, or symmetric set difference on
8329 set types. Same precedence as `*'.
8332 Integer division and remainder. Defined on integral types. Same
8336 Negative. Defined on `INTEGER' and `REAL' data.
8339 Pointer dereferencing. Defined on pointer types.
8342 Boolean negation. Defined on boolean types. Same precedence as
8346 `RECORD' field selector. Defined on `RECORD' data. Same
8350 Array indexing. Defined on `ARRAY' data. Same precedence as `^'.
8353 Procedure argument list. Defined on `PROCEDURE' objects. Same
8357 GDB and Modula-2 scope operators.
8359 _Warning:_ Set expressions and their operations are not yet
8360 supported, so GDB treats the use of the operator `IN', or the use
8361 of operators `+', `-', `*', `/', `=', , `<>', `#', `<=', and `>='
8362 on sets as an error.
8365 File: gdb.info, Node: Built-In Func/Proc, Next: M2 Constants, Prev: M2 Operators, Up: Modula-2
8367 12.4.5.2 Built-in functions and procedures
8368 ..........................................
8370 Modula-2 also makes available several built-in procedures and functions.
8371 In describing these, the following metavariables are used:
8374 represents an `ARRAY' variable.
8377 represents a `CHAR' constant or variable.
8380 represents a variable or constant of integral type.
8383 represents an identifier that belongs to a set. Generally used in
8384 the same function with the metavariable S. The type of S should
8385 be `SET OF MTYPE' (where MTYPE is the type of M).
8388 represents a variable or constant of integral or floating-point
8392 represents a variable or constant of floating-point type.
8398 represents a variable.
8401 represents a variable or constant of one of many types. See the
8402 explanation of the function for details.
8404 All Modula-2 built-in procedures also return a result, described
8408 Returns the absolute value of N.
8411 If C is a lower case letter, it returns its upper case equivalent,
8412 otherwise it returns its argument.
8415 Returns the character whose ordinal value is I.
8418 Decrements the value in the variable V by one. Returns the new
8422 Decrements the value in the variable V by I. Returns the new
8426 Removes the element M from the set S. Returns the new set.
8429 Returns the floating point equivalent of the integer I.
8432 Returns the index of the last member of A.
8435 Increments the value in the variable V by one. Returns the new
8439 Increments the value in the variable V by I. Returns the new
8443 Adds the element M to the set S if it is not already there.
8444 Returns the new set.
8447 Returns the maximum value of the type T.
8450 Returns the minimum value of the type T.
8453 Returns boolean TRUE if I is an odd number.
8456 Returns the ordinal value of its argument. For example, the
8457 ordinal value of a character is its ASCII value (on machines
8458 supporting the ASCII character set). X must be of an ordered
8459 type, which include integral, character and enumerated types.
8462 Returns the size of its argument. X can be a variable or a type.
8465 Returns the integral part of R.
8468 Returns the member of the type T whose ordinal value is I.
8470 _Warning:_ Sets and their operations are not yet supported, so
8471 GDB treats the use of procedures `INCL' and `EXCL' as an error.
8474 File: gdb.info, Node: M2 Constants, Next: M2 Types, Prev: Built-In Func/Proc, Up: Modula-2
8479 GDB allows you to express the constants of Modula-2 in the following
8482 * Integer constants are simply a sequence of digits. When used in an
8483 expression, a constant is interpreted to be type-compatible with
8484 the rest of the expression. Hexadecimal integers are specified by
8485 a trailing `H', and octal integers by a trailing `B'.
8487 * Floating point constants appear as a sequence of digits, followed
8488 by a decimal point and another sequence of digits. An optional
8489 exponent can then be specified, in the form `E[+|-]NNN', where
8490 `[+|-]NNN' is the desired exponent. All of the digits of the
8491 floating point constant must be valid decimal (base 10) digits.
8493 * Character constants consist of a single character enclosed by a
8494 pair of like quotes, either single (`'') or double (`"'). They may
8495 also be expressed by their ordinal value (their ASCII value,
8496 usually) followed by a `C'.
8498 * String constants consist of a sequence of characters enclosed by a
8499 pair of like quotes, either single (`'') or double (`"'). Escape
8500 sequences in the style of C are also allowed. *Note C and C++
8501 constants: C Constants, for a brief explanation of escape
8504 * Enumerated constants consist of an enumerated identifier.
8506 * Boolean constants consist of the identifiers `TRUE' and `FALSE'.
8508 * Pointer constants consist of integral values only.
8510 * Set constants are not yet supported.
8513 File: gdb.info, Node: M2 Types, Next: M2 Defaults, Prev: M2 Constants, Up: Modula-2
8515 12.4.5.4 Modula-2 Types
8516 .......................
8518 Currently GDB can print the following data types in Modula-2 syntax:
8519 array types, record types, set types, pointer types, procedure types,
8520 enumerated types, subrange types and base types. You can also print
8521 the contents of variables declared using these type. This section
8522 gives a number of simple source code examples together with sample GDB
8525 The first example contains the following section of code:
8531 and you can request GDB to interrogate the type and value of `r' and
8543 Likewise if your source code declares `s' as:
8548 then you may query the type of `s' by:
8551 type = SET ['A'..'Z']
8553 Note that at present you cannot interactively manipulate set
8554 expressions using the debugger.
8556 The following example shows how you might declare an array in
8557 Modula-2 and how you can interact with GDB to print its type and
8561 s: ARRAY [-10..10] OF CHAR ;
8564 ARRAY [-10..10] OF CHAR
8566 Note that the array handling is not yet complete and although the
8567 type is printed correctly, expression handling still assumes that all
8568 arrays have a lower bound of zero and not `-10' as in the example
8569 above. Unbounded arrays are also not yet recognized in GDB.
8571 Here are some more type related Modula-2 examples:
8574 colour = (blue, red, yellow, green) ;
8575 t = [blue..yellow] ;
8581 The GDB interaction shows how you can query the data type and value of
8587 type = [blue..yellow]
8589 In this example a Modula-2 array is declared and its contents
8590 displayed. Observe that the contents are written in the same way as
8591 their `C' counterparts.
8594 s: ARRAY [1..5] OF CARDINAL ;
8599 $1 = {1, 0, 0, 0, 0}
8601 type = ARRAY [1..5] OF CARDINAL
8603 The Modula-2 language interface to GDB also understands pointer
8604 types as shown in this example:
8607 s: POINTER TO ARRAY [1..5] OF CARDINAL ;
8612 and you can request that GDB describes the type of `s'.
8615 type = POINTER TO ARRAY [1..5] OF CARDINAL
8617 GDB handles compound types as we can see in this example. Here we
8618 combine array types, record types, pointer types and subrange types:
8627 myarray = ARRAY myrange OF CARDINAL ;
8630 s: POINTER TO ARRAY myrange OF foo ;
8632 and you can ask GDB to describe the type of `s' as shown below.
8635 type = POINTER TO ARRAY [-2..2] OF foo = RECORD
8638 f3 : ARRAY [-2..2] OF CARDINAL;
8642 File: gdb.info, Node: M2 Defaults, Next: Deviations, Prev: M2 Types, Up: Modula-2
8644 12.4.5.5 Modula-2 defaults
8645 ..........................
8647 If type and range checking are set automatically by GDB, they both
8648 default to `on' whenever the working language changes to Modula-2.
8649 This happens regardless of whether you or GDB selected the working
8652 If you allow GDB to set the language automatically, then entering
8653 code compiled from a file whose name ends with `.mod' sets the working
8654 language to Modula-2. *Note Having GDB set the language automatically:
8655 Automatically, for further details.
8658 File: gdb.info, Node: Deviations, Next: M2 Checks, Prev: M2 Defaults, Up: Modula-2
8660 12.4.5.6 Deviations from standard Modula-2
8661 ..........................................
8663 A few changes have been made to make Modula-2 programs easier to debug.
8664 This is done primarily via loosening its type strictness:
8666 * Unlike in standard Modula-2, pointer constants can be formed by
8667 integers. This allows you to modify pointer variables during
8668 debugging. (In standard Modula-2, the actual address contained in
8669 a pointer variable is hidden from you; it can only be modified
8670 through direct assignment to another pointer variable or
8671 expression that returned a pointer.)
8673 * C escape sequences can be used in strings and characters to
8674 represent non-printable characters. GDB prints out strings with
8675 these escape sequences embedded. Single non-printable characters
8676 are printed using the `CHR(NNN)' format.
8678 * The assignment operator (`:=') returns the value of its right-hand
8681 * All built-in procedures both modify _and_ return their argument.
8684 File: gdb.info, Node: M2 Checks, Next: M2 Scope, Prev: Deviations, Up: Modula-2
8686 12.4.5.7 Modula-2 type and range checks
8687 .......................................
8689 _Warning:_ in this release, GDB does not yet perform type or range
8692 GDB considers two Modula-2 variables type equivalent if:
8694 * They are of types that have been declared equivalent via a `TYPE
8697 * They have been declared on the same line. (Note: This is true of
8698 the GNU Modula-2 compiler, but it may not be true of other
8701 As long as type checking is enabled, any attempt to combine variables
8702 whose types are not equivalent is an error.
8704 Range checking is done on all mathematical operations, assignment,
8705 array index bounds, and all built-in functions and procedures.
8708 File: gdb.info, Node: M2 Scope, Next: GDB/M2, Prev: M2 Checks, Up: Modula-2
8710 12.4.5.8 The scope operators `::' and `.'
8711 .........................................
8713 There are a few subtle differences between the Modula-2 scope operator
8714 (`.') and the GDB scope operator (`::'). The two have similar syntax:
8720 where SCOPE is the name of a module or a procedure, MODULE the name of
8721 a module, and ID is any declared identifier within your program, except
8724 Using the `::' operator makes GDB search the scope specified by
8725 SCOPE for the identifier ID. If it is not found in the specified
8726 scope, then GDB searches all scopes enclosing the one specified by
8729 Using the `.' operator makes GDB search the current scope for the
8730 identifier specified by ID that was imported from the definition module
8731 specified by MODULE. With this operator, it is an error if the
8732 identifier ID was not imported from definition module MODULE, or if ID
8733 is not an identifier in MODULE.
8736 File: gdb.info, Node: GDB/M2, Prev: M2 Scope, Up: Modula-2
8738 12.4.5.9 GDB and Modula-2
8739 .........................
8741 Some GDB commands have little use when debugging Modula-2 programs.
8742 Five subcommands of `set print' and `show print' apply specifically to
8743 C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'.
8744 The first four apply to C++, and the last to the C `union' type, which
8745 has no direct analogue in Modula-2.
8747 The `@' operator (*note Expressions: Expressions.), while available
8748 with any language, is not useful with Modula-2. Its intent is to aid
8749 the debugging of "dynamic arrays", which cannot be created in Modula-2
8750 as they can in C or C++. However, because an address can be specified
8751 by an integral constant, the construct `{TYPE}ADREXP' is still useful.
8753 In GDB scripts, the Modula-2 inequality operator `#' is interpreted
8754 as the beginning of a comment. Use `<>' instead.
8757 File: gdb.info, Node: Ada, Prev: Modula-2, Up: Supported languages
8762 The extensions made to GDB for Ada only support output from the GNU Ada
8763 (GNAT) compiler. Other Ada compilers are not currently supported, and
8764 attempting to debug executables produced by them is most likely to be
8769 * Ada Mode Intro:: General remarks on the Ada syntax
8770 and semantics supported by Ada mode
8772 * Omissions from Ada:: Restrictions on the Ada expression syntax.
8773 * Additions to Ada:: Extensions of the Ada expression syntax.
8774 * Stopping Before Main Program:: Debugging the program during elaboration.
8775 * Ada Glitches:: Known peculiarities of Ada mode.
8778 File: gdb.info, Node: Ada Mode Intro, Next: Omissions from Ada, Up: Ada
8780 12.4.6.1 Introduction
8781 .....................
8783 The Ada mode of GDB supports a fairly large subset of Ada expression
8784 syntax, with some extensions. The philosophy behind the design of this
8787 * That GDB should provide basic literals and access to operations for
8788 arithmetic, dereferencing, field selection, indexing, and
8789 subprogram calls, leaving more sophisticated computations to
8790 subprograms written into the program (which therefore may be
8793 * That type safety and strict adherence to Ada language restrictions
8794 are not particularly important to the GDB user.
8796 * That brevity is important to the GDB user.
8798 Thus, for brevity, the debugger acts as if there were implicit
8799 `with' and `use' clauses in effect for all user-written packages,
8800 making it unnecessary to fully qualify most names with their packages,
8801 regardless of context. Where this causes ambiguity, GDB asks the
8804 The debugger will start in Ada mode if it detects an Ada main
8805 program. As for other languages, it will enter Ada mode when stopped
8806 in a program that was translated from an Ada source file.
8808 While in Ada mode, you may use `-' for comments. This is useful
8809 mostly for documenting command files. The standard GDB comment (`#')
8810 still works at the beginning of a line in Ada mode, but not in the
8811 middle (to allow based literals).
8813 The debugger supports limited overloading. Given a subprogram call
8814 in which the function symbol has multiple definitions, it will use the
8815 number of actual parameters and some information about their types to
8816 attempt to narrow the set of definitions. It also makes very limited
8817 use of context, preferring procedures to functions in the context of
8818 the `call' command, and functions to procedures elsewhere.
8821 File: gdb.info, Node: Omissions from Ada, Next: Additions to Ada, Prev: Ada Mode Intro, Up: Ada
8823 12.4.6.2 Omissions from Ada
8824 ...........................
8826 Here are the notable omissions from the subset:
8828 * Only a subset of the attributes are supported:
8830 - 'First, 'Last, and 'Length on array objects (not on types
8839 - 'Range on array objects (not subtypes), but only as the right
8840 operand of the membership (`in') operator.
8842 - 'Access, 'Unchecked_Access, and 'Unrestricted_Access (a GNAT
8847 * The names in `Characters.Latin_1' are not available and
8848 concatenation is not implemented. Thus, escape characters in
8849 strings are not currently available.
8851 * Equality tests (`=' and `/=') on arrays test for bitwise equality
8852 of representations. They will generally work correctly for
8853 strings and arrays whose elements have integer or enumeration
8854 types. They may not work correctly for arrays whose element types
8855 have user-defined equality, for arrays of real values (in
8856 particular, IEEE-conformant floating point, because of negative
8857 zeroes and NaNs), and for arrays whose elements contain unused
8858 bits with indeterminate values.
8860 * The other component-by-component array operations (`and', `or',
8861 `xor', `not', and relational tests other than equality) are not
8864 * There is limited support for array and record aggregates. They are
8865 permitted only on the right sides of assignments, as in these
8868 set An_Array := (1, 2, 3, 4, 5, 6)
8869 set An_Array := (1, others => 0)
8870 set An_Array := (0|4 => 1, 1..3 => 2, 5 => 6)
8871 set A_2D_Array := ((1, 2, 3), (4, 5, 6), (7, 8, 9))
8872 set A_Record := (1, "Peter", True);
8873 set A_Record := (Name => "Peter", Id => 1, Alive => True)
8875 Changing a discriminant's value by assigning an aggregate has an
8876 undefined effect if that discriminant is used within the record.
8877 However, you can first modify discriminants by directly assigning
8878 to them (which normally would not be allowed in Ada), and then
8879 performing an aggregate assignment. For example, given a variable
8880 `A_Rec' declared to have a type such as:
8882 type Rec (Len : Small_Integer := 0) is record
8884 Vals : IntArray (1 .. Len);
8887 you can assign a value with a different size of `Vals' with two
8891 set A_Rec := (Id => 42, Vals => (1, 2, 3, 4))
8893 As this example also illustrates, GDB is very loose about the usual
8894 rules concerning aggregates. You may leave out some of the
8895 components of an array or record aggregate (such as the `Len'
8896 component in the assignment to `A_Rec' above); they will retain
8897 their original values upon assignment. You may freely use dynamic
8898 values as indices in component associations. You may even use
8899 overlapping or redundant component associations, although which
8900 component values are assigned in such cases is not defined.
8902 * Calls to dispatching subprograms are not implemented.
8904 * The overloading algorithm is much more limited (i.e., less
8905 selective) than that of real Ada. It makes only limited use of
8906 the context in which a subexpression appears to resolve its
8907 meaning, and it is much looser in its rules for allowing type
8908 matches. As a result, some function calls will be ambiguous, and
8909 the user will be asked to choose the proper resolution.
8911 * The `new' operator is not implemented.
8913 * Entry calls are not implemented.
8915 * Aside from printing, arithmetic operations on the native VAX
8916 floating-point formats are not supported.
8918 * It is not possible to slice a packed array.
8921 File: gdb.info, Node: Additions to Ada, Next: Stopping Before Main Program, Prev: Omissions from Ada, Up: Ada
8923 12.4.6.3 Additions to Ada
8924 .........................
8926 As it does for other languages, GDB makes certain generic extensions to
8927 Ada (*note Expressions::):
8929 * If the expression E is a variable residing in memory (typically a
8930 local variable or array element) and N is a positive integer, then
8931 `E@N' displays the values of E and the N-1 adjacent variables
8932 following it in memory as an array. In Ada, this operator is
8933 generally not necessary, since its prime use is in displaying
8934 parts of an array, and slicing will usually do this in Ada.
8935 However, there are occasional uses when debugging programs in
8936 which certain debugging information has been optimized away.
8938 * `B::VAR' means "the variable named VAR that appears in function or
8939 file B." When B is a file name, you must typically surround it in
8942 * The expression `{TYPE} ADDR' means "the variable of type TYPE that
8943 appears at address ADDR."
8945 * A name starting with `$' is a convenience variable (*note
8946 Convenience Vars::) or a machine register (*note Registers::).
8948 In addition, GDB provides a few other shortcuts and outright
8949 additions specific to Ada:
8951 * The assignment statement is allowed as an expression, returning
8952 its right-hand operand as its value. Thus, you may enter
8955 print A(tmp := y + 1)
8957 * The semicolon is allowed as an "operator," returning as its value
8958 the value of its right-hand operand. This allows, for example,
8959 complex conditional breaks:
8962 condition 1 (report(i); k += 1; A(k) > 100)
8964 * Rather than use catenation and symbolic character names to
8965 introduce special characters into strings, one may instead use a
8966 special bracket notation, which is also used to print strings. A
8967 sequence of characters of the form `["XX"]' within a string or
8968 character literal denotes the (single) character whose numeric
8969 encoding is XX in hexadecimal. The sequence of characters `["""]'
8970 also denotes a single quotation mark in strings. For example,
8971 "One line.["0a"]Next line.["0a"]"
8972 contains an ASCII newline character (`Ada.Characters.Latin_1.LF')
8975 * The subtype used as a prefix for the attributes 'Pos, 'Min, and
8976 'Max is optional (and is ignored in any case). For example, it is
8981 * When printing arrays, GDB uses positional notation when the array
8982 has a lower bound of 1, and uses a modified named notation
8983 otherwise. For example, a one-dimensional array of three integers
8984 with a lower bound of 3 might print as
8988 That is, in contrast to valid Ada, only the first component has a
8991 * You may abbreviate attributes in expressions with any unique,
8992 multi-character subsequence of their names (an exact match gets
8993 preference). For example, you may use a'len, a'gth, or a'lh in
8996 * Since Ada is case-insensitive, the debugger normally maps
8997 identifiers you type to lower case. The GNAT compiler uses
8998 upper-case characters for some of its internal identifiers, which
8999 are normally of no interest to users. For the rare occasions when
9000 you actually have to look at them, enclose them in angle brackets
9001 to avoid the lower-case mapping. For example,
9002 gdb print <JMPBUF_SAVE>[0]
9004 * Printing an object of class-wide type or dereferencing an
9005 access-to-class-wide value will display all the components of the
9006 object's specific type (as indicated by its run-time tag).
9007 Likewise, component selection on such a value will operate on the
9008 specific type of the object.
9012 File: gdb.info, Node: Stopping Before Main Program, Next: Ada Glitches, Prev: Additions to Ada, Up: Ada
9014 12.4.6.4 Stopping at the Very Beginning
9015 .......................................
9017 It is sometimes necessary to debug the program during elaboration, and
9018 before reaching the main procedure. As defined in the Ada Reference
9019 Manual, the elaboration code is invoked from a procedure called
9020 `adainit'. To run your program up to the beginning of elaboration,
9021 simply use the following two commands: `tbreak adainit' and `run'.
9024 File: gdb.info, Node: Ada Glitches, Prev: Stopping Before Main Program, Up: Ada
9026 12.4.6.5 Known Peculiarities of Ada Mode
9027 ........................................
9029 Besides the omissions listed previously (*note Omissions from Ada::),
9030 we know of several problems with and limitations of Ada mode in GDB,
9031 some of which will be fixed with planned future releases of the debugger
9032 and the GNU Ada compiler.
9034 * Currently, the debugger has insufficient information to determine
9035 whether certain pointers represent pointers to objects or the
9036 objects themselves. Thus, the user may have to tack an extra
9037 `.all' after an expression to get it printed properly.
9039 * Static constants that the compiler chooses not to materialize as
9040 objects in storage are invisible to the debugger.
9042 * Named parameter associations in function argument lists are
9043 ignored (the argument lists are treated as positional).
9045 * Many useful library packages are currently invisible to the
9048 * Fixed-point arithmetic, conversions, input, and output is carried
9049 out using floating-point arithmetic, and may give results that
9050 only approximate those on the host machine.
9052 * The type of the 'Address attribute may not be `System.Address'.
9054 * The GNAT compiler never generates the prefix `Standard' for any of
9055 the standard symbols defined by the Ada language. GDB knows about
9056 this: it will strip the prefix from names when you use it, and
9057 will never look for a name you have so qualified among local
9058 symbols, nor match against symbols in other packages or
9059 subprograms. If you have defined entities anywhere in your
9060 program other than parameters and local variables whose simple
9061 names match names in `Standard', GNAT's lack of qualification here
9062 can cause confusion. When this happens, you can usually resolve
9063 the confusion by qualifying the problematic names with package
9064 `Standard' explicitly.
9067 File: gdb.info, Node: Unsupported languages, Prev: Supported languages, Up: Languages
9069 12.5 Unsupported languages
9070 ==========================
9072 In addition to the other fully-supported programming languages, GDB
9073 also provides a pseudo-language, called `minimal'. It does not
9074 represent a real programming language, but provides a set of
9075 capabilities close to what the C or assembly languages provide. This
9076 should allow most simple operations to be performed while debugging an
9077 application that uses a language currently not supported by GDB.
9079 If the language is set to `auto', GDB will automatically select this
9080 language if the current frame corresponds to an unsupported language.
9083 File: gdb.info, Node: Symbols, Next: Altering, Prev: Languages, Up: Top
9085 13 Examining the Symbol Table
9086 *****************************
9088 The commands described in this chapter allow you to inquire about the
9089 symbols (names of variables, functions and types) defined in your
9090 program. This information is inherent in the text of your program and
9091 does not change as your program executes. GDB finds it in your
9092 program's symbol table, in the file indicated when you started GDB
9093 (*note Choosing files: File Options.), or by one of the file-management
9094 commands (*note Commands to specify files: Files.).
9096 Occasionally, you may need to refer to symbols that contain unusual
9097 characters, which GDB ordinarily treats as word delimiters. The most
9098 frequent case is in referring to static variables in other source files
9099 (*note Program variables: Variables.). File names are recorded in
9100 object files as debugging symbols, but GDB would ordinarily parse a
9101 typical file name, like `foo.c', as the three words `foo' `.' `c'. To
9102 allow GDB to recognize `foo.c' as a single symbol, enclose it in single
9103 quotes; for example,
9107 looks up the value of `x' in the scope of the file `foo.c'.
9109 `set case-sensitive on'
9110 `set case-sensitive off'
9111 `set case-sensitive auto'
9112 Normally, when GDB looks up symbols, it matches their names with
9113 case sensitivity determined by the current source language.
9114 Occasionally, you may wish to control that. The command `set
9115 case-sensitive' lets you do that by specifying `on' for
9116 case-sensitive matches or `off' for case-insensitive ones. If you
9117 specify `auto', case sensitivity is reset to the default suitable
9118 for the source language. The default is case-sensitive matches
9119 for all languages except for Fortran, for which the default is
9120 case-insensitive matches.
9122 `show case-sensitive'
9123 This command shows the current setting of case sensitivity for
9126 `info address SYMBOL'
9127 Describe where the data for SYMBOL is stored. For a register
9128 variable, this says which register it is kept in. For a
9129 non-register local variable, this prints the stack-frame offset at
9130 which the variable is always stored.
9132 Note the contrast with `print &SYMBOL', which does not work at all
9133 for a register variable, and for a stack local variable prints the
9134 exact address of the current instantiation of the variable.
9137 Print the name of a symbol which is stored at the address ADDR.
9138 If no symbol is stored exactly at ADDR, GDB prints the nearest
9139 symbol and an offset from it:
9141 (gdb) info symbol 0x54320
9142 _initialize_vx + 396 in section .text
9144 This is the opposite of the `info address' command. You can use
9145 it to find out the name of a variable or a function given its
9149 Print the data type of ARG, which can be either an expression or a
9150 data type. With no argument, print the data type of `$', the last
9151 value in the value history. If ARG is an expression, it is not
9152 actually evaluated, and any side-effecting operations (such as
9153 assignments or function calls) inside it do not take place. If
9154 ARG is a type name, it may be the name of a type or typedef, or
9155 for C code it may have the form `class CLASS-NAME', `struct
9156 STRUCT-TAG', `union UNION-TAG' or `enum ENUM-TAG'. *Note
9157 Expressions: Expressions.
9160 `ptype' accepts the same arguments as `whatis', but prints a
9161 detailed description of the type, instead of just the name of the
9162 type. *Note Expressions: Expressions.
9164 For example, for this variable declaration:
9166 struct complex {double real; double imag;} v;
9168 the two commands give this output:
9171 type = struct complex
9173 type = struct complex {
9178 As with `whatis', using `ptype' without an argument refers to the
9179 type of `$', the last value in the value history.
9181 Sometimes, programs use opaque data types or incomplete
9182 specifications of complex data structure. If the debug
9183 information included in the program does not allow GDB to display
9184 a full declaration of the data type, it will say `<incomplete
9185 type>'. For example, given these declarations:
9190 but no definition for `struct foo' itself, GDB will say:
9193 $1 = <incomplete type>
9195 "Incomplete type" is C terminology for data types that are not
9196 completely specified.
9200 Print a brief description of all types whose names match the
9201 regular expression REGEXP (or all types in your program, if you
9202 supply no argument). Each complete typename is matched as though
9203 it were a complete line; thus, `i type value' gives information on
9204 all types in your program whose names include the string `value',
9205 but `i type ^value$' gives information only on types whose complete
9208 This command differs from `ptype' in two ways: first, like
9209 `whatis', it does not print a detailed description; second, it
9210 lists all source files where a type is defined.
9212 `info scope LOCATION'
9213 List all the variables local to a particular scope. This command
9214 accepts a LOCATION argument--a function name, a source line, or an
9215 address preceded by a `*', and prints all the variables local to
9216 the scope defined by that location. For example:
9218 (gdb) info scope command_line_handler
9219 Scope for command_line_handler:
9220 Symbol rl is an argument at stack/frame offset 8, length 4.
9221 Symbol linebuffer is in static storage at address 0x150a18, length 4.
9222 Symbol linelength is in static storage at address 0x150a1c, length 4.
9223 Symbol p is a local variable in register $esi, length 4.
9224 Symbol p1 is a local variable in register $ebx, length 4.
9225 Symbol nline is a local variable in register $edx, length 4.
9226 Symbol repeat is a local variable at frame offset -8, length 4.
9228 This command is especially useful for determining what data to
9229 collect during a "trace experiment", see *Note collect: Tracepoint
9233 Show information about the current source file--that is, the
9234 source file for the function containing the current point of
9236 * the name of the source file, and the directory containing it,
9238 * the directory it was compiled in,
9240 * its length, in lines,
9242 * which programming language it is written in,
9244 * whether the executable includes debugging information for
9245 that file, and if so, what format the information is in
9246 (e.g., STABS, Dwarf 2, etc.), and
9248 * whether the debugging information includes information about
9249 preprocessor macros.
9252 Print the names of all source files in your program for which
9253 there is debugging information, organized into two lists: files
9254 whose symbols have already been read, and files whose symbols will
9255 be read when needed.
9258 Print the names and data types of all defined functions.
9260 `info functions REGEXP'
9261 Print the names and data types of all defined functions whose
9262 names contain a match for regular expression REGEXP. Thus, `info
9263 fun step' finds all functions whose names include `step'; `info
9264 fun ^step' finds those whose names start with `step'. If a
9265 function name contains characters that conflict with the regular
9266 expression language (e.g. `operator*()'), they may be quoted with
9270 Print the names and data types of all variables that are declared
9271 outside of functions (i.e. excluding local variables).
9273 `info variables REGEXP'
9274 Print the names and data types of all variables (except for local
9275 variables) whose names contain a match for regular expression
9279 `info classes REGEXP'
9280 Display all Objective-C classes in your program, or (with the
9281 REGEXP argument) all those matching a particular regular
9285 `info selectors REGEXP'
9286 Display all Objective-C selectors in your program, or (with the
9287 REGEXP argument) all those matching a particular regular
9290 Some systems allow individual object files that make up your
9291 program to be replaced without stopping and restarting your
9292 program. For example, in VxWorks you can simply recompile a
9293 defective object file and keep on running. If you are running on
9294 one of these systems, you can allow GDB to reload the symbols for
9295 automatically relinked modules:
9297 `set symbol-reloading on'
9298 Replace symbol definitions for the corresponding source file
9299 when an object file with a particular name is seen again.
9301 `set symbol-reloading off'
9302 Do not replace symbol definitions when encountering object
9303 files of the same name more than once. This is the default
9304 state; if you are not running on a system that permits
9305 automatic relinking of modules, you should leave
9306 `symbol-reloading' off, since otherwise GDB may discard
9307 symbols when linking large programs, that may contain several
9308 modules (from different directories or libraries) with the
9311 `show symbol-reloading'
9312 Show the current `on' or `off' setting.
9314 `set opaque-type-resolution on'
9315 Tell GDB to resolve opaque types. An opaque type is a type
9316 declared as a pointer to a `struct', `class', or `union'--for
9317 example, `struct MyType *'--that is used in one source file
9318 although the full declaration of `struct MyType' is in another
9319 source file. The default is on.
9321 A change in the setting of this subcommand will not take effect
9322 until the next time symbols for a file are loaded.
9324 `set opaque-type-resolution off'
9325 Tell GDB not to resolve opaque types. In this case, the type is
9329 `show opaque-type-resolution'
9330 Show whether opaque types are resolved or not.
9332 `maint print symbols FILENAME'
9333 `maint print psymbols FILENAME'
9334 `maint print msymbols FILENAME'
9335 Write a dump of debugging symbol data into the file FILENAME.
9336 These commands are used to debug the GDB symbol-reading code. Only
9337 symbols with debugging data are included. If you use `maint print
9338 symbols', GDB includes all the symbols for which it has already
9339 collected full details: that is, FILENAME reflects symbols for
9340 only those files whose symbols GDB has read. You can use the
9341 command `info sources' to find out which files these are. If you
9342 use `maint print psymbols' instead, the dump shows information
9343 about symbols that GDB only knows partially--that is, symbols
9344 defined in files that GDB has skimmed, but not yet read
9345 completely. Finally, `maint print msymbols' dumps just the
9346 minimal symbol information required for each object file from
9347 which GDB has read some symbols. *Note Commands to specify files:
9348 Files, for a discussion of how GDB reads symbols (in the
9349 description of `symbol-file').
9351 `maint info symtabs [ REGEXP ]'
9352 `maint info psymtabs [ REGEXP ]'
9353 List the `struct symtab' or `struct partial_symtab' structures
9354 whose names match REGEXP. If REGEXP is not given, list them all.
9355 The output includes expressions which you can copy into a GDB
9356 debugging this one to examine a particular structure in more
9357 detail. For example:
9359 (gdb) maint info psymtabs dwarf2read
9360 { objfile /home/gnu/build/gdb/gdb
9361 ((struct objfile *) 0x82e69d0)
9362 { psymtab /home/gnu/src/gdb/dwarf2read.c
9363 ((struct partial_symtab *) 0x8474b10)
9366 text addresses 0x814d3c8 -- 0x8158074
9367 globals (* (struct partial_symbol **) 0x8507a08 @ 9)
9368 statics (* (struct partial_symbol **) 0x40e95b78 @ 2882)
9372 (gdb) maint info symtabs
9374 We see that there is one partial symbol table whose filename
9375 contains the string `dwarf2read', belonging to the `gdb'
9376 executable; and we see that GDB has not read in any symtabs yet at
9377 all. If we set a breakpoint on a function, that will cause GDB to
9378 read the symtab for the compilation unit containing that function:
9380 (gdb) break dwarf2_psymtab_to_symtab
9381 Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
9383 (gdb) maint info symtabs
9384 { objfile /home/gnu/build/gdb/gdb
9385 ((struct objfile *) 0x82e69d0)
9386 { symtab /home/gnu/src/gdb/dwarf2read.c
9387 ((struct symtab *) 0x86c1f38)
9390 blockvector ((struct blockvector *) 0x86c1bd0) (primary)
9397 File: gdb.info, Node: Altering, Next: GDB Files, Prev: Symbols, Up: Top
9399 14 Altering Execution
9400 *********************
9402 Once you think you have found an error in your program, you might want
9403 to find out for certain whether correcting the apparent error would
9404 lead to correct results in the rest of the run. You can find the
9405 answer by experiment, using the GDB features for altering execution of
9408 For example, you can store new values into variables or memory
9409 locations, give your program a signal, restart it at a different
9410 address, or even return prematurely from a function.
9414 * Assignment:: Assignment to variables
9415 * Jumping:: Continuing at a different address
9416 * Signaling:: Giving your program a signal
9417 * Returning:: Returning from a function
9418 * Calling:: Calling your program's functions
9419 * Patching:: Patching your program
9422 File: gdb.info, Node: Assignment, Next: Jumping, Up: Altering
9424 14.1 Assignment to variables
9425 ============================
9427 To alter the value of a variable, evaluate an assignment expression.
9428 *Note Expressions: Expressions. For example,
9432 stores the value 4 into the variable `x', and then prints the value of
9433 the assignment expression (which is 4). *Note Using GDB with Different
9434 Languages: Languages, for more information on operators in supported
9437 If you are not interested in seeing the value of the assignment, use
9438 the `set' command instead of the `print' command. `set' is really the
9439 same as `print' except that the expression's value is not printed and
9440 is not put in the value history (*note Value history: Value History.).
9441 The expression is evaluated only for its effects.
9443 If the beginning of the argument string of the `set' command appears
9444 identical to a `set' subcommand, use the `set variable' command instead
9445 of just `set'. This command is identical to `set' except for its lack
9446 of subcommands. For example, if your program has a variable `width',
9447 you get an error if you try to set a new value with just `set
9448 width=13', because GDB has the command `set width':
9455 Invalid syntax in expression.
9457 The invalid expression, of course, is `=47'. In order to actually set
9458 the program's variable `width', use
9460 (gdb) set var width=47
9462 Because the `set' command has many subcommands that can conflict
9463 with the names of program variables, it is a good idea to use the `set
9464 variable' command instead of just `set'. For example, if your program
9465 has a variable `g', you run into problems if you try to set a new value
9466 with just `set g=4', because GDB has the command `set gnutarget',
9467 abbreviated `set g':
9477 The program being debugged has been started already.
9478 Start it from the beginning? (y or n) y
9479 Starting program: /home/smith/cc_progs/a.out
9480 "/home/smith/cc_progs/a.out": can't open to read symbols:
9483 The current BFD target is "=4".
9485 The program variable `g' did not change, and you silently set the
9486 `gnutarget' to an invalid value. In order to set the variable `g', use
9490 GDB allows more implicit conversions in assignments than C; you can
9491 freely store an integer value into a pointer variable or vice versa,
9492 and you can convert any structure to any other structure that is the
9493 same length or shorter.
9495 To store values into arbitrary places in memory, use the `{...}'
9496 construct to generate a value of specified type at a specified address
9497 (*note Expressions: Expressions.). For example, `{int}0x83040' refers
9498 to memory location `0x83040' as an integer (which implies a certain size
9499 and representation in memory), and
9501 set {int}0x83040 = 4
9503 stores the value 4 into that memory location.
9506 File: gdb.info, Node: Jumping, Next: Signaling, Prev: Assignment, Up: Altering
9508 14.2 Continuing at a different address
9509 ======================================
9511 Ordinarily, when you continue your program, you do so at the place where
9512 it stopped, with the `continue' command. You can instead continue at
9513 an address of your own choosing, with the following commands:
9516 Resume execution at line LINESPEC. Execution stops again
9517 immediately if there is a breakpoint there. *Note Printing source
9518 lines: List, for a description of the different forms of LINESPEC.
9519 It is common practice to use the `tbreak' command in conjunction
9520 with `jump'. *Note Setting breakpoints: Set Breaks.
9522 The `jump' command does not change the current stack frame, or the
9523 stack pointer, or the contents of any memory location or any
9524 register other than the program counter. If line LINESPEC is in a
9525 different function from the one currently executing, the results
9526 may be bizarre if the two functions expect different patterns of
9527 arguments or of local variables. For this reason, the `jump'
9528 command requests confirmation if the specified line is not in the
9529 function currently executing. However, even bizarre results are
9530 predictable if you are well acquainted with the machine-language
9531 code of your program.
9534 Resume execution at the instruction at address ADDRESS.
9536 On many systems, you can get much the same effect as the `jump'
9537 command by storing a new value into the register `$pc'. The difference
9538 is that this does not start your program running; it only changes the
9539 address of where it _will_ run when you continue. For example,
9543 makes the next `continue' command or stepping command execute at
9544 address `0x485', rather than at the address where your program stopped.
9545 *Note Continuing and stepping: Continuing and Stepping.
9547 The most common occasion to use the `jump' command is to back
9548 up--perhaps with more breakpoints set--over a portion of a program that
9549 has already executed, in order to examine its execution in more detail.
9552 File: gdb.info, Node: Signaling, Next: Returning, Prev: Jumping, Up: Altering
9554 14.3 Giving your program a signal
9555 =================================
9558 Resume execution where your program stopped, but immediately give
9559 it the signal SIGNAL. SIGNAL can be the name or the number of a
9560 signal. For example, on many systems `signal 2' and `signal
9561 SIGINT' are both ways of sending an interrupt signal.
9563 Alternatively, if SIGNAL is zero, continue execution without
9564 giving a signal. This is useful when your program stopped on
9565 account of a signal and would ordinary see the signal when resumed
9566 with the `continue' command; `signal 0' causes it to resume
9569 `signal' does not repeat when you press <RET> a second time after
9570 executing the command.
9572 Invoking the `signal' command is not the same as invoking the `kill'
9573 utility from the shell. Sending a signal with `kill' causes GDB to
9574 decide what to do with the signal depending on the signal handling
9575 tables (*note Signals::). The `signal' command passes the signal
9576 directly to your program.
9579 File: gdb.info, Node: Returning, Next: Calling, Prev: Signaling, Up: Altering
9581 14.4 Returning from a function
9582 ==============================
9586 You can cancel execution of a function call with the `return'
9587 command. If you give an EXPRESSION argument, its value is used as
9588 the function's return value.
9590 When you use `return', GDB discards the selected stack frame (and
9591 all frames within it). You can think of this as making the discarded
9592 frame return prematurely. If you wish to specify a value to be
9593 returned, give that value as the argument to `return'.
9595 This pops the selected stack frame (*note Selecting a frame:
9596 Selection.), and any other frames inside of it, leaving its caller as
9597 the innermost remaining frame. That frame becomes selected. The
9598 specified value is stored in the registers used for returning values of
9601 The `return' command does not resume execution; it leaves the
9602 program stopped in the state that would exist if the function had just
9603 returned. In contrast, the `finish' command (*note Continuing and
9604 stepping: Continuing and Stepping.) resumes execution until the
9605 selected stack frame returns naturally.
9608 File: gdb.info, Node: Calling, Next: Patching, Prev: Returning, Up: Altering
9610 14.5 Calling program functions
9611 ==============================
9614 Evaluate the expression EXPR and display the resuling value. EXPR
9615 may include calls to functions in the program being debugged.
9618 Evaluate the expression EXPR without displaying `void' returned
9621 You can use this variant of the `print' command if you want to
9622 execute a function from your program that does not return anything
9623 (a.k.a. "a void function"), but without cluttering the output with
9624 `void' returned values that GDB will otherwise print. If the
9625 result is not void, it is printed and saved in the value history.
9627 It is possible for the function you call via the `print' or `call'
9628 command to generate a signal (e.g., if there's a bug in the function,
9629 or if you passed it incorrect arguments). What happens in that case is
9630 controlled by the `set unwindonsignal' command.
9632 `set unwindonsignal'
9633 Set unwinding of the stack if a signal is received while in a
9634 function that GDB called in the program being debugged. If set to
9635 on, GDB unwinds the stack it created for the call and restores the
9636 context to what it was before the call. If set to off (the
9637 default), GDB stops in the frame where the signal was received.
9639 `show unwindonsignal'
9640 Show the current setting of stack unwinding in the functions
9643 Sometimes, a function you wish to call is actually a "weak alias"
9644 for another function. In such case, GDB might not pick up the type
9645 information, including the types of the function arguments, which
9646 causes GDB to call the inferior function incorrectly. As a result, the
9647 called function will function erroneously and may even crash. A
9648 solution to that is to use the name of the aliased function instead.
9651 File: gdb.info, Node: Patching, Prev: Calling, Up: Altering
9653 14.6 Patching programs
9654 ======================
9656 By default, GDB opens the file containing your program's executable
9657 code (or the corefile) read-only. This prevents accidental alterations
9658 to machine code; but it also prevents you from intentionally patching
9659 your program's binary.
9661 If you'd like to be able to patch the binary, you can specify that
9662 explicitly with the `set write' command. For example, you might want
9663 to turn on internal debugging flags, or even to make emergency repairs.
9667 If you specify `set write on', GDB opens executable and core files
9668 for both reading and writing; if you specify `set write off' (the
9669 default), GDB opens them read-only.
9671 If you have already loaded a file, you must load it again (using
9672 the `exec-file' or `core-file' command) after changing `set
9673 write', for your new setting to take effect.
9676 Display whether executable files and core files are opened for
9677 writing as well as reading.
9680 File: gdb.info, Node: GDB Files, Next: Targets, Prev: Altering, Up: Top
9685 GDB needs to know the file name of the program to be debugged, both in
9686 order to read its symbol table and in order to start your program. To
9687 debug a core dump of a previous run, you must also tell GDB the name of
9692 * Files:: Commands to specify files
9693 * Separate Debug Files:: Debugging information in separate files
9694 * Symbol Errors:: Errors reading symbol files
9697 File: gdb.info, Node: Files, Next: Separate Debug Files, Up: GDB Files
9699 15.1 Commands to specify files
9700 ==============================
9702 You may want to specify executable and core dump file names. The usual
9703 way to do this is at start-up time, using the arguments to GDB's
9704 start-up commands (*note Getting In and Out of GDB: Invocation.).
9706 Occasionally it is necessary to change to a different file during a
9707 GDB session. Or you may run GDB and forget to specify a file you want
9708 to use. Or you are debugging a remote target via `gdbserver' (*note
9709 file: Server.). In these situations the GDB commands to specify new
9713 Use FILENAME as the program to be debugged. It is read for its
9714 symbols and for the contents of pure memory. It is also the
9715 program executed when you use the `run' command. If you do not
9716 specify a directory and the file is not found in the GDB working
9717 directory, GDB uses the environment variable `PATH' as a list of
9718 directories to search, just as the shell does when looking for a
9719 program to run. You can change the value of this variable, for
9720 both GDB and your program, using the `path' command.
9722 You can load unlinked object `.o' files into GDB using the `file'
9723 command. You will not be able to "run" an object file, but you
9724 can disassemble functions and inspect variables. Also, if the
9725 underlying BFD functionality supports it, you could use `gdb
9726 -write' to patch object files using this technique. Note that GDB
9727 can neither interpret nor modify relocations in this case, so
9728 branches and some initialized variables will appear to go to the
9729 wrong place. But this feature is still handy from time to time.
9732 `file' with no argument makes GDB discard any information it has
9733 on both executable file and the symbol table.
9735 `exec-file [ FILENAME ]'
9736 Specify that the program to be run (but not the symbol table) is
9737 found in FILENAME. GDB searches the environment variable `PATH'
9738 if necessary to locate your program. Omitting FILENAME means to
9739 discard information on the executable file.
9741 `symbol-file [ FILENAME ]'
9742 Read symbol table information from file FILENAME. `PATH' is
9743 searched when necessary. Use the `file' command to get both symbol
9744 table and program to run from the same file.
9746 `symbol-file' with no argument clears out GDB information on your
9747 program's symbol table.
9749 The `symbol-file' command causes GDB to forget the contents of
9750 some breakpoints and auto-display expressions. This is because
9751 they may contain pointers to the internal data recording symbols
9752 and data types, which are part of the old symbol table data being
9753 discarded inside GDB.
9755 `symbol-file' does not repeat if you press <RET> again after
9758 When GDB is configured for a particular environment, it
9759 understands debugging information in whatever format is the
9760 standard generated for that environment; you may use either a GNU
9761 compiler, or other compilers that adhere to the local conventions.
9762 Best results are usually obtained from GNU compilers; for example,
9763 using `gcc' you can generate debugging information for optimized
9766 For most kinds of object files, with the exception of old SVR3
9767 systems using COFF, the `symbol-file' command does not normally
9768 read the symbol table in full right away. Instead, it scans the
9769 symbol table quickly to find which source files and which symbols
9770 are present. The details are read later, one source file at a
9771 time, as they are needed.
9773 The purpose of this two-stage reading strategy is to make GDB
9774 start up faster. For the most part, it is invisible except for
9775 occasional pauses while the symbol table details for a particular
9776 source file are being read. (The `set verbose' command can turn
9777 these pauses into messages if desired. *Note Optional warnings
9778 and messages: Messages/Warnings.)
9780 We have not implemented the two-stage strategy for COFF yet. When
9781 the symbol table is stored in COFF format, `symbol-file' reads the
9782 symbol table data in full right away. Note that "stabs-in-COFF"
9783 still does the two-stage strategy, since the debug info is actually
9786 `symbol-file FILENAME [ -readnow ]'
9787 `file FILENAME [ -readnow ]'
9788 You can override the GDB two-stage strategy for reading symbol
9789 tables by using the `-readnow' option with any of the commands that
9790 load symbol table information, if you want to be sure GDB has the
9791 entire symbol table available.
9793 `core-file [FILENAME]'
9795 Specify the whereabouts of a core dump file to be used as the
9796 "contents of memory". Traditionally, core files contain only some
9797 parts of the address space of the process that generated them; GDB
9798 can access the executable file itself for other parts.
9800 `core-file' with no argument specifies that no core file is to be
9803 Note that the core file is ignored when your program is actually
9804 running under GDB. So, if you have been running your program and
9805 you wish to debug a core file instead, you must kill the
9806 subprocess in which the program is running. To do this, use the
9807 `kill' command (*note Killing the child process: Kill Process.).
9809 `add-symbol-file FILENAME ADDRESS'
9810 `add-symbol-file FILENAME ADDRESS [ -readnow ]'
9811 `add-symbol-file FILENAME -sSECTION ADDRESS ...'
9812 The `add-symbol-file' command reads additional symbol table
9813 information from the file FILENAME. You would use this command
9814 when FILENAME has been dynamically loaded (by some other means)
9815 into the program that is running. ADDRESS should be the memory
9816 address at which the file has been loaded; GDB cannot figure this
9817 out for itself. You can additionally specify an arbitrary number
9818 of `-sSECTION ADDRESS' pairs, to give an explicit section name and
9819 base address for that section. You can specify any ADDRESS as an
9822 The symbol table of the file FILENAME is added to the symbol table
9823 originally read with the `symbol-file' command. You can use the
9824 `add-symbol-file' command any number of times; the new symbol data
9825 thus read keeps adding to the old. To discard all old symbol data
9826 instead, use the `symbol-file' command without any arguments.
9828 Although FILENAME is typically a shared library file, an
9829 executable file, or some other object file which has been fully
9830 relocated for loading into a process, you can also load symbolic
9831 information from relocatable `.o' files, as long as:
9833 * the file's symbolic information refers only to linker symbols
9834 defined in that file, not to symbols defined by other object
9837 * every section the file's symbolic information refers to has
9838 actually been loaded into the inferior, as it appears in the
9841 * you can determine the address at which every section was
9842 loaded, and provide these to the `add-symbol-file' command.
9844 Some embedded operating systems, like Sun Chorus and VxWorks, can
9845 load relocatable files into an already running program; such
9846 systems typically make the requirements above easy to meet.
9847 However, it's important to recognize that many native systems use
9848 complex link procedures (`.linkonce' section factoring and C++
9849 constructor table assembly, for example) that make the
9850 requirements difficult to meet. In general, one cannot assume
9851 that using `add-symbol-file' to read a relocatable object file's
9852 symbolic information will have the same effect as linking the
9853 relocatable object file into the program in the normal way.
9855 `add-symbol-file' does not repeat if you press <RET> after using
9858 `add-symbol-file-from-memory ADDRESS'
9859 Load symbols from the given ADDRESS in a dynamically loaded object
9860 file whose image is mapped directly into the inferior's memory.
9861 For example, the Linux kernel maps a `syscall DSO' into each
9862 process's address space; this DSO provides kernel-specific code for
9863 some system calls. The argument can be any expression whose
9864 evaluation yields the address of the file's shared object file
9865 header. For this command to work, you must have used
9866 `symbol-file' or `exec-file' commands in advance.
9868 `add-shared-symbol-files LIBRARY-FILE'
9870 The `add-shared-symbol-files' command can currently be used only
9871 in the Cygwin build of GDB on MS-Windows OS, where it is an alias
9872 for the `dll-symbols' command (*note Cygwin Native::). GDB
9873 automatically looks for shared libraries, however if GDB does not
9874 find yours, you can invoke `add-shared-symbol-files'. It takes
9875 one argument: the shared library's file name. `assf' is a
9876 shorthand alias for `add-shared-symbol-files'.
9878 `section SECTION ADDR'
9879 The `section' command changes the base address of the named
9880 SECTION of the exec file to ADDR. This can be used if the exec
9881 file does not contain section addresses, (such as in the `a.out'
9882 format), or when the addresses specified in the file itself are
9883 wrong. Each section must be changed separately. The `info files'
9884 command, described below, lists all the sections and their
9889 `info files' and `info target' are synonymous; both print the
9890 current target (*note Specifying a Debugging Target: Targets.),
9891 including the names of the executable and core dump files
9892 currently in use by GDB, and the files from which symbols were
9893 loaded. The command `help target' lists all possible targets
9894 rather than current ones.
9896 `maint info sections'
9897 Another command that can give you extra information about program
9898 sections is `maint info sections'. In addition to the section
9899 information displayed by `info files', this command displays the
9900 flags and file offset of each section in the executable and core
9901 dump files. In addition, `maint info sections' provides the
9902 following command options (which may be arbitrarily combined):
9905 Display sections for all loaded object files, including
9909 Display info only for named SECTIONS.
9912 Display info only for sections for which SECTION-FLAGS are
9913 true. The section flags that GDB currently knows about are:
9915 Section will have space allocated in the process when
9916 loaded. Set for all sections except those containing
9920 Section will be loaded from the file into the child
9921 process memory. Set for pre-initialized code and data,
9922 clear for `.bss' sections.
9925 Section needs to be relocated before loading.
9928 Section cannot be modified by the child process.
9931 Section contains executable code only.
9934 Section contains data only (no executable code).
9937 Section will reside in ROM.
9940 Section contains data for constructor/destructor lists.
9943 Section is not empty.
9946 An instruction to the linker to not output the section.
9948 `COFF_SHARED_LIBRARY'
9949 A notification to the linker that the section contains
9950 COFF shared library information.
9953 Section contains common symbols.
9955 `set trust-readonly-sections on'
9956 Tell GDB that readonly sections in your object file really are
9957 read-only (i.e. that their contents will not change). In that
9958 case, GDB can fetch values from these sections out of the object
9959 file, rather than from the target program. For some targets
9960 (notably embedded ones), this can be a significant enhancement to
9961 debugging performance.
9965 `set trust-readonly-sections off'
9966 Tell GDB not to trust readonly sections. This means that the
9967 contents of the section might change while the program is running,
9968 and must therefore be fetched from the target when needed.
9970 `show trust-readonly-sections'
9971 Show the current setting of trusting readonly sections.
9973 All file-specifying commands allow both absolute and relative file
9974 names as arguments. GDB always converts the file name to an absolute
9975 file name and remembers it that way.
9977 GDB supports GNU/Linux, MS-Windows, HP-UX, SunOS, SVr4, Irix, and
9978 IBM RS/6000 AIX shared libraries.
9980 GDB automatically loads symbol definitions from shared libraries
9981 when you use the `run' command, or when you examine a core file.
9982 (Before you issue the `run' command, GDB does not understand references
9983 to a function in a shared library, however--unless you are debugging a
9986 On HP-UX, if the program loads a library explicitly, GDB
9987 automatically loads the symbols at the time of the `shl_load' call.
9989 There are times, however, when you may wish to not automatically load
9990 symbol definitions from shared libraries, such as when they are
9991 particularly large or there are many of them.
9993 To control the automatic loading of shared library symbols, use the
9996 `set auto-solib-add MODE'
9997 If MODE is `on', symbols from all shared object libraries will be
9998 loaded automatically when the inferior begins execution, you
9999 attach to an independently started inferior, or when the dynamic
10000 linker informs GDB that a new library has been loaded. If MODE is
10001 `off', symbols must be loaded manually, using the `sharedlibrary'
10002 command. The default value is `on'.
10004 If your program uses lots of shared libraries with debug info that
10005 takes large amounts of memory, you can decrease the GDB memory
10006 footprint by preventing it from automatically loading the symbols
10007 from shared libraries. To that end, type `set auto-solib-add off'
10008 before running the inferior, then load each library whose debug
10009 symbols you do need with `sharedlibrary REGEXP', where REGEXP is a
10010 regular expresion that matches the libraries whose symbols you
10013 `show auto-solib-add'
10014 Display the current autoloading mode.
10016 To explicitly load shared library symbols, use the `sharedlibrary'
10020 `info sharedlibrary'
10021 Print the names of the shared libraries which are currently loaded.
10023 `sharedlibrary REGEX'
10025 Load shared object library symbols for files matching a Unix
10026 regular expression. As with files loaded automatically, it only
10027 loads shared libraries required by your program for a core file or
10028 after typing `run'. If REGEX is omitted all shared libraries
10029 required by your program are loaded.
10032 Unload all shared object library symbols. This discards all
10033 symbols that have been loaded from all shared libraries. Symbols
10034 from shared libraries that were loaded by explicit user requests
10037 Sometimes you may wish that GDB stops and gives you control when any
10038 of shared library events happen. Use the `set stop-on-solib-events'
10041 `set stop-on-solib-events'
10042 This command controls whether GDB should give you control when the
10043 dynamic linker notifies it about some shared library event. The
10044 most common event of interest is loading or unloading of a new
10047 `show stop-on-solib-events'
10048 Show whether GDB stops and gives you control when shared library
10051 Shared libraries are also supported in many cross or remote debugging
10052 configurations. A copy of the target's libraries need to be present on
10053 the host system; they need to be the same as the target libraries,
10054 although the copies on the target can be stripped as long as the copies
10055 on the host are not.
10057 For remote debugging, you need to tell GDB where the target
10058 libraries are, so that it can load the correct copies--otherwise, it
10059 may try to load the host's libraries. GDB has two variables to specify
10060 the search directories for target libraries.
10062 `set solib-absolute-prefix PATH'
10063 If this variable is set, PATH will be used as a prefix for any
10064 absolute shared library paths; many runtime loaders store the
10065 absolute paths to the shared library in the target program's
10066 memory. If you use `solib-absolute-prefix' to find shared
10067 libraries, they need to be laid out in the same way that they are
10068 on the target, with e.g. a `/usr/lib' hierarchy under PATH.
10070 You can set the default value of `solib-absolute-prefix' by using
10071 the configure-time `--with-sysroot' option.
10073 `show solib-absolute-prefix'
10074 Display the current shared library prefix.
10076 `set solib-search-path PATH'
10077 If this variable is set, PATH is a colon-separated list of
10078 directories to search for shared libraries. `solib-search-path'
10079 is used after `solib-absolute-prefix' fails to locate the library,
10080 or if the path to the library is relative instead of absolute. If
10081 you want to use `solib-search-path' instead of
10082 `solib-absolute-prefix', be sure to set `solib-absolute-prefix' to
10083 a nonexistant directory to prevent GDB from finding your host's
10086 `show solib-search-path'
10087 Display the current shared library search path.
10090 File: gdb.info, Node: Separate Debug Files, Next: Symbol Errors, Prev: Files, Up: GDB Files
10092 15.2 Debugging Information in Separate Files
10093 ============================================
10095 GDB allows you to put a program's debugging information in a file
10096 separate from the executable itself, in a way that allows GDB to find
10097 and load the debugging information automatically. Since debugging
10098 information can be very large -- sometimes larger than the executable
10099 code itself -- some systems distribute debugging information for their
10100 executables in separate files, which users can install only when they
10101 need to debug a problem.
10103 If an executable's debugging information has been extracted to a
10104 separate file, the executable should contain a "debug link" giving the
10105 name of the debugging information file (with no directory components),
10106 and a checksum of its contents. (The exact form of a debug link is
10107 described below.) If the full name of the directory containing the
10108 executable is EXECDIR, and the executable has a debug link that
10109 specifies the name DEBUGFILE, then GDB will automatically search for
10110 the debugging information file in three places:
10112 * the directory containing the executable file (that is, it will look
10113 for a file named `EXECDIR/DEBUGFILE',
10115 * a subdirectory of that directory named `.debug' (that is, the file
10116 `EXECDIR/.debug/DEBUGFILE', and
10118 * a subdirectory of the global debug file directory that includes the
10119 executable's full path, and the name from the link (that is, the
10120 file `GLOBALDEBUGDIR/EXECDIR/DEBUGFILE', where GLOBALDEBUGDIR is
10121 the global debug file directory, and EXECDIR has been turned into
10123 GDB checks under each of these names for a debugging information
10124 file whose checksum matches that given in the link, and reads the
10125 debugging information from the first one it finds.
10127 So, for example, if you ask GDB to debug `/usr/bin/ls', which has a
10128 link containing the name `ls.debug', and the global debug directory is
10129 `/usr/lib/debug', then GDB will look for debug information in
10130 `/usr/bin/ls.debug', `/usr/bin/.debug/ls.debug', and
10131 `/usr/lib/debug/usr/bin/ls.debug'.
10133 You can set the global debugging info directory's name, and view the
10134 name GDB is currently using.
10136 `set debug-file-directory DIRECTORY'
10137 Set the directory which GDB searches for separate debugging
10138 information files to DIRECTORY.
10140 `show debug-file-directory'
10141 Show the directory GDB searches for separate debugging information
10145 A debug link is a special section of the executable file named
10146 `.gnu_debuglink'. The section must contain:
10148 * A filename, with any leading directory components removed,
10149 followed by a zero byte,
10151 * zero to three bytes of padding, as needed to reach the next
10152 four-byte boundary within the section, and
10154 * a four-byte CRC checksum, stored in the same endianness used for
10155 the executable file itself. The checksum is computed on the
10156 debugging information file's full contents by the function given
10157 below, passing zero as the CRC argument.
10159 Any executable file format can carry a debug link, as long as it can
10160 contain a section named `.gnu_debuglink' with the contents described
10163 The debugging information file itself should be an ordinary
10164 executable, containing a full set of linker symbols, sections, and
10165 debugging information. The sections of the debugging information file
10166 should have the same names, addresses and sizes as the original file,
10167 but they need not contain any data -- much like a `.bss' section in an
10168 ordinary executable.
10170 As of December 2002, there is no standard GNU utility to produce
10171 separated executable / debugging information file pairs. Ulrich
10172 Drepper's `elfutils' package, starting with version 0.53, contains a
10173 version of the `strip' command such that the command `strip foo -f
10174 foo.debug' removes the debugging information from the executable file
10175 `foo', places it in the file `foo.debug', and leaves behind a debug
10178 Since there are many different ways to compute CRC's (different
10179 polynomials, reversals, byte ordering, etc.), the simplest way to
10180 describe the CRC used in `.gnu_debuglink' sections is to give the
10181 complete code for a function that computes it:
10184 gnu_debuglink_crc32 (unsigned long crc,
10185 unsigned char *buf, size_t len)
10187 static const unsigned long crc32_table[256] =
10189 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
10190 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
10191 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
10192 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
10193 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
10194 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
10195 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
10196 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
10197 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
10198 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
10199 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
10200 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
10201 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
10202 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
10203 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
10204 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
10205 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
10206 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
10207 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
10208 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
10209 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
10210 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
10211 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
10212 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
10213 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
10214 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
10215 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
10216 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
10217 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
10218 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
10219 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
10220 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
10221 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
10222 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
10223 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
10224 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
10225 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
10226 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
10227 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
10228 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
10229 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
10230 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
10231 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
10232 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
10233 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
10234 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
10235 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
10236 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
10237 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
10238 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
10239 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
10242 unsigned char *end;
10244 crc = ~crc & 0xffffffff;
10245 for (end = buf + len; buf < end; ++buf)
10246 crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
10247 return ~crc & 0xffffffff;
10251 File: gdb.info, Node: Symbol Errors, Prev: Separate Debug Files, Up: GDB Files
10253 15.3 Errors reading symbol files
10254 ================================
10256 While reading a symbol file, GDB occasionally encounters problems, such
10257 as symbol types it does not recognize, or known bugs in compiler
10258 output. By default, GDB does not notify you of such problems, since
10259 they are relatively common and primarily of interest to people
10260 debugging compilers. If you are interested in seeing information about
10261 ill-constructed symbol tables, you can either ask GDB to print only one
10262 message about each such type of problem, no matter how many times the
10263 problem occurs; or you can ask GDB to print more messages, to see how
10264 many times the problems occur, with the `set complaints' command (*note
10265 Optional warnings and messages: Messages/Warnings.).
10267 The messages currently printed, and their meanings, include:
10269 `inner block not inside outer block in SYMBOL'
10270 The symbol information shows where symbol scopes begin and end
10271 (such as at the start of a function or a block of statements).
10272 This error indicates that an inner scope block is not fully
10273 contained in its outer scope blocks.
10275 GDB circumvents the problem by treating the inner block as if it
10276 had the same scope as the outer block. In the error message,
10277 SYMBOL may be shown as "`(don't know)'" if the outer block is not a
10280 `block at ADDRESS out of order'
10281 The symbol information for symbol scope blocks should occur in
10282 order of increasing addresses. This error indicates that it does
10285 GDB does not circumvent this problem, and has trouble locating
10286 symbols in the source file whose symbols it is reading. (You can
10287 often determine what source file is affected by specifying `set
10288 verbose on'. *Note Optional warnings and messages:
10289 Messages/Warnings.)
10291 `bad block start address patched'
10292 The symbol information for a symbol scope block has a start address
10293 smaller than the address of the preceding source line. This is
10294 known to occur in the SunOS 4.1.1 (and earlier) C compiler.
10296 GDB circumvents the problem by treating the symbol scope block as
10297 starting on the previous source line.
10299 `bad string table offset in symbol N'
10300 Symbol number N contains a pointer into the string table which is
10301 larger than the size of the string table.
10303 GDB circumvents the problem by considering the symbol to have the
10304 name `foo', which may cause other problems if many symbols end up
10307 `unknown symbol type `0xNN''
10308 The symbol information contains new data types that GDB does not
10309 yet know how to read. `0xNN' is the symbol type of the
10310 uncomprehended information, in hexadecimal.
10312 GDB circumvents the error by ignoring this symbol information.
10313 This usually allows you to debug your program, though certain
10314 symbols are not accessible. If you encounter such a problem and
10315 feel like debugging it, you can debug `gdb' with itself, breakpoint
10316 on `complain', then go up to the function `read_dbx_symtab' and
10317 examine `*bufp' to see the symbol.
10319 `stub type has NULL name'
10320 GDB could not find the full definition for a struct or class.
10322 `const/volatile indicator missing (ok if using g++ v1.x), got...'
10323 The symbol information for a C++ member function is missing some
10324 information that recent versions of the compiler should have
10327 `info mismatch between compiler and debugger'
10328 GDB could not parse a type specification output by the compiler.
10332 File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top
10334 16 Specifying a Debugging Target
10335 ********************************
10337 A "target" is the execution environment occupied by your program.
10339 Often, GDB runs in the same host environment as your program; in
10340 that case, the debugging target is specified as a side effect when you
10341 use the `file' or `core' commands. When you need more flexibility--for
10342 example, running GDB on a physically separate host, or controlling a
10343 standalone system over a serial port or a realtime system over a TCP/IP
10344 connection--you can use the `target' command to specify one of the
10345 target types configured for GDB (*note Commands for managing targets:
10348 It is possible to build GDB for several different "target
10349 architectures". When GDB is built like that, you can choose one of the
10350 available architectures with the `set architecture' command.
10352 `set architecture ARCH'
10353 This command sets the current target architecture to ARCH. The
10354 value of ARCH can be `"auto"', in addition to one of the supported
10357 `show architecture'
10358 Show the current target architecture.
10362 These are alias commands for, respectively, `set architecture' and
10363 `show architecture'.
10367 * Active Targets:: Active targets
10368 * Target Commands:: Commands for managing targets
10369 * Byte Order:: Choosing target byte order
10370 * Remote:: Remote debugging
10373 File: gdb.info, Node: Active Targets, Next: Target Commands, Up: Targets
10375 16.1 Active targets
10376 ===================
10378 There are three classes of targets: processes, core files, and
10379 executable files. GDB can work concurrently on up to three active
10380 targets, one in each class. This allows you to (for example) start a
10381 process and inspect its activity without abandoning your work on a core
10384 For example, if you execute `gdb a.out', then the executable file
10385 `a.out' is the only active target. If you designate a core file as
10386 well--presumably from a prior run that crashed and coredumped--then GDB
10387 has two active targets and uses them in tandem, looking first in the
10388 corefile target, then in the executable file, to satisfy requests for
10389 memory addresses. (Typically, these two classes of target are
10390 complementary, since core files contain only a program's read-write
10391 memory--variables and so on--plus machine status, while executable
10392 files contain only the program text and initialized data.)
10394 When you type `run', your executable file becomes an active process
10395 target as well. When a process target is active, all GDB commands
10396 requesting memory addresses refer to that target; addresses in an
10397 active core file or executable file target are obscured while the
10398 process target is active.
10400 Use the `core-file' and `exec-file' commands to select a new core
10401 file or executable target (*note Commands to specify files: Files.).
10402 To specify as a target a process that is already running, use the
10403 `attach' command (*note Debugging an already-running process: Attach.).
10406 File: gdb.info, Node: Target Commands, Next: Byte Order, Prev: Active Targets, Up: Targets
10408 16.2 Commands for managing targets
10409 ==================================
10411 `target TYPE PARAMETERS'
10412 Connects the GDB host environment to a target machine or process.
10413 A target is typically a protocol for talking to debugging
10414 facilities. You use the argument TYPE to specify the type or
10415 protocol of the target machine.
10417 Further PARAMETERS are interpreted by the target protocol, but
10418 typically include things like device names or host names to connect
10419 with, process numbers, and baud rates.
10421 The `target' command does not repeat if you press <RET> again
10422 after executing the command.
10425 Displays the names of all targets available. To display targets
10426 currently selected, use either `info target' or `info files'
10427 (*note Commands to specify files: Files.).
10430 Describe a particular target, including any parameters necessary to
10433 `set gnutarget ARGS'
10434 GDB uses its own library BFD to read your files. GDB knows
10435 whether it is reading an "executable", a "core", or a ".o" file;
10436 however, you can specify the file format with the `set gnutarget'
10437 command. Unlike most `target' commands, with `gnutarget' the
10438 `target' refers to a program, not a machine.
10440 _Warning:_ To specify a file format with `set gnutarget', you
10441 must know the actual BFD name.
10443 *Note Commands to specify files: Files.
10446 Use the `show gnutarget' command to display what file format
10447 `gnutarget' is set to read. If you have not set `gnutarget', GDB
10448 will determine the file format for each file automatically, and
10449 `show gnutarget' displays `The current BDF target is "auto"'.
10451 Here are some common targets (available, or not, depending on the GDB
10454 `target exec PROGRAM'
10455 An executable file. `target exec PROGRAM' is the same as
10456 `exec-file PROGRAM'.
10458 `target core FILENAME'
10459 A core dump file. `target core FILENAME' is the same as
10460 `core-file FILENAME'.
10462 `target remote MEDIUM'
10463 A remote system connected to GDB via a serial line or network
10464 connection. This command tells GDB to use its own remote protocol
10465 over MEDIUM for debugging. *Note Remote Debugging::.
10467 For example, if you have a board connected to `/dev/ttya' on the
10468 machine running GDB, you could say:
10470 target remote /dev/ttya
10472 `target remote' supports the `load' command. This is only useful
10473 if you have some other way of getting the stub to the target
10474 system, and you can put it somewhere in memory where it won't get
10475 clobbered by the download.
10478 Builtin CPU simulator. GDB includes simulators for most
10479 architectures. In general,
10483 works; however, you cannot assume that a specific memory map,
10484 device drivers, or even basic I/O is available, although some
10485 simulators do provide these. For info about any
10486 processor-specific simulator details, see the appropriate section
10487 in *Note Embedded Processors: Embedded Processors.
10490 Some configurations may include these targets as well:
10493 NetROM ROM emulator. This target only supports downloading.
10496 Different targets are available on different configurations of GDB;
10497 your configuration may have more or fewer targets.
10499 Many remote targets require you to download the executable's code
10500 once you've successfully established a connection. You may wish to
10501 control various aspects of this process.
10504 This command controls whether a hash mark `#' is displayed while
10505 downloading a file to the remote monitor. If on, a hash mark is
10506 displayed after each S-record is successfully downloaded to the
10510 Show the current status of displaying the hash mark.
10512 `set debug monitor'
10513 Enable or disable display of communications messages between GDB
10514 and the remote monitor.
10516 `show debug monitor'
10517 Show the current status of displaying communications between GDB
10518 and the remote monitor.
10521 Depending on what remote debugging facilities are configured into
10522 GDB, the `load' command may be available. Where it exists, it is
10523 meant to make FILENAME (an executable) available for debugging on
10524 the remote system--by downloading, or dynamic linking, for example.
10525 `load' also records the FILENAME symbol table in GDB, like the
10526 `add-symbol-file' command.
10528 If your GDB does not have a `load' command, attempting to execute
10529 it gets the error message "`You can't do that when your target is
10532 The file is loaded at whatever address is specified in the
10533 executable. For some object file formats, you can specify the
10534 load address when you link the program; for other formats, like
10535 a.out, the object file format specifies a fixed address.
10537 Depending on the remote side capabilities, GDB may be able to load
10538 programs into flash memory.
10540 `load' does not repeat if you press <RET> again after using it.
10543 File: gdb.info, Node: Byte Order, Next: Remote, Prev: Target Commands, Up: Targets
10545 16.3 Choosing target byte order
10546 ===============================
10548 Some types of processors, such as the MIPS, PowerPC, and Renesas SH,
10549 offer the ability to run either big-endian or little-endian byte
10550 orders. Usually the executable or symbol will include a bit to
10551 designate the endian-ness, and you will not need to worry about which
10552 to use. However, you may still find it useful to adjust GDB's idea of
10553 processor endian-ness manually.
10556 Instruct GDB to assume the target is big-endian.
10558 `set endian little'
10559 Instruct GDB to assume the target is little-endian.
10562 Instruct GDB to use the byte order associated with the executable.
10565 Display GDB's current idea of the target byte order.
10568 Note that these commands merely adjust interpretation of symbolic
10569 data on the host, and that they have absolutely no effect on the target
10573 File: gdb.info, Node: Remote, Prev: Byte Order, Up: Targets
10575 16.4 Remote debugging
10576 =====================
10578 If you are trying to debug a program running on a machine that cannot
10579 run GDB in the usual way, it is often useful to use remote debugging.
10580 For example, you might use remote debugging on an operating system
10581 kernel, or on a small system which does not have a general purpose
10582 operating system powerful enough to run a full-featured debugger.
10584 Some configurations of GDB have special serial or TCP/IP interfaces
10585 to make this work with particular debugging targets. In addition, GDB
10586 comes with a generic serial protocol (specific to GDB, but not specific
10587 to any particular target system) which you can use if you write the
10588 remote stubs--the code that runs on the remote system to communicate
10591 Other remote targets may be available in your configuration of GDB;
10592 use `help target' to list them.
10594 Once you've connected to the remote target, GDB allows you to send
10595 arbitrary commands to the remote monitor:
10598 Send an arbitrary COMMAND string to the remote monitor.
10601 File: gdb.info, Node: Remote Debugging, Next: Configurations, Prev: Targets, Up: Top
10603 17 Debugging remote programs
10604 ****************************
10608 * Connecting:: Connecting to a remote target
10609 * Server:: Using the gdbserver program
10610 * Remote configuration:: Remote configuration
10611 * remote stub:: Implementing a remote stub
10614 File: gdb.info, Node: Connecting, Next: Server, Up: Remote Debugging
10616 17.1 Connecting to a remote target
10617 ==================================
10619 On the GDB host machine, you will need an unstripped copy of your
10620 program, since GDB needs symobl and debugging information. Start up
10621 GDB as usual, using the name of the local copy of your program as the
10624 GDB can communicate with the target over a serial line, or over an
10625 IP network using TCP or UDP. In each case, GDB uses the same protocol
10626 for debugging your program; only the medium carrying the debugging
10627 packets varies. The `target remote' command establishes a connection
10628 to the target. Its arguments indicate which medium to use:
10630 `target remote SERIAL-DEVICE'
10631 Use SERIAL-DEVICE to communicate with the target. For example, to
10632 use a serial line connected to the device named `/dev/ttyb':
10634 target remote /dev/ttyb
10636 If you're using a serial line, you may want to give GDB the
10637 `--baud' option, or use the `set remotebaud' command (*note set
10638 remotebaud: Remote configuration.) before the `target' command.
10640 `target remote `HOST:PORT''
10641 `target remote `tcp:HOST:PORT''
10642 Debug using a TCP connection to PORT on HOST. The HOST may be
10643 either a host name or a numeric IP address; PORT must be a decimal
10644 number. The HOST could be the target machine itself, if it is
10645 directly connected to the net, or it might be a terminal server
10646 which in turn has a serial line to the target.
10648 For example, to connect to port 2828 on a terminal server named
10651 target remote manyfarms:2828
10653 If your remote target is actually running on the same machine as
10654 your debugger session (e.g. a simulator for your target running on
10655 the same host), you can omit the hostname. For example, to
10656 connect to port 1234 on your local machine:
10658 target remote :1234
10659 Note that the colon is still required here.
10661 `target remote `udp:HOST:PORT''
10662 Debug using UDP packets to PORT on HOST. For example, to connect
10663 to UDP port 2828 on a terminal server named `manyfarms':
10665 target remote udp:manyfarms:2828
10667 When using a UDP connection for remote debugging, you should keep
10668 in mind that the `U' stands for "Unreliable". UDP can silently
10669 drop packets on busy or unreliable networks, which will cause
10670 havoc with your debugging session.
10672 `target remote | COMMAND'
10673 Run COMMAND in the background and communicate with it using a
10674 pipe. The COMMAND is a shell command, to be parsed and expanded
10675 by the system's command shell, `/bin/sh'; it should expect remote
10676 protocol packets on its standard input, and send replies on its
10677 standard output. You could use this to run a stand-alone simulator
10678 that speaks the remote debugging protocol, to make net connections
10679 using programs like `ssh', or for other similar tricks.
10681 If COMMAND closes its standard output (perhaps by exiting), GDB
10682 will try to send it a `SIGTERM' signal. (If the program has
10683 already exited, this will have no effect.)
10686 Once the connection has been established, you can use all the usual
10687 commands to examine and change data and to step and continue the remote
10690 Whenever GDB is waiting for the remote program, if you type the
10691 interrupt character (often `Ctrl-c'), GDB attempts to stop the program.
10692 This may or may not succeed, depending in part on the hardware and the
10693 serial drivers the remote system uses. If you type the interrupt
10694 character once again, GDB displays this prompt:
10696 Interrupted while waiting for the program.
10697 Give up (and stop debugging it)? (y or n)
10699 If you type `y', GDB abandons the remote debugging session. (If you
10700 decide you want to try again later, you can use `target remote' again
10701 to connect once more.) If you type `n', GDB goes back to waiting.
10704 When you have finished debugging the remote program, you can use
10705 the `detach' command to release it from GDB control. Detaching
10706 from the target normally resumes its execution, but the results
10707 will depend on your particular remote stub. After the `detach'
10708 command, GDB is free to connect to another target.
10711 The `disconnect' command behaves like `detach', except that the
10712 target is generally not resumed. It will wait for GDB (this
10713 instance or another one) to connect and continue debugging. After
10714 the `disconnect' command, GDB is again free to connect to another
10718 This command allows you to send arbitrary commands directly to the
10719 remote monitor. Since GDB doesn't care about the commands it
10720 sends like this, this command is the way to extend GDB--you can
10721 add new commands that only the external monitor will understand
10725 File: gdb.info, Node: Server, Next: Remote configuration, Prev: Connecting, Up: Remote Debugging
10727 17.2 Using the `gdbserver' program
10728 ==================================
10730 `gdbserver' is a control program for Unix-like systems, which allows
10731 you to connect your program with a remote GDB via `target remote'--but
10732 without linking in the usual debugging stub.
10734 `gdbserver' is not a complete replacement for the debugging stubs,
10735 because it requires essentially the same operating-system facilities
10736 that GDB itself does. In fact, a system that can run `gdbserver' to
10737 connect to a remote GDB could also run GDB locally! `gdbserver' is
10738 sometimes useful nevertheless, because it is a much smaller program
10739 than GDB itself. It is also easier to port than all of GDB, so you may
10740 be able to get started more quickly on a new system by using
10741 `gdbserver'. Finally, if you develop code for real-time systems, you
10742 may find that the tradeoffs involved in real-time operation make it
10743 more convenient to do as much development work as possible on another
10744 system, for example by cross-compiling. You can use `gdbserver' to
10745 make a similar choice for debugging.
10747 GDB and `gdbserver' communicate via either a serial line or a TCP
10748 connection, using the standard GDB remote serial protocol.
10750 _On the target machine,_
10751 you need to have a copy of the program you want to debug.
10752 `gdbserver' does not need your program's symbol table, so you can
10753 strip the program if necessary to save space. GDB on the host
10754 system does all the symbol handling.
10756 To use the server, you must tell it how to communicate with GDB;
10757 the name of your program; and the arguments for your program. The
10760 target> gdbserver COMM PROGRAM [ ARGS ... ]
10762 COMM is either a device name (to use a serial line) or a TCP
10763 hostname and portnumber. For example, to debug Emacs with the
10764 argument `foo.txt' and communicate with GDB over the serial port
10767 target> gdbserver /dev/com1 emacs foo.txt
10769 `gdbserver' waits passively for the host GDB to communicate with
10772 To use a TCP connection instead of a serial line:
10774 target> gdbserver host:2345 emacs foo.txt
10776 The only difference from the previous example is the first
10777 argument, specifying that you are communicating with the host GDB
10778 via TCP. The `host:2345' argument means that `gdbserver' is to
10779 expect a TCP connection from machine `host' to local TCP port 2345.
10780 (Currently, the `host' part is ignored.) You can choose any number
10781 you want for the port number as long as it does not conflict with
10782 any TCP ports already in use on the target system (for example,
10783 `23' is reserved for `telnet').(1) You must use the same port
10784 number with the host GDB `target remote' command.
10786 On some targets, `gdbserver' can also attach to running programs.
10787 This is accomplished via the `--attach' argument. The syntax is:
10789 target> gdbserver COMM --attach PID
10791 PID is the process ID of a currently running process. It isn't
10792 necessary to point `gdbserver' at a binary for the running process.
10794 You can debug processes by name instead of process ID if your
10795 target has the `pidof' utility:
10797 target> gdbserver COMM --attach `pidof PROGRAM`
10799 In case more than one copy of PROGRAM is running, or PROGRAM has
10800 multiple threads, most versions of `pidof' support the `-s' option
10801 to only return the first process ID.
10803 _On the host machine,_
10804 connect to your target (*note Connecting to a remote target:
10805 Connecting.). For TCP connections, you must start up `gdbserver'
10806 prior to using the `target remote' command. Otherwise you may get
10807 an error whose text depends on the host system, but which usually
10808 looks something like `Connection refused'. You don't need to use
10809 the `load' command in GDB when using `gdbserver', since the
10810 program is already on the target. However, if you want to load
10811 the symbols (as you normally would), do that with the `file'
10812 command, and issue it _before_ connecting to the server;
10813 otherwise, you will get an error message saying `"Program is
10814 already running"', since the program is considered running after
10818 ---------- Footnotes ----------
10820 (1) If you choose a port number that conflicts with another service,
10821 `gdbserver' prints an error message and exits.
10824 File: gdb.info, Node: Remote configuration, Next: remote stub, Prev: Server, Up: Remote Debugging
10826 17.3 Remote configuration
10827 =========================
10829 This section documents the configuration options available when
10830 debugging remote programs. For the options related to the File I/O
10831 extensions of the remote protocol, see *Note system-call-allowed:
10834 `set remoteaddresssize BITS'
10835 Set the maximum size of address in a memory packet to the specified
10836 number of bits. GDB will mask off the address bits above that
10837 number, when it passes addresses to the remote target. The
10838 default value is the number of bits in the target's address.
10840 `show remoteaddresssize'
10841 Show the current value of remote address size in bits.
10844 Set the baud rate for the remote serial I/O to N baud. The value
10845 is used to set the speed of the serial port used for debugging
10849 Show the current speed of the remote connection.
10852 If set to on, GDB sends a `BREAK' signal to the remote when you
10853 type `Ctrl-c' to interrupt the program running on the remote. If
10854 set to off, GDB sends the `Ctrl-C' character instead. The default
10855 is off, since most remote systems expect to see `Ctrl-C' as the
10859 Show whether GDB sends `BREAK' or `Ctrl-C' to interrupt the remote
10862 `set remotedevice DEVICE'
10863 Set the name of the serial port through which to communicate to the
10864 remote target to DEVICE. This is the device used by GDB to open
10865 the serial communications line to the remote target. There's no
10866 default, so you must set a valid port name for the remote serial
10867 communications to work. (Some varieties of the `target' command
10868 accept the port name as part of their arguments.)
10870 `show remotedevice'
10871 Show the current name of the serial port.
10873 `set remotelogbase BASE'
10874 Set the base (a.k.a. radix) of logging serial protocol
10875 communications to BASE. Supported values of BASE are: `ascii',
10876 `octal', and `hex'. The default is `ascii'.
10878 `show remotelogbase'
10879 Show the current setting of the radix for logging remote serial
10882 `set remotelogfile FILE'
10883 Record remote serial communications on the named FILE. The
10884 default is not to record at all.
10886 `show remotelogfile.'
10887 Show the current setting of the file name on which to record the
10888 serial communications.
10890 `set remotetimeout NUM'
10891 Set the timeout limit to wait for the remote target to respond to
10892 NUM seconds. The default is 2 seconds.
10894 `show remotetimeout'
10895 Show the current number of seconds to wait for the remote target
10898 `set remote hardware-watchpoint-limit LIMIT'
10899 `set remote hardware-breakpoint-limit LIMIT'
10900 Restrict GDB to using LIMIT remote hardware breakpoint or
10901 watchpoints. A limit of -1, the default, is treated as unlimited.
10903 The GDB remote protocol autodetects the packets supported by your
10904 debugging stub. If you need to override the autodetection, you can use
10905 these commands to enable or disable individual packets. Each packet
10906 can be set to `on' (the remote target supports this packet), `off' (the
10907 remote target does not support this packet), or `auto' (detect remote
10908 target support for this packet). They all default to `auto'. For more
10909 information about each packet, see *Note Remote Protocol::.
10911 During normal use, you should not have to use any of these commands.
10912 If you do, that may be a bug in your remote debugging stub, or a bug in
10913 GDB. You may want to report the problem to the GDB developers.
10915 The available settings are:
10917 Command Name Remote Packet Related Features
10918 `fetch-register-packet'`p' `info registers'
10919 `set-register-packet' `P' `set'
10920 `binary-download-packet'`X' `load', `set'
10921 `read-aux-vector-packet'`qXfer:auxv:read'`info auxv'
10922 `symbol-lookup-packet' `qSymbol' Detecting multiple
10924 `verbose-resume-packet'`vCont' Stepping or resuming
10926 `software-breakpoint-packet'`Z0' `break'
10927 `hardware-breakpoint-packet'`Z1' `hbreak'
10928 `write-watchpoint-packet'`Z2' `watch'
10929 `read-watchpoint-packet'`Z3' `rwatch'
10930 `access-watchpoint-packet'`Z4' `awatch'
10931 `get-thread-local-storage-address-packet'`qGetTLSAddr' Displaying `__thread'
10933 `supported-packets' `qSupported' Remote communications
10937 File: gdb.info, Node: remote stub, Prev: Remote configuration, Up: Remote Debugging
10939 17.4 Implementing a remote stub
10940 ===============================
10942 The stub files provided with GDB implement the target side of the
10943 communication protocol, and the GDB side is implemented in the GDB
10944 source file `remote.c'. Normally, you can simply allow these
10945 subroutines to communicate, and ignore the details. (If you're
10946 implementing your own stub file, you can still ignore the details: start
10947 with one of the existing stub files. `sparc-stub.c' is the best
10948 organized, and therefore the easiest to read.)
10950 To debug a program running on another machine (the debugging
10951 "target" machine), you must first arrange for all the usual
10952 prerequisites for the program to run by itself. For example, for a C
10955 1. A startup routine to set up the C runtime environment; these
10956 usually have a name like `crt0'. The startup routine may be
10957 supplied by your hardware supplier, or you may have to write your
10960 2. A C subroutine library to support your program's subroutine calls,
10961 notably managing input and output.
10963 3. A way of getting your program to the other machine--for example, a
10964 download program. These are often supplied by the hardware
10965 manufacturer, but you may have to write your own from hardware
10968 The next step is to arrange for your program to use a serial port to
10969 communicate with the machine where GDB is running (the "host" machine).
10970 In general terms, the scheme looks like this:
10973 GDB already understands how to use this protocol; when everything
10974 else is set up, you can simply use the `target remote' command
10975 (*note Specifying a Debugging Target: Targets.).
10978 you must link with your program a few special-purpose subroutines
10979 that implement the GDB remote serial protocol. The file
10980 containing these subroutines is called a "debugging stub".
10982 On certain remote targets, you can use an auxiliary program
10983 `gdbserver' instead of linking a stub into your program. *Note
10984 Using the `gdbserver' program: Server, for details.
10986 The debugging stub is specific to the architecture of the remote
10987 machine; for example, use `sparc-stub.c' to debug programs on SPARC
10990 These working remote stubs are distributed with GDB:
10993 For Intel 386 and compatible architectures.
10996 For Motorola 680x0 architectures.
10999 For Renesas SH architectures.
11002 For SPARC architectures.
11005 For Fujitsu SPARCLITE architectures.
11008 The `README' file in the GDB distribution may list other recently
11013 * Stub Contents:: What the stub can do for you
11014 * Bootstrapping:: What you must do for the stub
11015 * Debug Session:: Putting it all together
11018 File: gdb.info, Node: Stub Contents, Next: Bootstrapping, Up: remote stub
11020 17.4.1 What the stub can do for you
11021 -----------------------------------
11023 The debugging stub for your architecture supplies these three
11027 This routine arranges for `handle_exception' to run when your
11028 program stops. You must call this subroutine explicitly near the
11029 beginning of your program.
11032 This is the central workhorse, but your program never calls it
11033 explicitly--the setup code arranges for `handle_exception' to run
11034 when a trap is triggered.
11036 `handle_exception' takes control when your program stops during
11037 execution (for example, on a breakpoint), and mediates
11038 communications with GDB on the host machine. This is where the
11039 communications protocol is implemented; `handle_exception' acts as
11040 the GDB representative on the target machine. It begins by
11041 sending summary information on the state of your program, then
11042 continues to execute, retrieving and transmitting any information
11043 GDB needs, until you execute a GDB command that makes your program
11044 resume; at that point, `handle_exception' returns control to your
11045 own code on the target machine.
11048 Use this auxiliary subroutine to make your program contain a
11049 breakpoint. Depending on the particular situation, this may be
11050 the only way for GDB to get control. For instance, if your target
11051 machine has some sort of interrupt button, you won't need to call
11052 this; pressing the interrupt button transfers control to
11053 `handle_exception'--in effect, to GDB. On some machines, simply
11054 receiving characters on the serial port may also trigger a trap;
11055 again, in that situation, you don't need to call `breakpoint' from
11056 your own program--simply running `target remote' from the host GDB
11057 session gets control.
11059 Call `breakpoint' if none of these is true, or if you simply want
11060 to make certain your program stops at a predetermined point for the
11061 start of your debugging session.
11064 File: gdb.info, Node: Bootstrapping, Next: Debug Session, Prev: Stub Contents, Up: remote stub
11066 17.4.2 What you must do for the stub
11067 ------------------------------------
11069 The debugging stubs that come with GDB are set up for a particular chip
11070 architecture, but they have no information about the rest of your
11071 debugging target machine.
11073 First of all you need to tell the stub how to communicate with the
11076 `int getDebugChar()'
11077 Write this subroutine to read a single character from the serial
11078 port. It may be identical to `getchar' for your target system; a
11079 different name is used to allow you to distinguish the two if you
11082 `void putDebugChar(int)'
11083 Write this subroutine to write a single character to the serial
11084 port. It may be identical to `putchar' for your target system; a
11085 different name is used to allow you to distinguish the two if you
11088 If you want GDB to be able to stop your program while it is running,
11089 you need to use an interrupt-driven serial driver, and arrange for it
11090 to stop when it receives a `^C' (`\003', the control-C character).
11091 That is the character which GDB uses to tell the remote system to stop.
11093 Getting the debugging target to return the proper status to GDB
11094 probably requires changes to the standard stub; one quick and dirty way
11095 is to just execute a breakpoint instruction (the "dirty" part is that
11096 GDB reports a `SIGTRAP' instead of a `SIGINT').
11098 Other routines you need to supply are:
11100 `void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
11101 Write this function to install EXCEPTION_ADDRESS in the exception
11102 handling tables. You need to do this because the stub does not
11103 have any way of knowing what the exception handling tables on your
11104 target system are like (for example, the processor's table might
11105 be in ROM, containing entries which point to a table in RAM).
11106 EXCEPTION_NUMBER is the exception number which should be changed;
11107 its meaning is architecture-dependent (for example, different
11108 numbers might represent divide by zero, misaligned access, etc).
11109 When this exception occurs, control should be transferred directly
11110 to EXCEPTION_ADDRESS, and the processor state (stack, registers,
11111 and so on) should be just as it is when a processor exception
11112 occurs. So if you want to use a jump instruction to reach
11113 EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
11116 For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
11117 gate so that interrupts are masked while the handler runs. The
11118 gate should be at privilege level 0 (the most privileged level).
11119 The SPARC and 68k stubs are able to mask interrupts themselves
11120 without help from `exceptionHandler'.
11122 `void flush_i_cache()'
11123 On SPARC and SPARCLITE only, write this subroutine to flush the
11124 instruction cache, if any, on your target machine. If there is no
11125 instruction cache, this subroutine may be a no-op.
11127 On target machines that have instruction caches, GDB requires this
11128 function to make certain that the state of your program is stable.
11130 You must also make sure this library routine is available:
11132 `void *memset(void *, int, int)'
11133 This is the standard library function `memset' that sets an area of
11134 memory to a known value. If you have one of the free versions of
11135 `libc.a', `memset' can be found there; otherwise, you must either
11136 obtain it from your hardware manufacturer, or write your own.
11138 If you do not use the GNU C compiler, you may need other standard
11139 library subroutines as well; this varies from one stub to another, but
11140 in general the stubs are likely to use any of the common library
11141 subroutines which `gcc' generates as inline code.
11144 File: gdb.info, Node: Debug Session, Prev: Bootstrapping, Up: remote stub
11146 17.4.3 Putting it all together
11147 ------------------------------
11149 In summary, when your program is ready to debug, you must follow these
11152 1. Make sure you have defined the supporting low-level routines
11153 (*note What you must do for the stub: Bootstrapping.):
11154 `getDebugChar', `putDebugChar',
11155 `flush_i_cache', `memset', `exceptionHandler'.
11157 2. Insert these lines near the top of your program:
11162 3. For the 680x0 stub only, you need to provide a variable called
11163 `exceptionHook'. Normally you just use:
11165 void (*exceptionHook)() = 0;
11167 but if before calling `set_debug_traps', you set it to point to a
11168 function in your program, that function is called when `GDB'
11169 continues after stopping on a trap (for example, bus error). The
11170 function indicated by `exceptionHook' is called with one
11171 parameter: an `int' which is the exception number.
11173 4. Compile and link together: your program, the GDB debugging stub for
11174 your target architecture, and the supporting subroutines.
11176 5. Make sure you have a serial connection between your target machine
11177 and the GDB host, and identify the serial port on the host.
11179 6. Download your program to your target machine (or get it there by
11180 whatever means the manufacturer provides), and start it.
11182 7. Start GDB on the host, and connect to the target (*note Connecting
11183 to a remote target: Connecting.).
11187 File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top
11189 18 Configuration-Specific Information
11190 *************************************
11192 While nearly all GDB commands are available for all native and cross
11193 versions of the debugger, there are some exceptions. This chapter
11194 describes things that are only available in certain configurations.
11196 There are three major categories of configurations: native
11197 configurations, where the host and target are the same, embedded
11198 operating system configurations, which are usually the same for several
11199 different processor architectures, and bare embedded processors, which
11200 are quite different from each other.
11206 * Embedded Processors::
11210 File: gdb.info, Node: Native, Next: Embedded OS, Up: Configurations
11215 This section describes details specific to particular native
11221 * BSD libkvm Interface:: Debugging BSD kernel memory images
11222 * SVR4 Process Information:: SVR4 process information
11223 * DJGPP Native:: Features specific to the DJGPP port
11224 * Cygwin Native:: Features specific to the Cygwin port
11225 * Hurd Native:: Features specific to GNU Hurd
11226 * Neutrino:: Features specific to QNX Neutrino
11229 File: gdb.info, Node: HP-UX, Next: BSD libkvm Interface, Up: Native
11234 On HP-UX systems, if you refer to a function or variable name that
11235 begins with a dollar sign, GDB searches for a user or system name
11236 first, before it searches for a convenience variable.
11239 File: gdb.info, Node: BSD libkvm Interface, Next: SVR4 Process Information, Prev: HP-UX, Up: Native
11241 18.1.2 BSD libkvm Interface
11242 ---------------------------
11244 BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
11245 interface that provides a uniform interface for accessing kernel virtual
11246 memory images, including live systems and crash dumps. GDB uses this
11247 interface to allow you to debug live kernels and kernel crash dumps on
11248 many native BSD configurations. This is implemented as a special `kvm'
11249 debugging target. For debugging a live system, load the currently
11250 running kernel into GDB and connect to the `kvm' target:
11254 For debugging crash dumps, provide the file name of the crash dump
11257 (gdb) target kvm /var/crash/bsd.0
11259 Once connected to the `kvm' target, the following commands are
11263 Set current context from the "Process Control Block" (PCB) address.
11266 Set current context from proc address. This command isn't
11267 available on modern FreeBSD systems.
11270 File: gdb.info, Node: SVR4 Process Information, Next: DJGPP Native, Prev: BSD libkvm Interface, Up: Native
11272 18.1.3 SVR4 process information
11273 -------------------------------
11275 Many versions of SVR4 and compatible systems provide a facility called
11276 `/proc' that can be used to examine the image of a running process
11277 using file-system subroutines. If GDB is configured for an operating
11278 system with this facility, the command `info proc' is available to
11279 report information about the process running your program, or about any
11280 process running on your system. `info proc' works only on SVR4 systems
11281 that include the `procfs' code. This includes, as of this writing,
11282 GNU/Linux, OSF/1 (Digital Unix), Solaris, Irix, and Unixware, but not
11283 HP-UX, for example.
11286 `info proc PROCESS-ID'
11287 Summarize available information about any running process. If a
11288 process ID is specified by PROCESS-ID, display information about
11289 that process; otherwise display information about the program being
11290 debugged. The summary includes the debugged process ID, the
11291 command line used to invoke it, its current working directory, and
11292 its executable file's absolute file name.
11294 On some systems, PROCESS-ID can be of the form `[PID]/TID' which
11295 specifies a certain thread ID within a process. If the optional
11296 PID part is missing, it means a thread from the process being
11297 debugged (the leading `/' still needs to be present, or else GDB
11298 will interpret the number as a process ID rather than a thread ID).
11300 `info proc mappings'
11301 Report the memory address space ranges accessible in the program,
11302 with information on whether the process has read, write, or
11303 execute access rights to each range. On GNU/Linux systems, each
11304 memory range includes the object file which is mapped to that
11305 range, instead of the memory access rights to that range.
11309 These subcommands are specific to GNU/Linux systems. They show
11310 the process-related information, including the user ID and group
11311 ID; how many threads are there in the process; its virtual memory
11312 usage; the signals that are pending, blocked, and ignored; its
11313 TTY; its consumption of system and user time; its stack size; its
11314 `nice' value; etc. For more information, see the `proc' man page
11315 (type `man 5 proc' from your shell prompt).
11318 Show all the information about the process described under all of
11319 the above `info proc' subcommands.
11322 This command enables and disables tracing of `procfs' API calls.
11324 `show procfs-trace'
11325 Show the current state of `procfs' API call tracing.
11327 `set procfs-file FILE'
11328 Tell GDB to write `procfs' API trace to the named FILE. GDB
11329 appends the trace info to the previous contents of the file. The
11330 default is to display the trace on the standard output.
11333 Show the file to which `procfs' API trace is written.
11337 `proc-untrace-entry'
11338 `proc-untrace-exit'
11339 These commands enable and disable tracing of entries into and exits
11340 from the `syscall' interface.
11343 For QNX Neutrino only, this command displays the list of all the
11344 processes and all the threads within each process.
11347 For QNX Neutrino only, this command displays the list of all
11351 File: gdb.info, Node: DJGPP Native, Next: Cygwin Native, Prev: SVR4 Process Information, Up: Native
11353 18.1.4 Features for Debugging DJGPP Programs
11354 --------------------------------------------
11356 DJGPP is a port of the GNU development tools to MS-DOS and MS-Windows.
11357 DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
11358 (DOS Protected-Mode Interface) API to run on top of real-mode DOS
11359 systems and their emulations.
11361 GDB supports native debugging of DJGPP programs, and defines a few
11362 commands specific to the DJGPP port. This subsection describes those
11366 This is a prefix of DJGPP-specific commands which print
11367 information about the target system and important OS structures.
11370 This command displays assorted information about the underlying
11371 platform: the CPU type and features, the OS version and flavor, the
11372 DPMI version, and the available conventional and DPMI memory.
11377 These 3 commands display entries from, respectively, Global, Local,
11378 and Interrupt Descriptor Tables (GDT, LDT, and IDT). The
11379 descriptor tables are data structures which store a descriptor for
11380 each segment that is currently in use. The segment's selector is
11381 an index into a descriptor table; the table entry for that index
11382 holds the descriptor's base address and limit, and its attributes
11385 A typical DJGPP program uses 3 segments: a code segment, a data
11386 segment (used for both data and the stack), and a DOS segment
11387 (which allows access to DOS/BIOS data structures and absolute
11388 addresses in conventional memory). However, the DPMI host will
11389 usually define additional segments in order to support the DPMI
11392 These commands allow to display entries from the descriptor tables.
11393 Without an argument, all entries from the specified table are
11394 displayed. An argument, which should be an integer expression,
11395 means display a single entry whose index is given by the argument.
11396 For example, here's a convenient way to display information about
11397 the debugged program's data segment:
11399 `(gdb) info dos ldt $ds'
11400 `0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)'
11403 This comes in handy when you want to see whether a pointer is
11404 outside the data segment's limit (i.e. "garbled").
11408 These two commands display entries from, respectively, the Page
11409 Directory and the Page Tables. Page Directories and Page Tables
11410 are data structures which control how virtual memory addresses are
11411 mapped into physical addresses. A Page Table includes an entry
11412 for every page of memory that is mapped into the program's address
11413 space; there may be several Page Tables, each one holding up to
11414 4096 entries. A Page Directory has up to 4096 entries, one each
11415 for every Page Table that is currently in use.
11417 Without an argument, `info dos pde' displays the entire Page
11418 Directory, and `info dos pte' displays all the entries in all of
11419 the Page Tables. An argument, an integer expression, given to the
11420 `info dos pde' command means display only that entry from the Page
11421 Directory table. An argument given to the `info dos pte' command
11422 means display entries from a single Page Table, the one pointed to
11423 by the specified entry in the Page Directory.
11425 These commands are useful when your program uses "DMA" (Direct
11426 Memory Access), which needs physical addresses to program the DMA
11429 These commands are supported only with some DPMI servers.
11431 `info dos address-pte ADDR'
11432 This command displays the Page Table entry for a specified linear
11433 address. The argument ADDR is a linear address which should
11434 already have the appropriate segment's base address added to it,
11435 because this command accepts addresses which may belong to _any_
11436 segment. For example, here's how to display the Page Table entry
11437 for the page where a variable `i' is stored:
11439 `(gdb) info dos address-pte __djgpp_base_address + (char *)&i'
11440 `Page Table entry for address 0x11a00d30:'
11441 `Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30'
11444 This says that `i' is stored at offset `0xd30' from the page whose
11445 physical base address is `0x02698000', and shows all the
11446 attributes of that page.
11448 Note that you must cast the addresses of variables to a `char *',
11449 since otherwise the value of `__djgpp_base_address', the base
11450 address of all variables and functions in a DJGPP program, will be
11451 added using the rules of C pointer arithmetics: if `i' is declared
11452 an `int', GDB will add 4 times the value of `__djgpp_base_address'
11453 to the address of `i'.
11455 Here's another example, it displays the Page Table entry for the
11458 `(gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)'
11459 `Page Table entry for address 0x29110:'
11460 `Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110'
11463 (The `+ 3' offset is because the transfer buffer's address is the
11464 3rd member of the `_go32_info_block' structure.) The output
11465 clearly shows that this DPMI server maps the addresses in
11466 conventional memory 1:1, i.e. the physical (`0x00029000' +
11467 `0x110') and linear (`0x29110') addresses are identical.
11469 This command is supported only with some DPMI servers.
11471 In addition to native debugging, the DJGPP port supports remote
11472 debugging via a serial data link. The following commands are specific
11473 to remote serial debugging in the DJGPP port of GDB.
11475 `set com1base ADDR'
11476 This command sets the base I/O port address of the `COM1' serial
11480 This command sets the "Interrupt Request" (`IRQ') line to use for
11481 the `COM1' serial port.
11483 There are similar commands `set com2base', `set com3irq', etc. for
11484 setting the port address and the `IRQ' lines for the other 3 COM
11487 The related commands `show com1base', `show com1irq' etc. display
11488 the current settings of the base address and the `IRQ' lines used
11492 This command prints the status of the 4 DOS serial ports. For each
11493 port, it prints whether it's active or not, its I/O base address
11494 and IRQ number, whether it uses a 16550-style FIFO, its baudrate,
11495 and the counts of various errors encountered so far.
11498 File: gdb.info, Node: Cygwin Native, Next: Hurd Native, Prev: DJGPP Native, Up: Native
11500 18.1.5 Features for Debugging MS Windows PE executables
11501 -------------------------------------------------------
11503 GDB supports native debugging of MS Windows programs, including DLLs
11504 with and without symbolic debugging information. There are various
11505 additional Cygwin-specific commands, described in this subsection. The
11506 subsubsection *note Non-debug DLL symbols:: describes working with DLLs
11507 that have no debugging symbols.
11510 This is a prefix of MS Windows specific commands which print
11511 information about the target system and important OS structures.
11513 `info w32 selector'
11514 This command displays information returned by the Win32 API
11515 `GetThreadSelectorEntry' function. It takes an optional argument
11516 that is evaluated to a long value to give the information about
11517 this given selector. Without argument, this command displays
11518 information about the the six segment registers.
11521 This is a Cygwin specific alias of info shared.
11524 This command loads symbols from a dll similarly to add-sym command
11525 but without the need to specify a base address.
11527 `set cygwin-exceptions MODE'
11528 If MODE is `on', GDB will break on exceptions that happen inside
11529 the Cygwin DLL. If MODE is `off', GDB will delay recognition of
11530 exceptions, and may ignore some exceptions which seem to be caused
11531 by internal Cygwin DLL "bookkeeping". This option is meant
11532 primarily for debugging the Cygwin DLL itself; the default value
11533 is `off' to avoid annoying GDB users with false `SIGSEGV' signals.
11535 `show cygwin-exceptions'
11536 Displays whether GDB will break on exceptions that happen inside
11537 the Cygwin DLL itself.
11539 `set new-console MODE'
11540 If MODE is `on' the debuggee will be started in a new console on
11541 next start. If MODE is `off'i, the debuggee will be started in
11542 the same console as the debugger.
11545 Displays whether a new console is used when the debuggee is
11548 `set new-group MODE'
11549 This boolean value controls whether the debuggee should start a
11550 new group or stay in the same group as the debugger. This affects
11551 the way the Windows OS handles `Ctrl-C'.
11554 Displays current value of new-group boolean.
11557 This boolean value adds debug output concerning kernel events
11558 related to the debuggee seen by the debugger. This includes
11559 events that signal thread and process creation and exit, DLL
11560 loading and unloading, console interrupts, and debugging messages
11561 produced by the Windows `OutputDebugString' API call.
11564 This boolean value adds debug output concerning execute events
11565 (such as resume thread) seen by the debugger.
11567 `set debugexceptions'
11568 This boolean value adds debug output concerning exceptions in the
11569 debuggee seen by the debugger.
11572 This boolean value adds debug output concerning debuggee memory
11573 reads and writes by the debugger.
11576 This boolean values specifies whether the debuggee is called via a
11577 shell or directly (default value is on).
11580 Displays if the debuggee will be started with a shell.
11585 * Non-debug DLL symbols:: Support for DLLs without debugging symbols
11588 File: gdb.info, Node: Non-debug DLL symbols, Up: Cygwin Native
11590 18.1.5.1 Support for DLLs without debugging symbols
11591 ...................................................
11593 Very often on windows, some of the DLLs that your program relies on do
11594 not include symbolic debugging information (for example,
11595 `kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
11596 DLL, it relies on the minimal amount of symbolic information contained
11597 in the DLL's export table. This subsubsection describes working with
11598 such symbols, known internally to GDB as "minimal symbols".
11600 Note that before the debugged program has started execution, no DLLs
11601 will have been loaded. The easiest way around this problem is simply to
11602 start the program -- either by setting a breakpoint or letting the
11603 program run once to completion. It is also possible to force GDB to
11604 load a particular DLL before starting the executable -- see the shared
11605 library information in *note Files:: or the `dll-symbols' command in
11606 *note Cygwin Native::. Currently, explicitly loading symbols from a DLL
11607 with no debugging information will cause the symbol names to be
11608 duplicated in GDB's lookup table, which may adversely affect symbol
11609 lookup performance.
11611 18.1.5.2 DLL name prefixes
11612 ..........................
11614 In keeping with the naming conventions used by the Microsoft debugging
11615 tools, DLL export symbols are made available with a prefix based on the
11616 DLL name, for instance `KERNEL32!CreateFileA'. The plain name is also
11617 entered into the symbol table, so `CreateFileA' is often sufficient. In
11618 some cases there will be name clashes within a program (particularly if
11619 the executable itself includes full debugging symbols) necessitating
11620 the use of the fully qualified name when referring to the contents of
11621 the DLL. Use single-quotes around the name to avoid the exclamation
11622 mark ("!") being interpreted as a language operator.
11624 Note that the internal name of the DLL may be all upper-case, even
11625 though the file name of the DLL is lower-case, or vice-versa. Since
11626 symbols within GDB are _case-sensitive_ this may cause some confusion.
11627 If in doubt, try the `info functions' and `info variables' commands or
11628 even `maint print msymbols' (see *note Symbols::). Here's an example:
11630 (gdb) info function CreateFileA
11631 All functions matching regular expression "CreateFileA":
11633 Non-debugging symbols:
11634 0x77e885f4 CreateFileA
11635 0x77e885f4 KERNEL32!CreateFileA
11637 (gdb) info function !
11638 All functions matching regular expression "!":
11640 Non-debugging symbols:
11641 0x6100114c cygwin1!__assert
11642 0x61004034 cygwin1!_dll_crt0@0
11643 0x61004240 cygwin1!dll_crt0(per_process *)
11646 18.1.5.3 Working with minimal symbols
11647 .....................................
11649 Symbols extracted from a DLL's export table do not contain very much
11650 type information. All that GDB can do is guess whether a symbol refers
11651 to a function or variable depending on the linker section that contains
11652 the symbol. Also note that the actual contents of the memory contained
11653 in a DLL are not available unless the program is running. This means
11654 that you cannot examine the contents of a variable or disassemble a
11655 function within a DLL without a running program.
11657 Variables are generally treated as pointers and dereferenced
11658 automatically. For this reason, it is often necessary to prefix a
11659 variable name with the address-of operator ("&") and provide explicit
11660 type information in the command. Here's an example of the type of
11663 (gdb) print 'cygwin1!__argv'
11666 (gdb) x 'cygwin1!__argv'
11667 0x10021610: "\230y\""
11669 And two possible solutions:
11671 (gdb) print ((char **)'cygwin1!__argv')[0]
11672 $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
11674 (gdb) x/2x &'cygwin1!__argv'
11675 0x610c0aa8 <cygwin1!__argv>: 0x10021608 0x00000000
11676 (gdb) x/x 0x10021608
11677 0x10021608: 0x0022fd98
11678 (gdb) x/s 0x0022fd98
11679 0x22fd98: "/cygdrive/c/mydirectory/myprogram"
11681 Setting a break point within a DLL is possible even before the
11682 program starts execution. However, under these circumstances, GDB can't
11683 examine the initial instructions of the function in order to skip the
11684 function's frame set-up code. You can work around this by using "*&" to
11685 set the breakpoint at a raw memory address:
11687 (gdb) break *&'python22!PyOS_Readline'
11688 Breakpoint 1 at 0x1e04eff0
11690 The author of these extensions is not entirely convinced that
11691 setting a break point within a shared DLL like `kernel32.dll' is
11695 File: gdb.info, Node: Hurd Native, Next: Neutrino, Prev: Cygwin Native, Up: Native
11697 18.1.6 Commands specific to GNU Hurd systems
11698 --------------------------------------------
11700 This subsection describes GDB commands specific to the GNU Hurd native
11705 This command toggles the state of inferior signal interception by
11706 GDB. Mach exceptions, such as breakpoint traps, are not affected
11707 by this command. `sigs' is a shorthand alias for `signals'.
11711 Show the current state of intercepting inferior's signals.
11713 `set signal-thread'
11715 This command tells GDB which thread is the `libc' signal thread.
11716 That thread is run when a signal is delivered to a running
11717 process. `set sigthread' is the shorthand alias of `set
11720 `show signal-thread'
11722 These two commands show which thread will run when the inferior is
11723 delivered a signal.
11726 This commands tells GDB that the inferior process is stopped, as
11727 with the `SIGSTOP' signal. The stopped process can be continued
11728 by delivering a signal to it.
11731 This command shows whether GDB thinks the debuggee is stopped.
11734 Use this command to turn off trapping of exceptions in the
11735 inferior. When exception trapping is off, neither breakpoints nor
11736 single-stepping will work. To restore the default, set exception
11740 Show the current state of trapping exceptions in the inferior.
11743 This command toggles task suspension when GDB has control.
11744 Setting it to on takes effect immediately, and the task is
11745 suspended whenever GDB gets control. Setting it to off will take
11746 effect the next time the inferior is continued. If this option is
11747 set to off, you can use `set thread default pause on' or `set
11748 thread pause on' (see below) to pause individual threads.
11751 Show the current state of task suspension.
11753 `set task detach-suspend-count'
11754 This command sets the suspend count the task will be left with when
11755 GDB detaches from it.
11757 `show task detach-suspend-count'
11758 Show the suspend count the task will be left with when detaching.
11760 `set task exception-port'
11762 This command sets the task exception port to which GDB will
11763 forward exceptions. The argument should be the value of the "send
11764 rights" of the task. `set task excp' is a shorthand alias.
11767 This command switches GDB to a mode that is the least invasive as
11768 far as interfering with the inferior is concerned. This is the
11769 same as using `set task pause', `set exceptions', and `set
11770 signals' to values opposite to the defaults.
11773 `info receive-rights'
11779 These commands display information about, respectively, send
11780 rights, receive rights, port rights, port sets, and dead names of
11781 a task. There are also shorthand aliases: `info ports' for `info
11782 port-rights' and `info psets' for `info port-sets'.
11785 This command toggles current thread suspension when GDB has
11786 control. Setting it to on takes effect immediately, and the
11787 current thread is suspended whenever GDB gets control. Setting it
11788 to off will take effect the next time the inferior is continued.
11789 Normally, this command has no effect, since when GDB has control,
11790 the whole task is suspended. However, if you used `set task pause
11791 off' (see above), this command comes in handy to suspend only the
11794 `show thread pause'
11795 This command shows the state of current thread suspension.
11798 This comamnd sets whether the current thread is allowed to run.
11801 Show whether the current thread is allowed to run.
11803 `set thread detach-suspend-count'
11804 This command sets the suspend count GDB will leave on a thread
11805 when detaching. This number is relative to the suspend count
11806 found by GDB when it notices the thread; use `set thread
11807 takeover-suspend-count' to force it to an absolute value.
11809 `show thread detach-suspend-count'
11810 Show the suspend count GDB will leave on the thread when detaching.
11812 `set thread exception-port'
11814 Set the thread exception port to which to forward exceptions. This
11815 overrides the port set by `set task exception-port' (see above).
11816 `set thread excp' is the shorthand alias.
11818 `set thread takeover-suspend-count'
11819 Normally, GDB's thread suspend counts are relative to the value
11820 GDB finds when it notices each thread. This command changes the
11821 suspend counts to be absolute instead.
11823 `set thread default'
11824 `show thread default'
11825 Each of the above `set thread' commands has a `set thread default'
11826 counterpart (e.g., `set thread default pause', `set thread default
11827 exception-port', etc.). The `thread default' variety of commands
11828 sets the default thread properties for all threads; you can then
11829 change the properties of individual threads with the non-default
11833 File: gdb.info, Node: Neutrino, Prev: Hurd Native, Up: Native
11835 18.1.7 QNX Neutrino
11836 -------------------
11838 GDB provides the following commands specific to the QNX Neutrino target:
11840 `set debug nto-debug'
11841 When set to on, enables debugging messages specific to the QNX
11844 `show debug nto-debug'
11845 Show the current state of QNX Neutrino messages.
11848 File: gdb.info, Node: Embedded OS, Next: Embedded Processors, Prev: Native, Up: Configurations
11850 18.2 Embedded Operating Systems
11851 ===============================
11853 This section describes configurations involving the debugging of
11854 embedded operating systems that are available for several different
11859 * VxWorks:: Using GDB with VxWorks
11861 GDB includes the ability to debug programs running on various
11862 real-time operating systems.
11865 File: gdb.info, Node: VxWorks, Up: Embedded OS
11867 18.2.1 Using GDB with VxWorks
11868 -----------------------------
11870 `target vxworks MACHINENAME'
11871 A VxWorks system, attached via TCP/IP. The argument MACHINENAME
11872 is the target system's machine name or IP address.
11875 On VxWorks, `load' links FILENAME dynamically on the current target
11876 system as well as adding its symbols in GDB.
11878 GDB enables developers to spawn and debug tasks running on networked
11879 VxWorks targets from a Unix host. Already-running tasks spawned from
11880 the VxWorks shell can also be debugged. GDB uses code that runs on
11881 both the Unix host and on the VxWorks target. The program `gdb' is
11882 installed and executed on the Unix host. (It may be installed with the
11883 name `vxgdb', to distinguish it from a GDB for debugging programs on
11886 `VxWorks-timeout ARGS'
11887 All VxWorks-based targets now support the option `vxworks-timeout'.
11888 This option is set by the user, and ARGS represents the number of
11889 seconds GDB waits for responses to rpc's. You might use this if
11890 your VxWorks target is a slow software simulator or is on the far
11891 side of a thin network line.
11893 The following information on connecting to VxWorks was current when
11894 this manual was produced; newer releases of VxWorks may use revised
11897 To use GDB with VxWorks, you must rebuild your VxWorks kernel to
11898 include the remote debugging interface routines in the VxWorks library
11899 `rdb.a'. To do this, define `INCLUDE_RDB' in the VxWorks configuration
11900 file `configAll.h' and rebuild your VxWorks kernel. The resulting
11901 kernel contains `rdb.a', and spawns the source debugging task
11902 `tRdbTask' when VxWorks is booted. For more information on configuring
11903 and remaking VxWorks, see the manufacturer's manual.
11905 Once you have included `rdb.a' in your VxWorks system image and set
11906 your Unix execution search path to find GDB, you are ready to run GDB.
11907 From your Unix host, run `gdb' (or `vxgdb', depending on your
11910 GDB comes up showing the prompt:
11916 * VxWorks Connection:: Connecting to VxWorks
11917 * VxWorks Download:: VxWorks download
11918 * VxWorks Attach:: Running tasks
11921 File: gdb.info, Node: VxWorks Connection, Next: VxWorks Download, Up: VxWorks
11923 18.2.1.1 Connecting to VxWorks
11924 ..............................
11926 The GDB command `target' lets you connect to a VxWorks target on the
11927 network. To connect to a target whose host name is "`tt'", type:
11929 (vxgdb) target vxworks tt
11931 GDB displays messages like these:
11933 Attaching remote machine across net...
11936 GDB then attempts to read the symbol tables of any object modules
11937 loaded into the VxWorks target since it was last booted. GDB locates
11938 these files by searching the directories listed in the command search
11939 path (*note Your program's environment: Environment.); if it fails to
11940 find an object file, it displays a message such as:
11942 prog.o: No such file or directory.
11944 When this happens, add the appropriate directory to the search path
11945 with the GDB command `path', and execute the `target' command again.
11948 File: gdb.info, Node: VxWorks Download, Next: VxWorks Attach, Prev: VxWorks Connection, Up: VxWorks
11950 18.2.1.2 VxWorks download
11951 .........................
11953 If you have connected to the VxWorks target and you want to debug an
11954 object that has not yet been loaded, you can use the GDB `load' command
11955 to download a file from Unix to VxWorks incrementally. The object file
11956 given as an argument to the `load' command is actually opened twice:
11957 first by the VxWorks target in order to download the code, then by GDB
11958 in order to read the symbol table. This can lead to problems if the
11959 current working directories on the two systems differ. If both systems
11960 have NFS mounted the same filesystems, you can avoid these problems by
11961 using absolute paths. Otherwise, it is simplest to set the working
11962 directory on both systems to the directory in which the object file
11963 resides, and then to reference the file by its name, without any path.
11964 For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
11965 VxWorks and in `HOSTPATH/vw/demo/rdb' on the host. To load this
11966 program, type this on VxWorks:
11968 -> cd "VXPATH/vw/demo/rdb"
11970 Then, in GDB, type:
11972 (vxgdb) cd HOSTPATH/vw/demo/rdb
11973 (vxgdb) load prog.o
11975 GDB displays a response similar to this:
11977 Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
11979 You can also use the `load' command to reload an object module after
11980 editing and recompiling the corresponding source file. Note that this
11981 makes GDB delete all currently-defined breakpoints, auto-displays, and
11982 convenience variables, and to clear the value history. (This is
11983 necessary in order to preserve the integrity of debugger's data
11984 structures that reference the target system's symbol table.)
11987 File: gdb.info, Node: VxWorks Attach, Prev: VxWorks Download, Up: VxWorks
11989 18.2.1.3 Running tasks
11990 ......................
11992 You can also attach to an existing task using the `attach' command as
11995 (vxgdb) attach TASK
11997 where TASK is the VxWorks hexadecimal task ID. The task can be running
11998 or suspended when you attach to it. Running tasks are suspended at the
11999 time of attachment.
12002 File: gdb.info, Node: Embedded Processors, Next: Architectures, Prev: Embedded OS, Up: Configurations
12004 18.3 Embedded Processors
12005 ========================
12007 This section goes into details specific to particular embedded
12010 Whenever a specific embedded processor has a simulator, GDB allows
12011 to send an arbitrary command to the simulator.
12014 Send an arbitrary COMMAND string to the simulator. Consult the
12015 documentation for the specific simulator in use for information
12016 about acceptable commands.
12021 * H8/300:: Renesas H8/300
12022 * H8/500:: Renesas H8/500
12023 * M32R/D:: Renesas M32R/D
12024 * M68K:: Motorola M68K
12025 * MIPS Embedded:: MIPS Embedded
12026 * OpenRISC 1000:: OpenRisc 1000
12027 * PA:: HP PA Embedded
12030 * Sparclet:: Tsqware Sparclet
12031 * Sparclite:: Fujitsu Sparclite
12032 * ST2000:: Tandem ST2000
12033 * Z8000:: Zilog Z8000
12036 * Super-H:: Renesas Super-H
12037 * WinCE:: Windows CE child processes
12040 File: gdb.info, Node: ARM, Next: H8/300, Up: Embedded Processors
12046 ARM Angel monitor, via RDI library interface to ADP protocol. You
12047 may use this target to communicate with both boards running the
12048 Angel monitor, or with the EmbeddedICE JTAG debug device.
12054 GDB provides the following ARM-specific commands:
12056 `set arm disassembler'
12057 This commands selects from a list of disassembly styles. The
12058 `"std"' style is the standard style.
12060 `show arm disassembler'
12061 Show the current disassembly style.
12064 This command toggles ARM operation mode between 32-bit and 26-bit.
12067 Display the current usage of the ARM 32-bit mode.
12069 `set arm fpu FPUTYPE'
12070 This command sets the ARM floating-point unit (FPU) type. The
12071 argument FPUTYPE can be one of these:
12074 Determine the FPU type by querying the OS ABI.
12077 Software FPU, with mixed-endian doubles on little-endian ARM
12081 GCC-compiled FPA co-processor.
12084 Software FPU with pure-endian doubles.
12090 Show the current type of the FPU.
12093 This command forces GDB to use the specified ABI.
12096 Show the currently used ABI.
12099 Toggle whether to display ARM-specific debugging messages from the
12100 ARM target support subsystem.
12103 Show whether ARM-specific debugging messages are enabled.
12105 The following commands are available when an ARM target is debugged
12106 using the RDI interface:
12108 `rdilogfile [FILE]'
12109 Set the filename for the ADP (Angel Debugger Protocol) packet log.
12110 With an argument, sets the log file to the specified FILE. With
12111 no argument, show the current log file name. The default log file
12114 `rdilogenable [ARG]'
12115 Control logging of ADP packets. With an argument of 1 or `"yes"'
12116 enables logging, with an argument 0 or `"no"' disables it. With
12117 no arguments displays the current setting. When logging is
12118 enabled, ADP packets exchanged between GDB and the RDI target
12119 device are logged to a file.
12122 Tell GDB whether the target has ROM at address 0. If on, vector
12123 catching is disabled, so that zero address can be used. If off
12124 (the default), vector catching is enabled. For this command to
12125 take effect, it needs to be invoked prior to the `target rdi'
12128 `show rdiromatzero'
12129 Show the current setting of ROM at zero address.
12132 Enable or disable RDI heartbeat packets. It is not recommended to
12133 turn on this option, since it confuses ARM and EPI JTAG interface,
12134 as well as the Angel monitor.
12136 `show rdiheartbeat'
12137 Show the setting of RDI heartbeat packets.
12140 File: gdb.info, Node: H8/300, Next: H8/500, Prev: ARM, Up: Embedded Processors
12142 18.3.2 Renesas H8/300
12143 ---------------------
12146 A Renesas SH, H8/300, or H8/500 board, attached via serial line to
12147 your host. Use special commands `device' and `speed' to control
12148 the serial line and the communications speed used.
12151 E7000 emulator for Renesas H8 and SH.
12155 Renesas SH-3 and SH-3E target systems.
12158 When you select remote debugging to a Renesas SH, H8/300, or H8/500
12159 board, the `load' command downloads your program to the Renesas board
12160 and also opens it as the current executable target for GDB on your host
12161 (like the `file' command).
12163 GDB needs to know these things to talk to your Renesas SH, H8/300,
12166 1. that you want to use `target hms', the remote debugging interface
12167 for Renesas microprocessors, or `target e7000', the in-circuit
12168 emulator for the Renesas SH and the Renesas 300H. (`target hms' is
12169 the default when GDB is configured specifically for the Renesas SH,
12170 H8/300, or H8/500.)
12172 2. what serial device connects your host to your Renesas board (the
12173 first serial device available on your host is the default).
12175 3. what speed to use over the serial device.
12179 * Renesas Boards:: Connecting to Renesas boards.
12180 * Renesas ICE:: Using the E7000 In-Circuit Emulator.
12181 * Renesas Special:: Special GDB commands for Renesas micros.
12184 File: gdb.info, Node: Renesas Boards, Next: Renesas ICE, Up: H8/300
12186 18.3.2.1 Connecting to Renesas boards
12187 .....................................
12189 Use the special `GDB' command `device PORT' if you need to explicitly
12190 set the serial device. The default PORT is the first available port on
12191 your host. This is only necessary on Unix hosts, where it is typically
12192 something like `/dev/ttya'.
12194 `GDB' has another special command to set the communications speed:
12195 `speed BPS'. This command also is only used from Unix hosts; on DOS
12196 hosts, set the line speed as usual from outside GDB with the DOS `mode'
12197 command (for instance, `mode com2:9600,n,8,1,p' for a 9600bps
12200 The `device' and `speed' commands are available only when you use a
12201 Unix host to debug your Renesas microprocessor programs. If you use a
12202 DOS host, GDB depends on an auxiliary terminate-and-stay-resident
12203 program called `asynctsr' to communicate with the development board
12204 through a PC serial port. You must also use the DOS `mode' command to
12205 set up the serial port on the DOS side.
12207 The following sample session illustrates the steps needed to start a
12208 program under GDB control on an H8/300. The example uses a sample
12209 H8/300 program called `t.x'. The procedure is the same for the Renesas
12212 First hook up your development board. In this example, we use a
12213 board attached to serial port `COM2'; if you use a different serial
12214 port, substitute its name in the argument of the `mode' command. When
12215 you call `asynctsr', the auxiliary comms program used by the debugger,
12216 you give it just the numeric part of the serial port's name; for
12217 example, `asyncstr 2' below runs `asyncstr' on `COM2'.
12219 C:\H8300\TEST> asynctsr 2
12220 C:\H8300\TEST> mode com2:9600,n,8,1,p
12222 Resident portion of MODE loaded
12224 COM2: 9600, n, 8, 1, p
12226 _Warning:_ We have noticed a bug in PC-NFS that conflicts with
12227 `asynctsr'. If you also run PC-NFS on your DOS host, you may need
12228 to disable it, or even boot without it, to use `asynctsr' to
12229 control your development board.
12231 Now that serial communications are set up, and the development board
12232 is connected, you can start up GDB. Call `GDB' with the name of your
12233 program as the argument. `GDB' prompts you, as usual, with the prompt
12234 `(gdb)'. Use two special commands to begin your debugging session:
12235 `target hms' to specify cross-debugging to the Renesas board, and the
12236 `load' command to download your program to the board. `load' displays
12237 the names of the program's sections, and a `*' for each 2K of data
12238 downloaded. (If you want to refresh GDB data on symbols or on the
12239 executable file without downloading, use the GDB commands `file' or
12240 `symbol-file'. These commands, and `load' itself, are described in
12241 *Note Commands to specify files: Files.)
12243 (eg-C:\H8300\TEST) gdb t.x
12244 GDB is free software and you are welcome to distribute copies
12245 of it under certain conditions; type "show copying" to see
12247 There is absolutely no warranty for GDB; type "show warranty"
12249 GDB 6.6, Copyright 1992 Free Software Foundation, Inc...
12251 Connected to remote H8/300 HMS system.
12253 .text : 0x8000 .. 0xabde ***********
12254 .data : 0xabde .. 0xad30 *
12255 .stack : 0xf000 .. 0xf014 *
12257 At this point, you're ready to run or debug your program. From here
12258 on, you can use all the usual GDB commands. The `break' command sets
12259 breakpoints; the `run' command starts your program; `print' or `x'
12260 display data; the `continue' command resumes execution after stopping
12261 at a breakpoint. You can use the `help' command at any time to find
12262 out more about GDB commands.
12264 Remember, however, that _operating system_ facilities aren't
12265 available on your development board; for example, if your program hangs,
12266 you can't send an interrupt--but you can press the RESET switch!
12268 Use the RESET button on the development board
12269 * to interrupt your program (don't use `Ctrl-c' on the DOS host--it
12270 has no way to pass an interrupt signal to the development board);
12273 * to return to the GDB command prompt after your program finishes
12274 normally. The communications protocol provides no other way for
12275 GDB to detect program completion.
12277 In either case, GDB sees the effect of a RESET on the development
12278 board as a "normal exit" of your program.
12281 File: gdb.info, Node: Renesas ICE, Next: Renesas Special, Prev: Renesas Boards, Up: H8/300
12283 18.3.2.2 Using the E7000 in-circuit emulator
12284 ............................................
12286 You can use the E7000 in-circuit emulator to develop code for either the
12287 Renesas SH or the H8/300H. Use one of these forms of the `target
12288 e7000' command to connect GDB to your E7000:
12290 `target e7000 PORT SPEED'
12291 Use this form if your E7000 is connected to a serial port. The
12292 PORT argument identifies what serial port to use (for example,
12293 `com2'). The third argument is the line speed in bits per second
12294 (for example, `9600').
12296 `target e7000 HOSTNAME'
12297 If your E7000 is installed as a host on a TCP/IP network, you can
12298 just specify its hostname; GDB uses `telnet' to connect.
12300 The following special commands are available when debugging with the
12304 This sends the specified COMMAND to the E7000 monitor.
12306 `ftplogin MACHINE USERNAME PASSWORD DIR'
12307 This command records information for subsequent interface with the
12308 E7000 monitor via the FTP protocol: GDB will log into the named
12309 MACHINE using specified USERNAME and PASSWORD, and then chdir to
12310 the named directory DIR.
12313 This command uses credentials recorded by `ftplogin' to fetch and
12314 load the named FILE from the E7000 monitor.
12317 This command drains any pending text buffers stored on the E7000.
12319 `set usehardbreakpoints'
12320 `show usehardbreakpoints'
12321 These commands set and show the use of hardware breakpoints for all
12322 breakpoints. *Note hardware-assisted breakpoint: Set Breaks, for
12323 more information about using hardware breakpoints selectively.
12326 File: gdb.info, Node: Renesas Special, Prev: Renesas ICE, Up: H8/300
12328 18.3.2.3 Special GDB commands for Renesas micros
12329 ................................................
12331 Some GDB commands are available only for the H8/300:
12333 `set machine h8300'
12334 `set machine h8300h'
12335 Condition GDB for one of the two variants of the H8/300
12336 architecture with `set machine'. You can use `show machine' to
12337 check which variant is currently in effect.
12341 File: gdb.info, Node: H8/500, Next: M32R/D, Prev: H8/300, Up: Embedded Processors
12348 Specify which H8/500 memory model (MOD) you are using with `set
12349 memory'; check which memory model is in effect with `show memory'.
12350 The accepted values for MOD are `small', `big', `medium', and
12355 File: gdb.info, Node: M32R/D, Next: M68K, Prev: H8/500, Up: Embedded Processors
12357 18.3.4 Renesas M32R/D and M32R/SDI
12358 ----------------------------------
12361 Renesas M32R/D ROM monitor.
12363 `target m32rsdi DEV'
12364 Renesas M32R SDI server, connected via parallel port to the board.
12366 The following GDB commands are specific to the M32R monitor:
12368 `set download-path PATH'
12369 Set the default path for finding donwloadable SREC files.
12371 `show download-path'
12372 Show the default path for downloadable SREC files.
12374 `set board-address ADDR'
12375 Set the IP address for the M32R-EVA target board.
12377 `show board-address'
12378 Show the current IP address of the target board.
12380 `set server-address ADDR'
12381 Set the IP address for the download server, which is the GDB's
12384 `show server-address'
12385 Display the IP address of the download server.
12388 Upload the specified SREC FILE via the monitor's Ethernet upload
12389 capability. If no FILE argument is given, the current executable
12393 Test the `upload' command.
12395 The following commands are available for M32R/SDI:
12398 This command resets the SDI connection.
12401 This command shows the SDI connection status.
12404 Instructs the remote that M32R/Chaos debugging is to be used.
12407 Instructs the remote to use the DEBUG_DMA method of accessing
12411 Instructs the remote to use the MON_CODE method of accessing
12415 Instructs the remote to set breakpoints by IB break.
12418 Instructs the remote to set breakpoints by DBT.
12421 File: gdb.info, Node: M68K, Next: MIPS Embedded, Prev: M32R/D, Up: Embedded Processors
12426 The Motorola m68k configuration includes ColdFire support, and target
12427 command for the following ROM monitors.
12430 ABug ROM monitor for M68K.
12432 `target cpu32bug DEV'
12433 CPU32BUG monitor, running on a CPU32 (M68K) board.
12436 dBUG ROM monitor for Motorola ColdFire.
12439 EST-300 ICE monitor, running on a CPU32 (M68K) board.
12441 `target rom68k DEV'
12442 ROM 68K monitor, running on an M68K IDP board.
12445 `target rombug DEV'
12446 ROMBUG ROM monitor for OS/9000.
12450 File: gdb.info, Node: MIPS Embedded, Next: OpenRISC 1000, Prev: M68K, Up: Embedded Processors
12452 18.3.6 MIPS Embedded
12453 --------------------
12455 GDB can use the MIPS remote debugging protocol to talk to a MIPS board
12456 attached to a serial line. This is available when you configure GDB
12457 with `--target=mips-idt-ecoff'.
12459 Use these GDB commands to specify the connection to your target
12463 To run a program on the board, start up `gdb' with the name of
12464 your program as the argument. To connect to the board, use the
12465 command `target mips PORT', where PORT is the name of the serial
12466 port connected to the board. If the program has not already been
12467 downloaded to the board, you may use the `load' command to
12468 download it. You can then use all the usual GDB commands.
12470 For example, this sequence connects to the target board through a
12471 serial port, and loads and runs a program called PROG through the
12475 GDB is free software and ...
12476 (gdb) target mips /dev/ttyb
12480 `target mips HOSTNAME:PORTNUMBER'
12481 On some GDB host configurations, you can specify a TCP connection
12482 (for instance, to a serial line managed by a terminal
12483 concentrator) instead of a serial port, using the syntax
12484 `HOSTNAME:PORTNUMBER'.
12490 NEC's DDB variant of PMON for Vr4300.
12493 LSI variant of PMON.
12496 Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips.
12499 Array Tech LSI33K RAID controller board.
12502 GDB also supports these special commands for MIPS targets:
12504 `set mipsfpu double'
12505 `set mipsfpu single'
12509 If your target board does not support the MIPS floating point
12510 coprocessor, you should use the command `set mipsfpu none' (if you
12511 need this, you may wish to put the command in your GDB init file).
12512 This tells GDB how to find the return value of functions which
12513 return floating point values. It also allows GDB to avoid saving
12514 the floating point registers when calling functions on the board.
12515 If you are using a floating point coprocessor with only single
12516 precision floating point support, as on the R4650 processor, use
12517 the command `set mipsfpu single'. The default double precision
12518 floating point coprocessor may be selected using `set mipsfpu
12521 In previous versions the only choices were double precision or no
12522 floating point, so `set mipsfpu on' will select double precision
12523 and `set mipsfpu off' will select no floating point.
12525 As usual, you can inquire about the `mipsfpu' variable with `show
12528 `set timeout SECONDS'
12529 `set retransmit-timeout SECONDS'
12531 `show retransmit-timeout'
12532 You can control the timeout used while waiting for a packet, in
12533 the MIPS remote protocol, with the `set timeout SECONDS' command.
12534 The default is 5 seconds. Similarly, you can control the timeout
12535 used while waiting for an acknowledgement of a packet with the `set
12536 retransmit-timeout SECONDS' command. The default is 3 seconds.
12537 You can inspect both values with `show timeout' and `show
12538 retransmit-timeout'. (These commands are _only_ available when
12539 GDB is configured for `--target=mips-idt-ecoff'.)
12541 The timeout set by `set timeout' does not apply when GDB is
12542 waiting for your program to stop. In that case, GDB waits forever
12543 because it has no way of knowing how long the program is going to
12544 run before stopping.
12546 `set syn-garbage-limit NUM'
12547 Limit the maximum number of characters GDB should ignore when it
12548 tries to synchronize with the remote target. The default is 10
12549 characters. Setting the limit to -1 means there's no limit.
12551 `show syn-garbage-limit'
12552 Show the current limit on the number of characters to ignore when
12553 trying to synchronize with the remote system.
12555 `set monitor-prompt PROMPT'
12556 Tell GDB to expect the specified PROMPT string from the remote
12557 monitor. The default depends on the target:
12567 `show monitor-prompt'
12568 Show the current strings GDB expects as the prompt from the remote
12571 `set monitor-warnings'
12572 Enable or disable monitor warnings about hardware breakpoints.
12573 This has effect only for the `lsi' target. When on, GDB will
12574 display warning messages whose codes are returned by the `lsi'
12575 PMON monitor for breakpoint commands.
12577 `show monitor-warnings'
12578 Show the current setting of printing monitor warnings.
12581 This command allows sending an arbitrary COMMAND string to the
12582 monitor. The monitor must be in debug mode for this to work.
12585 File: gdb.info, Node: OpenRISC 1000, Next: PA, Prev: MIPS Embedded, Up: Embedded Processors
12587 18.3.7 OpenRISC 1000
12588 --------------------
12590 See OR1k Architecture document (`www.opencores.org') for more
12591 information about platform and commands.
12593 `target jtag jtag://HOST:PORT'
12594 Connects to remote JTAG server. JTAG remote server can be either
12595 an or1ksim or JTAG server, connected via parallel port to the
12598 Example: `target jtag jtag://localhost:9999'
12601 If connected to `or1ksim' OpenRISC 1000 Architectural Simulator,
12602 proprietary commands can be executed.
12605 Displays spr groups.
12607 `info or1k spr GROUP'
12608 `info or1k spr GROUPNO'
12609 Displays register names in selected group.
12611 `info or1k spr GROUP REGISTER'
12612 `info or1k spr REGISTER'
12613 `info or1k spr GROUPNO REGISTERNO'
12614 `info or1k spr REGISTERNO'
12615 Shows information about specified spr register.
12617 `spr GROUP REGISTER VALUE'
12618 `spr REGISTER VALUE'
12619 `spr GROUPNO REGISTERNO VALUE'
12620 `spr REGISTERNO VALUE'
12621 Writes VALUE to specified spr register.
12623 Some implementations of OpenRISC 1000 Architecture also have
12624 hardware trace. It is very similar to GDB trace, except it does not
12625 interfere with normal program execution and is thus much faster.
12626 Hardware breakpoints/watchpoint triggers can be set using:
12628 Load effective address/data
12631 Store effective address/data
12634 Access effective address ($SEA or $LEA) or data ($SDATA/$LDATA)
12639 When triggered, it can capture low level data, like: `PC', `LSEA',
12640 `LDATA', `SDATA', `READSPR', `WRITESPR', `INSTR'.
12643 `hwatch CONDITIONAL'
12644 Set hardware watchpoint on combination of Load/Store Effecive
12645 Address(es) or Data. For example:
12647 `hwatch ($LEA == my_var) && ($LDATA < 50) || ($SEA == my_var) &&
12650 `hwatch ($LEA == my_var) && ($LDATA < 50) || ($SEA == my_var) &&
12654 Display information about current HW trace configuration.
12656 `htrace trigger CONDITIONAL'
12657 Set starting criteria for HW trace.
12659 `htrace qualifier CONDITIONAL'
12660 Set acquisition qualifier for HW trace.
12662 `htrace stop CONDITIONAL'
12663 Set HW trace stopping criteria.
12665 `htrace record [DATA]*'
12666 Selects the data to be recorded, when qualifier is met and HW
12667 trace was triggered.
12671 Enables/disables the HW trace.
12673 `htrace rewind [FILENAME]'
12674 Clears currently recorded trace data.
12676 If filename is specified, new trace file is made and any newly
12677 collected data will be written there.
12679 `htrace print [START [LEN]]'
12680 Prints trace buffer, using current record configuration.
12682 `htrace mode continuous'
12683 Set continuous trace mode.
12685 `htrace mode suspend'
12686 Set suspend trace mode.
12690 File: gdb.info, Node: PowerPC, Next: SH, Prev: PA, Up: Embedded Processors
12695 `target dink32 DEV'
12696 DINK32 ROM monitor.
12698 `target ppcbug DEV'
12700 `target ppcbug1 DEV'
12701 PPCBUG ROM monitor for PowerPC.
12704 SDS monitor, running on a PowerPC board (such as Motorola's ADS).
12706 The following commands specifi to the SDS protocol are supported
12709 `set sdstimeout NSEC'
12710 Set the timeout for SDS protocol reads to be NSEC seconds. The
12711 default is 2 seconds.
12714 Show the current value of the SDS timeout.
12717 Send the specified COMMAND string to the SDS monitor.
12720 File: gdb.info, Node: PA, Next: PowerPC, Prev: OpenRISC 1000, Up: Embedded Processors
12722 18.3.9 HP PA Embedded
12723 ---------------------
12726 OP50N monitor, running on an OKI HPPA board.
12729 W89K monitor, running on a Winbond HPPA board.
12733 File: gdb.info, Node: SH, Next: Sparclet, Prev: PowerPC, Up: Embedded Processors
12739 A Renesas SH board attached via serial line to your host. Use
12740 special commands `device' and `speed' to control the serial line
12741 and the communications speed used.
12744 E7000 emulator for Renesas SH.
12749 Renesas SH-3 and SH-3E target systems.
12753 File: gdb.info, Node: Sparclet, Next: Sparclite, Prev: SH, Up: Embedded Processors
12755 18.3.11 Tsqware Sparclet
12756 ------------------------
12758 GDB enables developers to debug tasks running on Sparclet targets from
12759 a Unix host. GDB uses code that runs on both the Unix host and on the
12760 Sparclet target. The program `gdb' is installed and executed on the
12763 `remotetimeout ARGS'
12764 GDB supports the option `remotetimeout'. This option is set by
12765 the user, and ARGS represents the number of seconds GDB waits for
12768 When compiling for debugging, include the options `-g' to get debug
12769 information and `-Ttext' to relocate the program to where you wish to
12770 load it on the target. You may also want to add the options `-n' or
12771 `-N' in order to reduce the size of the sections. Example:
12773 sparclet-aout-gcc prog.c -Ttext 0x12010000 -g -o prog -N
12775 You can use `objdump' to verify that the addresses are what you
12778 sparclet-aout-objdump --headers --syms prog
12780 Once you have set your Unix execution search path to find GDB, you
12781 are ready to run GDB. From your Unix host, run `gdb' (or
12782 `sparclet-aout-gdb', depending on your installation).
12784 GDB comes up showing the prompt:
12790 * Sparclet File:: Setting the file to debug
12791 * Sparclet Connection:: Connecting to Sparclet
12792 * Sparclet Download:: Sparclet download
12793 * Sparclet Execution:: Running and debugging
12796 File: gdb.info, Node: Sparclet File, Next: Sparclet Connection, Up: Sparclet
12798 18.3.11.1 Setting file to debug
12799 ...............................
12801 The GDB command `file' lets you choose with program to debug.
12803 (gdbslet) file prog
12805 GDB then attempts to read the symbol table of `prog'. GDB locates
12806 the file by searching the directories listed in the command search path.
12807 If the file was compiled with debug information (option "-g"), source
12808 files will be searched as well. GDB locates the source files by
12809 searching the directories listed in the directory search path (*note
12810 Your program's environment: Environment.). If it fails to find a file,
12811 it displays a message such as:
12813 prog: No such file or directory.
12815 When this happens, add the appropriate directories to the search
12816 paths with the GDB commands `path' and `dir', and execute the `target'
12820 File: gdb.info, Node: Sparclet Connection, Next: Sparclet Download, Prev: Sparclet File, Up: Sparclet
12822 18.3.11.2 Connecting to Sparclet
12823 ................................
12825 The GDB command `target' lets you connect to a Sparclet target. To
12826 connect to a target on serial port "`ttya'", type:
12828 (gdbslet) target sparclet /dev/ttya
12829 Remote target sparclet connected to /dev/ttya
12830 main () at ../prog.c:3
12832 GDB displays messages like these:
12837 File: gdb.info, Node: Sparclet Download, Next: Sparclet Execution, Prev: Sparclet Connection, Up: Sparclet
12839 18.3.11.3 Sparclet download
12840 ...........................
12842 Once connected to the Sparclet target, you can use the GDB `load'
12843 command to download the file from the host to the target. The file
12844 name and load offset should be given as arguments to the `load' command.
12845 Since the file format is aout, the program must be loaded to the
12846 starting address. You can use `objdump' to find out what this value
12847 is. The load offset is an offset which is added to the VMA (virtual
12848 memory address) of each of the file's sections. For instance, if the
12849 program `prog' was linked to text address 0x1201000, with data at
12850 0x12010160 and bss at 0x12010170, in GDB, type:
12852 (gdbslet) load prog 0x12010000
12853 Loading section .text, size 0xdb0 vma 0x12010000
12855 If the code is loaded at a different address then what the program
12856 was linked to, you may need to use the `section' and `add-symbol-file'
12857 commands to tell GDB where to map the symbol table.
12860 File: gdb.info, Node: Sparclet Execution, Prev: Sparclet Download, Up: Sparclet
12862 18.3.11.4 Running and debugging
12863 ...............................
12865 You can now begin debugging the task using GDB's execution control
12866 commands, `b', `step', `run', etc. See the GDB manual for the list of
12870 Breakpoint 1 at 0x12010000: file prog.c, line 3.
12872 Starting program: prog
12873 Breakpoint 1, main (argc=1, argv=0xeffff21c) at prog.c:3
12874 3 char *symarg = 0;
12876 4 char *execarg = "hello!";
12880 File: gdb.info, Node: Sparclite, Next: ST2000, Prev: Sparclet, Up: Embedded Processors
12882 18.3.12 Fujitsu Sparclite
12883 -------------------------
12885 `target sparclite DEV'
12886 Fujitsu sparclite boards, used only for the purpose of loading.
12887 You must use an additional command to debug the program. For
12888 example: target remote DEV using GDB standard remote protocol.
12892 File: gdb.info, Node: ST2000, Next: Z8000, Prev: Sparclite, Up: Embedded Processors
12894 18.3.13 Tandem ST2000
12895 ---------------------
12897 GDB may be used with a Tandem ST2000 phone switch, running Tandem's
12900 To connect your ST2000 to the host system, see the manufacturer's
12901 manual. Once the ST2000 is physically attached, you can run:
12903 target st2000 DEV SPEED
12905 to establish it as your debugging environment. DEV is normally the
12906 name of a serial device, such as `/dev/ttya', connected to the ST2000
12907 via a serial line. You can instead specify DEV as a TCP connection
12908 (for example, to a serial line attached via a terminal concentrator)
12909 using the syntax `HOSTNAME:PORTNUMBER'.
12911 The `load' and `attach' commands are _not_ defined for this target;
12912 you must load your program into the ST2000 as you normally would for
12913 standalone operation. GDB reads debugging information (such as
12914 symbols) from a separate, debugging version of the program available on
12915 your host computer.
12917 These auxiliary GDB commands are available to help you with the
12918 ST2000 environment:
12921 Send a COMMAND to the STDBUG monitor. See the manufacturer's
12922 manual for available commands.
12925 Connect the controlling terminal to the STDBUG command monitor.
12926 When you are done interacting with STDBUG, typing either of two
12927 character sequences gets you back to the GDB command prompt:
12928 `<RET> ~ .' (Return, followed by tilde and period) or `<RET> ~
12929 Ctrl-d' (Return, followed by tilde and control-D).
12932 File: gdb.info, Node: Z8000, Next: AVR, Prev: ST2000, Up: Embedded Processors
12934 18.3.14 Zilog Z8000
12935 -------------------
12937 When configured for debugging Zilog Z8000 targets, GDB includes a Z8000
12940 For the Z8000 family, `target sim' simulates either the Z8002 (the
12941 unsegmented variant of the Z8000 architecture) or the Z8001 (the
12942 segmented variant). The simulator recognizes which architecture is
12943 appropriate by inspecting the object code.
12946 Debug programs on a simulated CPU. If the simulator supports setup
12947 options, specify them via ARGS.
12949 After specifying this target, you can debug programs for the simulated
12950 CPU in the same style as programs for your host computer; use the
12951 `file' command to load a new program image, the `run' command to run
12952 your program, and so on.
12954 As well as making available all the usual machine registers (*note
12955 Registers: Registers.), the Z8000 simulator provides three additional
12956 items of information as specially named registers:
12959 Counts clock-ticks in the simulator.
12962 Counts instructions run in the simulator.
12965 Execution time in 60ths of a second.
12968 You can refer to these values in GDB expressions with the usual
12969 conventions; for example, `b fputc if $cycles>5000' sets a conditional
12970 breakpoint that suspends only after at least 5000 simulated clock ticks.
12973 File: gdb.info, Node: AVR, Next: CRIS, Prev: Z8000, Up: Embedded Processors
12978 When configured for debugging the Atmel AVR, GDB supports the following
12979 AVR-specific commands:
12981 `info io_registers'
12982 This command displays information about the AVR I/O registers. For
12983 each register, GDB prints its number and value.
12986 File: gdb.info, Node: CRIS, Next: Super-H, Prev: AVR, Up: Embedded Processors
12991 When configured for debugging CRIS, GDB provides the following
12992 CRIS-specific commands:
12994 `set cris-version VER'
12995 Set the current CRIS version to VER, either `10' or `32'. The
12996 CRIS version affects register names and sizes. This command is
12997 useful in case autodetection of the CRIS version fails.
12999 `show cris-version'
13000 Show the current CRIS version.
13002 `set cris-dwarf2-cfi'
13003 Set the usage of DWARF-2 CFI for CRIS debugging. The default is
13004 `on'. Change to `off' when using `gcc-cris' whose version is below
13007 `show cris-dwarf2-cfi'
13008 Show the current state of using DWARF-2 CFI.
13010 `set cris-mode MODE'
13011 Set the current CRIS mode to MODE. It should only be changed when
13012 debugging in guru mode, in which case it should be set to `guru'
13013 (the default is `normal').
13016 Show the current CRIS mode.
13019 File: gdb.info, Node: Super-H, Next: WinCE, Prev: CRIS, Up: Embedded Processors
13021 18.3.17 Renesas Super-H
13022 -----------------------
13024 For the Renesas Super-H processor, GDB provides these commands:
13027 Show the values of all Super-H registers.
13030 File: gdb.info, Node: WinCE, Prev: Super-H, Up: Embedded Processors
13035 The following commands are available for Windows CE:
13037 `set remotedirectory DIR'
13038 Tell GDB to upload files from the named directory DIR. The
13039 default is `/gdb', i.e. the root directory on the current drive.
13041 `show remotedirectory'
13042 Show the current value of the upload directory.
13044 `set remoteupload METHOD'
13045 Set the method used to upload files to remote device. Valid values
13046 for METHOD are `always', `newer', and `never'. The default is
13049 `show remoteupload'
13050 Show the current setting of the upload method.
13052 `set remoteaddhost'
13053 Tell GDB whether to add this host to the remote stub's arguments
13054 when you debug over a network.
13056 `show remoteaddhost'
13057 Show whether to add this host to remote stub's arguments when
13058 debugging over a network.
13061 File: gdb.info, Node: Architectures, Prev: Embedded Processors, Up: Configurations
13066 This section describes characteristics of architectures that affect all
13067 uses of GDB with the architecture, both native and cross.
13075 * HPPA:: HP PA architecture
13078 File: gdb.info, Node: i386, Next: A29K, Up: Architectures
13080 18.4.1 x86 Architecture-specific issues.
13081 ----------------------------------------
13083 `set struct-convention MODE'
13084 Set the convention used by the inferior to return `struct's and
13085 `union's from functions to MODE. Possible values of MODE are
13086 `"pcc"', `"reg"', and `"default"' (the default). `"default"' or
13087 `"pcc"' means that `struct's are returned on the stack, while
13088 `"reg"' means that a `struct' or a `union' whose size is 1, 2, 4,
13089 or 8 bytes will be returned in a register.
13091 `show struct-convention'
13092 Show the current setting of the convention to return `struct's
13096 File: gdb.info, Node: A29K, Next: Alpha, Prev: i386, Up: Architectures
13101 `set rstack_high_address ADDRESS'
13102 On AMD 29000 family processors, registers are saved in a separate
13103 "register stack". There is no way for GDB to determine the extent
13104 of this stack. Normally, GDB just assumes that the stack is
13105 "large enough". This may result in GDB referencing memory
13106 locations that do not exist. If necessary, you can get around
13107 this problem by specifying the ending address of the register
13108 stack with the `set rstack_high_address' command. The argument
13109 should be an address, which you probably want to precede with `0x'
13110 to specify in hexadecimal.
13112 `show rstack_high_address'
13113 Display the current limit of the register stack, on AMD 29000
13118 File: gdb.info, Node: Alpha, Next: MIPS, Prev: A29K, Up: Architectures
13123 See the following section.
13126 File: gdb.info, Node: MIPS, Next: HPPA, Prev: Alpha, Up: Architectures
13131 Alpha- and MIPS-based computers use an unusual stack frame, which
13132 sometimes requires GDB to search backward in the object code to find
13133 the beginning of a function.
13135 To improve response time (especially for embedded applications, where
13136 GDB may be restricted to a slow serial line for this search) you may
13137 want to limit the size of this search, using one of these commands:
13139 `set heuristic-fence-post LIMIT'
13140 Restrict GDB to examining at most LIMIT bytes in its search for
13141 the beginning of a function. A value of 0 (the default) means
13142 there is no limit. However, except for 0, the larger the limit
13143 the more bytes `heuristic-fence-post' must search and therefore
13144 the longer it takes to run. You should only need to use this
13145 command when debugging a stripped executable.
13147 `show heuristic-fence-post'
13148 Display the current limit.
13150 These commands are available _only_ when GDB is configured for
13151 debugging programs on Alpha or MIPS processors.
13153 Several MIPS-specific commands are available when debugging MIPS
13156 `set mips saved-gpreg-size SIZE'
13157 Set the size of MIPS general-purpose registers saved on the stack.
13158 The argument SIZE can be one of the following:
13161 32-bit GP registers
13164 64-bit GP registers
13167 Use the target's default setting or autodetect the saved size
13168 from the information contained in the executable. This is
13171 `show mips saved-gpreg-size'
13172 Show the current size of MIPS GP registers on the stack.
13174 `set mips stack-arg-size SIZE'
13175 Set the amount of stack space reserved for arguments to functions.
13176 The argument can be one of `"32"', `"64"' or `"auto"' (the
13180 Tell GDB which MIPS ABI is used by the inferior. Possible values
13184 The default ABI associated with the current binary (this is
13202 Show the MIPS ABI used by GDB to debug the inferior.
13206 *Note set mipsfpu: MIPS Embedded.
13208 `set mips mask-address ARG'
13209 This command determines whether the most-significant 32 bits of
13210 64-bit MIPS addresses are masked off. The argument ARG can be
13211 `on', `off', or `auto'. The latter is the default setting, which
13212 lets GDB determine the correct value.
13214 `show mips mask-address'
13215 Show whether the upper 32 bits of MIPS addresses are masked off or
13218 `set remote-mips64-transfers-32bit-regs'
13219 This command controls compatibility with 64-bit MIPS targets that
13220 transfer data in 32-bit quantities. If you have an old MIPS 64
13221 target that transfers 32 bits for some registers, like SR and FSR,
13222 and 64 bits for other registers, set this option to `on'.
13224 `show remote-mips64-transfers-32bit-regs'
13225 Show the current setting of compatibility with older MIPS 64
13229 This command turns on and off debugging messages for the
13230 MIPS-specific target code in GDB.
13233 Show the current setting of MIPS debugging messages.
13236 File: gdb.info, Node: HPPA, Prev: MIPS, Up: Architectures
13241 When GDB is debugging te HP PA architecture, it provides the following
13245 THis command determines whether HPPA architecture specific
13246 debugging messages are to be displayed.
13249 Show whether HPPA debugging messages are displayed.
13251 `maint print unwind ADDRESS'
13252 This command displays the contents of the unwind table entry at the
13257 File: gdb.info, Node: Controlling GDB, Next: Sequences, Prev: Configurations, Up: Top
13262 You can alter the way GDB interacts with you by using the `set'
13263 command. For commands controlling how GDB displays data, see *Note
13264 Print settings: Print Settings. Other settings are described here.
13269 * Editing:: Command editing
13270 * Command History:: Command history
13271 * Screen Size:: Screen size
13272 * Numbers:: Numbers
13273 * ABI:: Configuring the current ABI
13274 * Messages/Warnings:: Optional warnings and messages
13275 * Debugging Output:: Optional messages about internal happenings
13278 File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
13283 GDB indicates its readiness to read a command by printing a string
13284 called the "prompt". This string is normally `(gdb)'. You can change
13285 the prompt string with the `set prompt' command. For instance, when
13286 debugging GDB with GDB, it is useful to change the prompt in one of the
13287 GDB sessions so that you can always tell which one you are talking to.
13289 _Note:_ `set prompt' does not add a space for you after the prompt
13290 you set. This allows you to set a prompt which ends in a space or a
13291 prompt that does not.
13293 `set prompt NEWPROMPT'
13294 Directs GDB to use NEWPROMPT as its prompt string henceforth.
13297 Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
13300 File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB
13302 19.2 Command editing
13303 ====================
13305 GDB reads its input commands via the "Readline" interface. This GNU
13306 library provides consistent behavior for programs which provide a
13307 command line interface to the user. Advantages are GNU Emacs-style or
13308 "vi"-style inline editing of commands, `csh'-like history substitution,
13309 and a storage and recall of command history across debugging sessions.
13311 You may control the behavior of command line editing in GDB with the
13316 Enable command line editing (enabled by default).
13319 Disable command line editing.
13322 Show whether command line editing is enabled.
13324 *Note Command Line Editing::, for more details about the Readline
13325 interface. Users unfamiliar with GNU Emacs or `vi' are encouraged to
13329 File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
13331 19.3 Command history
13332 ====================
13334 GDB can keep track of the commands you type during your debugging
13335 sessions, so that you can be certain of precisely what happened. Use
13336 these commands to manage the GDB command history facility.
13338 GDB uses the GNU History library, a part of the Readline package, to
13339 provide the history facility. *Note Using History Interactively::, for
13340 the detailed description of the History library.
13342 To issue a command to GDB without affecting certain aspects of the
13343 state which is seen by users, prefix it with `server '. This means
13344 that this command will not affect the command history, nor will it
13345 affect GDB's notion of which command to repeat if <RET> is pressed on a
13348 The server prefix does not affect the recording of values into the
13349 value history; to print a value without recording it into the value
13350 history, use the `output' command instead of the `print' command.
13352 Here is the description of GDB commands related to command history.
13354 `set history filename FNAME'
13355 Set the name of the GDB command history file to FNAME. This is
13356 the file where GDB reads an initial command history list, and
13357 where it writes the command history from this session when it
13358 exits. You can access this list through history expansion or
13359 through the history command editing characters listed below. This
13360 file defaults to the value of the environment variable
13361 `GDBHISTFILE', or to `./.gdb_history' (`./_gdb_history' on MS-DOS)
13362 if this variable is not set.
13365 `set history save on'
13366 Record command history in a file, whose name may be specified with
13367 the `set history filename' command. By default, this option is
13370 `set history save off'
13371 Stop recording command history in a file.
13373 `set history size SIZE'
13374 Set the number of commands which GDB keeps in its history list.
13375 This defaults to the value of the environment variable `HISTSIZE',
13376 or to 256 if this variable is not set.
13378 History expansion assigns special meaning to the character `!'.
13379 *Note Event Designators::, for more details.
13381 Since `!' is also the logical not operator in C, history expansion
13382 is off by default. If you decide to enable history expansion with the
13383 `set history expansion on' command, you may sometimes need to follow
13384 `!' (when it is used as logical not, in an expression) with a space or
13385 a tab to prevent it from being expanded. The readline history
13386 facilities do not attempt substitution on the strings `!=' and `!(',
13387 even when history expansion is enabled.
13389 The commands to control history expansion are:
13391 `set history expansion on'
13392 `set history expansion'
13393 Enable history expansion. History expansion is off by default.
13395 `set history expansion off'
13396 Disable history expansion.
13399 `show history filename'
13400 `show history save'
13401 `show history size'
13402 `show history expansion'
13403 These commands display the state of the GDB history parameters.
13404 `show history' by itself displays all four states.
13407 Display the last ten commands in the command history.
13410 Print ten commands centered on command number N.
13413 Print ten commands just after the commands last printed.
13416 File: gdb.info, Node: Screen Size, Next: Numbers, Prev: Command History, Up: Controlling GDB
13421 Certain commands to GDB may produce large amounts of information output
13422 to the screen. To help you read all of it, GDB pauses and asks you for
13423 input at the end of each page of output. Type <RET> when you want to
13424 continue the output, or `q' to discard the remaining output. Also, the
13425 screen width setting determines when to wrap lines of output.
13426 Depending on what is being printed, GDB tries to break the line at a
13427 readable place, rather than simply letting it overflow onto the
13430 Normally GDB knows the size of the screen from the terminal driver
13431 software. For example, on Unix GDB uses the termcap data base together
13432 with the value of the `TERM' environment variable and the `stty rows'
13433 and `stty cols' settings. If this is not correct, you can override it
13434 with the `set height' and `set width' commands:
13440 These `set' commands specify a screen height of LPP lines and a
13441 screen width of CPL characters. The associated `show' commands
13442 display the current settings.
13444 If you specify a height of zero lines, GDB does not pause during
13445 output no matter how long the output is. This is useful if output
13446 is to a file or to an editor buffer.
13448 Likewise, you can specify `set width 0' to prevent GDB from
13449 wrapping its output.
13451 `set pagination on'
13452 `set pagination off'
13453 Turn the output pagination on or off; the default is on. Turning
13454 pagination off is the alternative to `set height 0'.
13457 Show the current pagination mode.
13460 File: gdb.info, Node: Numbers, Next: ABI, Prev: Screen Size, Up: Controlling GDB
13465 You can always enter numbers in octal, decimal, or hexadecimal in GDB
13466 by the usual conventions: octal numbers begin with `0', decimal numbers
13467 end with `.', and hexadecimal numbers begin with `0x'. Numbers that
13468 neither begin with `0' or `0x', nor end with a `.' are, by default,
13469 entered in base 10; likewise, the default display for numbers--when no
13470 particular format is specified--is base 10. You can change the default
13471 base for both input and output with the commands described below.
13473 `set input-radix BASE'
13474 Set the default base for numeric input. Supported choices for
13475 BASE are decimal 8, 10, or 16. BASE must itself be specified
13476 either unambiguously or using the current input radix; for
13479 set input-radix 012
13480 set input-radix 10.
13481 set input-radix 0xa
13483 sets the input base to decimal. On the other hand, `set
13484 input-radix 10' leaves the input radix unchanged, no matter what
13485 it was, since `10', being without any leading or trailing signs of
13486 its base, is interpreted in the current radix. Thus, if the
13487 current radix is 16, `10' is interpreted in hex, i.e. as 16
13488 decimal, which doesn't change the radix.
13490 `set output-radix BASE'
13491 Set the default base for numeric display. Supported choices for
13492 BASE are decimal 8, 10, or 16. BASE must itself be specified
13493 either unambiguously or using the current input radix.
13496 Display the current default base for numeric input.
13498 `show output-radix'
13499 Display the current default base for numeric display.
13503 These commands set and show the default base for both input and
13504 output of numbers. `set radix' sets the radix of input and output
13505 to the same base; without an argument, it resets the radix back to
13506 its default value of 10.
13510 File: gdb.info, Node: ABI, Next: Messages/Warnings, Prev: Numbers, Up: Controlling GDB
13512 19.6 Configuring the current ABI
13513 ================================
13515 GDB can determine the "ABI" (Application Binary Interface) of your
13516 application automatically. However, sometimes you need to override its
13517 conclusions. Use these commands to manage GDB's view of the current
13520 One GDB configuration can debug binaries for multiple operating
13521 system targets, either via remote debugging or native emulation. GDB
13522 will autodetect the "OS ABI" (Operating System ABI) in use, but you can
13523 override its conclusion using the `set osabi' command. One example
13524 where this is useful is in debugging of binaries which use an alternate
13525 C library (e.g. UCLIBC for GNU/Linux) which does not have the same
13526 identifying marks that the standard C library for your platform
13530 Show the OS ABI currently in use.
13533 With no argument, show the list of registered available OS ABI's.
13536 Set the current OS ABI to ABI.
13538 Generally, the way that an argument of type `float' is passed to a
13539 function depends on whether the function is prototyped. For a
13540 prototyped (i.e. ANSI/ISO style) function, `float' arguments are passed
13541 unchanged, according to the architecture's convention for `float'. For
13542 unprototyped (i.e. K&R style) functions, `float' arguments are first
13543 promoted to type `double' and then passed.
13545 Unfortunately, some forms of debug information do not reliably
13546 indicate whether a function is prototyped. If GDB calls a function
13547 that is not marked as prototyped, it consults `set
13548 coerce-float-to-double'.
13550 `set coerce-float-to-double'
13551 `set coerce-float-to-double on'
13552 Arguments of type `float' will be promoted to `double' when passed
13553 to an unprototyped function. This is the default setting.
13555 `set coerce-float-to-double off'
13556 Arguments of type `float' will be passed directly to unprototyped
13559 `show coerce-float-to-double'
13560 Show the current setting of promoting `float' to `double'.
13562 GDB needs to know the ABI used for your program's C++ objects. The
13563 correct C++ ABI depends on which C++ compiler was used to build your
13564 application. GDB only fully supports programs with a single C++ ABI;
13565 if your program contains code using multiple C++ ABI's or if GDB can
13566 not identify your program's ABI correctly, you can tell GDB which ABI
13567 to use. Currently supported ABI's include "gnu-v2", for `g++' versions
13568 before 3.0, "gnu-v3", for `g++' versions 3.0 and later, and "hpaCC" for
13569 the HP ANSI C++ compiler. Other C++ compilers may use the "gnu-v2" or
13570 "gnu-v3" ABI's as well. The default setting is "auto".
13573 Show the C++ ABI currently in use.
13576 With no argument, show the list of supported C++ ABI's.
13580 Set the current C++ ABI to ABI, or return to automatic detection.
13583 File: gdb.info, Node: Messages/Warnings, Next: Debugging Output, Prev: ABI, Up: Controlling GDB
13585 19.7 Optional warnings and messages
13586 ===================================
13588 By default, GDB is silent about its inner workings. If you are running
13589 on a slow machine, you may want to use the `set verbose' command. This
13590 makes GDB tell you when it does a lengthy internal operation, so you
13591 will not think it has crashed.
13593 Currently, the messages controlled by `set verbose' are those which
13594 announce that the symbol table for a source file is being read; see
13595 `symbol-file' in *Note Commands to specify files: Files.
13598 Enables GDB output of certain informational messages.
13601 Disables GDB output of certain informational messages.
13604 Displays whether `set verbose' is on or off.
13606 By default, if GDB encounters bugs in the symbol table of an object
13607 file, it is silent; but if you are debugging a compiler, you may find
13608 this information useful (*note Errors reading symbol files: Symbol
13611 `set complaints LIMIT'
13612 Permits GDB to output LIMIT complaints about each type of unusual
13613 symbols before becoming silent about the problem. Set LIMIT to
13614 zero to suppress all complaints; set it to a large number to
13615 prevent complaints from being suppressed.
13618 Displays how many symbol complaints GDB is permitted to produce.
13621 By default, GDB is cautious, and asks what sometimes seems to be a
13622 lot of stupid questions to confirm certain commands. For example, if
13623 you try to run a program which is already running:
13626 The program being debugged has been started already.
13627 Start it from the beginning? (y or n)
13629 If you are willing to unflinchingly face the consequences of your own
13630 commands, you can disable this "feature":
13633 Disables confirmation requests.
13636 Enables confirmation requests (the default).
13639 Displays state of confirmation requests.
13642 If you need to debug user-defined commands or sourced files you may
13643 find it useful to enable "command tracing". In this mode each command
13644 will be printed as it is executed, prefixed with one or more `+'
13645 symbols, the quantity denoting the call depth of each command.
13647 `set trace-commands on'
13648 Enable command tracing.
13650 `set trace-commands off'
13651 Disable command tracing.
13653 `show trace-commands'
13654 Display the current state of command tracing.
13657 File: gdb.info, Node: Debugging Output, Prev: Messages/Warnings, Up: Controlling GDB
13659 19.8 Optional messages about internal happenings
13660 ================================================
13662 GDB has commands that enable optional debugging messages from various
13663 GDB subsystems; normally these commands are of interest to GDB
13664 maintainers, or when reporting a bug. This section documents those
13667 `set exec-done-display'
13668 Turns on or off the notification of asynchronous commands'
13669 completion. When on, GDB will print a message when an
13670 asynchronous command finishes its execution. The default is off.
13672 `show exec-done-display'
13673 Displays the current setting of asynchronous command completion
13677 Turns on or off display of gdbarch debugging info. The default is
13681 Displays the current state of displaying gdbarch debugging info.
13683 `set debug aix-thread'
13684 Display debugging messages about inner workings of the AIX thread
13687 `show debug aix-thread'
13688 Show the current state of AIX thread debugging info display.
13691 Turns on or off display of GDB event debugging info. The default
13695 Displays the current state of displaying GDB event debugging info.
13697 `set debug expression'
13698 Turns on or off display of debugging info about GDB expression
13699 parsing. The default is off.
13701 `show debug expression'
13702 Displays the current state of displaying debugging info about GDB
13703 expression parsing.
13706 Turns on or off display of GDB frame debugging info. The default
13710 Displays the current state of displaying GDB frame debugging info.
13713 Turns on or off display of GDB debugging info for running the
13714 inferior. The default is off. `infrun.c' contains GDB's runtime
13715 state machine used for implementing operations such as
13716 single-stepping the inferior.
13718 `show debug infrun'
13719 Displays the current state of GDB inferior debugging.
13721 `set debug lin-lwp'
13722 Turns on or off debugging messages from the Linux LWP debug
13725 `show debug lin-lwp'
13726 Show the current state of Linux LWP debugging messages.
13728 `set debug observer'
13729 Turns on or off display of GDB observer debugging. This includes
13730 info such as the notification of observable events.
13732 `show debug observer'
13733 Displays the current state of observer debugging.
13735 `set debug overload'
13736 Turns on or off display of GDB C++ overload debugging info. This
13737 includes info such as ranking of functions, etc. The default is
13740 `show debug overload'
13741 Displays the current state of displaying GDB C++ overload
13745 Turns on or off display of reports on all packets sent back and
13746 forth across the serial line to the remote machine. The info is
13747 printed on the GDB standard output stream. The default is off.
13749 `show debug remote'
13750 Displays the state of display of remote packets.
13753 Turns on or off display of GDB serial debugging info. The default
13756 `show debug serial'
13757 Displays the current state of displaying GDB serial debugging info.
13759 `set debug solib-frv'
13760 Turns on or off debugging messages for FR-V shared-library code.
13762 `show debug solib-frv'
13763 Display the current state of FR-V shared-library code debugging
13767 Turns on or off display of GDB target debugging info. This info
13768 includes what is going on at the target level of GDB, as it
13769 happens. The default is 0. Set it to 1 to track events, and to 2
13770 to also track the value of large memory transfers. Changes to
13771 this flag do not take effect until the next time you connect to a
13772 target or use the `run' command.
13774 `show debug target'
13775 Displays the current state of displaying GDB target debugging info.
13778 Turns on or off display of GDB variable object debugging info. The
13782 Displays the current state of displaying GDB variable object
13786 File: gdb.info, Node: Sequences, Next: TUI, Prev: Controlling GDB, Up: Top
13788 20 Canned Sequences of Commands
13789 *******************************
13791 Aside from breakpoint commands (*note Breakpoint command lists: Break
13792 Commands.), GDB provides two ways to store sequences of commands for
13793 execution as a unit: user-defined commands and command files.
13797 * Define:: How to define your own commands
13798 * Hooks:: Hooks for user-defined commands
13799 * Command Files:: How to write scripts of commands to be stored in a file
13800 * Output:: Commands for controlled output
13803 File: gdb.info, Node: Define, Next: Hooks, Up: Sequences
13805 20.1 User-defined commands
13806 ==========================
13808 A "user-defined command" is a sequence of GDB commands to which you
13809 assign a new name as a command. This is done with the `define'
13810 command. User commands may accept up to 10 arguments separated by
13811 whitespace. Arguments are accessed within the user command via
13812 `$arg0...$arg9'. A trivial example:
13815 print $arg0 + $arg1 + $arg2
13818 To execute the command use:
13822 This defines the command `adder', which prints the sum of its three
13823 arguments. Note the arguments are text substitutions, so they may
13824 reference variables, use complex expressions, or even perform inferior
13827 In addition, `$argc' may be used to find out how many arguments have
13828 been passed. This expands to a number in the range 0...10.
13832 print $arg0 + $arg1
13835 print $arg0 + $arg1 + $arg2
13839 `define COMMANDNAME'
13840 Define a command named COMMANDNAME. If there is already a command
13841 by that name, you are asked to confirm that you want to redefine
13844 The definition of the command is made up of other GDB command
13845 lines, which are given following the `define' command. The end of
13846 these commands is marked by a line containing `end'.
13848 `document COMMANDNAME'
13849 Document the user-defined command COMMANDNAME, so that it can be
13850 accessed by `help'. The command COMMANDNAME must already be
13851 defined. This command reads lines of documentation just as
13852 `define' reads the lines of the command definition, ending with
13853 `end'. After the `document' command is finished, `help' on command
13854 COMMANDNAME displays the documentation you have written.
13856 You may use the `document' command again to change the
13857 documentation of a command. Redefining the command with `define'
13858 does not change the documentation.
13861 Used inside a user-defined command, this tells GDB that this
13862 command should not be repeated when the user hits <RET> (*note
13863 repeat last command: Command Syntax.).
13865 `help user-defined'
13866 List all user-defined commands, with the first line of the
13867 documentation (if any) for each.
13870 `show user COMMANDNAME'
13871 Display the GDB commands used to define COMMANDNAME (but not its
13872 documentation). If no COMMANDNAME is given, display the
13873 definitions for all user-defined commands.
13875 `show max-user-call-depth'
13876 `set max-user-call-depth'
13877 The value of `max-user-call-depth' controls how many recursion
13878 levels are allowed in user-defined commands before GDB suspects an
13879 infinite recursion and aborts the command.
13881 In addition to the above commands, user-defined commands frequently
13882 use control flow commands, described in *Note Command Files::.
13884 When user-defined commands are executed, the commands of the
13885 definition are not printed. An error in any command stops execution of
13886 the user-defined command.
13888 If used interactively, commands that would ask for confirmation
13889 proceed without asking when used inside a user-defined command. Many
13890 GDB commands that normally print messages to say what they are doing
13891 omit the messages when used in a user-defined command.
13894 File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
13896 20.2 User-defined command hooks
13897 ===============================
13899 You may define "hooks", which are a special kind of user-defined
13900 command. Whenever you run the command `foo', if the user-defined
13901 command `hook-foo' exists, it is executed (with no arguments) before
13904 A hook may also be defined which is run after the command you
13905 executed. Whenever you run the command `foo', if the user-defined
13906 command `hookpost-foo' exists, it is executed (with no arguments) after
13907 that command. Post-execution hooks may exist simultaneously with
13908 pre-execution hooks, for the same command.
13910 It is valid for a hook to call the command which it hooks. If this
13911 occurs, the hook is not re-executed, thereby avoiding infinite
13914 In addition, a pseudo-command, `stop' exists. Defining
13915 (`hook-stop') makes the associated commands execute every time
13916 execution stops in your program: before breakpoint commands are run,
13917 displays are printed, or the stack frame is printed.
13919 For example, to ignore `SIGALRM' signals while single-stepping, but
13920 treat them normally during normal execution, you could define:
13923 handle SIGALRM nopass
13927 handle SIGALRM pass
13930 define hook-continue
13931 handle SIGLARM pass
13934 As a further example, to hook at the begining and end of the `echo'
13935 command, and to add extra text to the beginning and end of the message,
13942 define hookpost-echo
13946 (gdb) echo Hello World
13947 <<<---Hello World--->>>
13950 You can define a hook for any single-word command in GDB, but not
13951 for command aliases; you should define a hook for the basic command
13952 name, e.g. `backtrace' rather than `bt'. If an error occurs during
13953 the execution of your hook, execution of GDB commands stops and GDB
13954 issues a prompt (before the command that you actually typed had a
13957 If you try to define a hook which does not match any known command,
13958 you get a warning from the `define' command.
13961 File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
13966 A command file for GDB is a text file made of lines that are GDB
13967 commands. Comments (lines starting with `#') may also be included. An
13968 empty line in a command file does nothing; it does not mean to repeat
13969 the last command, as it would from the terminal.
13971 You can request the execution of a command file with the `source'
13974 `source [`-v'] FILENAME'
13975 Execute the command file FILENAME.
13977 The lines in a command file are generally executed sequentially,
13978 unless the order of execution is changed by one of the _flow-control
13979 commands_ described below. The commands are not printed as they are
13980 executed. An error in any command terminates execution of the command
13981 file and control is returned to the console.
13983 GDB searches for FILENAME in the current directory and then on the
13984 search path (specified with the `directory' command).
13986 If `-v', for verbose mode, is given then GDB displays each command
13987 as it is executed. The option must be given before FILENAME, and is
13988 interpreted as part of the filename anywhere else.
13990 Commands that would ask for confirmation if used interactively
13991 proceed without asking when used in a command file. Many GDB commands
13992 that normally print messages to say what they are doing omit the
13993 messages when called from command files.
13995 GDB also accepts command input from standard input. In this mode,
13996 normal output goes to standard output and error output goes to standard
13997 error. Errors in a command file supplied on standard input do not
13998 terminate execution of the command file--execution continues with the
14001 gdb < cmds > log 2>&1
14003 (The syntax above will vary depending on the shell used.) This
14004 example will execute commands from the file `cmds'. All output and
14005 errors would be directed to `log'.
14007 Since commands stored on command files tend to be more general than
14008 commands typed interactively, they frequently need to deal with
14009 complicated situations, such as different or unexpected values of
14010 variables and symbols, changes in how the program being debugged is
14011 built, etc. GDB provides a set of flow-control commands to deal with
14012 these complexities. Using these commands, you can write complex
14013 scripts that loop over data structures, execute commands conditionally,
14018 This command allows to include in your script conditionally
14019 executed commands. The `if' command takes a single argument, which
14020 is an expression to evaluate. It is followed by a series of
14021 commands that are executed only if the expression is true (its
14022 value is nonzero). There can then optionally be an `else' line,
14023 followed by a series of commands that are only executed if the
14024 expression was false. The end of the list is marked by a line
14028 This command allows to write loops. Its syntax is similar to
14029 `if': the command takes a single argument, which is an expression
14030 to evaluate, and must be followed by the commands to execute, one
14031 per line, terminated by an `end'. These commands are called the
14032 "body" of the loop. The commands in the body of `while' are
14033 executed repeatedly as long as the expression evaluates to true.
14036 This command exits the `while' loop in whose body it is included.
14037 Execution of the script continues after that `while's `end' line.
14040 This command skips the execution of the rest of the body of
14041 commands in the `while' loop in whose body it is included.
14042 Execution branches to the beginning of the `while' loop, where it
14043 evaluates the controlling expression.
14046 Terminate the block of commands that are the body of `if', `else',
14047 or `while' flow-control commands.
14050 File: gdb.info, Node: Output, Prev: Command Files, Up: Sequences
14052 20.4 Commands for controlled output
14053 ===================================
14055 During the execution of a command file or a user-defined command, normal
14056 GDB output is suppressed; the only output that appears is what is
14057 explicitly printed by the commands in the definition. This section
14058 describes three commands useful for generating exactly the output you
14062 Print TEXT. Nonprinting characters can be included in TEXT using
14063 C escape sequences, such as `\n' to print a newline. *No newline
14064 is printed unless you specify one.* In addition to the standard C
14065 escape sequences, a backslash followed by a space stands for a
14066 space. This is useful for displaying a string with spaces at the
14067 beginning or the end, since leading and trailing spaces are
14068 otherwise trimmed from all arguments. To print ` and foo = ', use
14069 the command `echo \ and foo = \ '.
14071 A backslash at the end of TEXT can be used, as in C, to continue
14072 the command onto subsequent lines. For example,
14074 echo This is some text\n\
14075 which is continued\n\
14076 onto several lines.\n
14078 produces the same output as
14080 echo This is some text\n
14081 echo which is continued\n
14082 echo onto several lines.\n
14084 `output EXPRESSION'
14085 Print the value of EXPRESSION and nothing but that value: no
14086 newlines, no `$NN = '. The value is not entered in the value
14087 history either. *Note Expressions: Expressions, for more
14088 information on expressions.
14090 `output/FMT EXPRESSION'
14091 Print the value of EXPRESSION in format FMT. You can use the same
14092 formats as for `print'. *Note Output formats: Output Formats, for
14095 `printf STRING, EXPRESSIONS...'
14096 Print the values of the EXPRESSIONS under the control of STRING.
14097 The EXPRESSIONS are separated by commas and may be either numbers
14098 or pointers. Their values are printed as specified by STRING,
14099 exactly as if your program were to execute the C subroutine
14101 printf (STRING, EXPRESSIONS...);
14103 For example, you can print two values in hex like this:
14105 printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
14107 The only backslash-escape sequences that you can use in the format
14108 string are the simple ones that consist of backslash followed by a
14112 File: gdb.info, Node: Interpreters, Next: Emacs, Prev: TUI, Up: Top
14114 21 Command Interpreters
14115 ***********************
14117 GDB supports multiple command interpreters, and some command
14118 infrastructure to allow users or user interface writers to switch
14119 between interpreters or run commands in other interpreters.
14121 GDB currently supports two command interpreters, the console
14122 interpreter (sometimes called the command-line interpreter or CLI) and
14123 the machine interface interpreter (or GDB/MI). This manual describes
14124 both of these interfaces in great detail.
14126 By default, GDB will start with the console interpreter. However,
14127 the user may choose to start GDB with another interpreter by specifying
14128 the `-i' or `--interpreter' startup options. Defined interpreters
14132 The traditional console or command-line interpreter. This is the
14133 most often used interpreter with GDB. With no interpreter
14134 specified at runtime, GDB will use this interpreter.
14137 The newest GDB/MI interface (currently `mi2'). Used primarily by
14138 programs wishing to use GDB as a backend for a debugger GUI or an
14139 IDE. For more information, see *Note The GDB/MI Interface: GDB/MI.
14142 The current GDB/MI interface.
14145 The GDB/MI interface included in GDB 5.1, 5.2, and 5.3.
14148 The interpreter being used by GDB may not be dynamically switched at
14149 runtime. Although possible, this could lead to a very precarious
14150 situation. Consider an IDE using GDB/MI. If a user enters the command
14151 "interpreter-set console" in a console view, GDB would switch to using
14152 the console interpreter, rendering the IDE inoperable!
14154 Although you may only choose a single interpreter at startup, you
14155 may execute commands in any interpreter from the current interpreter
14156 using the appropriate command. If you are running the console
14157 interpreter, simply use the `interpreter-exec' command:
14159 interpreter-exec mi "-data-list-register-names"
14161 GDB/MI has a similar command, although it is only available in
14162 versions of GDB which support GDB/MI version 2 (or greater).
14165 File: gdb.info, Node: TUI, Next: Interpreters, Prev: Sequences, Up: Top
14167 22 GDB Text User Interface
14168 **************************
14172 * TUI Overview:: TUI overview
14173 * TUI Keys:: TUI key bindings
14174 * TUI Single Key Mode:: TUI single key mode
14175 * TUI Commands:: TUI specific commands
14176 * TUI Configuration:: TUI configuration variables
14178 The GDB Text User Interface, TUI in short, is a terminal interface
14179 which uses the `curses' library to show the source file, the assembly
14180 output, the program registers and GDB commands in separate text windows.
14182 The TUI is enabled by invoking GDB using either `gdbtui' or `gdb
14186 File: gdb.info, Node: TUI Overview, Next: TUI Keys, Up: TUI
14191 The TUI has two display modes that can be switched while GDB runs:
14193 * A curses (or TUI) mode in which it displays several text windows
14196 * A standard mode which corresponds to the GDB configured without
14199 In the TUI mode, GDB can display several text window on the terminal:
14202 This window is the GDB command window with the GDB prompt and the
14203 GDB outputs. The GDB input is still managed using readline but
14204 through the TUI. The _command_ window is always visible.
14207 The source window shows the source file of the program. The
14208 current line as well as active breakpoints are displayed in this
14212 The assembly window shows the disassembly output of the program.
14215 This window shows the processor registers. It detects when a
14216 register is changed and when this is the case, registers that have
14217 changed are highlighted.
14220 The source and assembly windows show the current program position by
14221 highlighting the current line and marking them with the `>' marker.
14222 Breakpoints are also indicated with two markers. A first one indicates
14223 the breakpoint type:
14226 Breakpoint which was hit at least once.
14229 Breakpoint which was never hit.
14232 Hardware breakpoint which was hit at least once.
14235 Hardware breakpoint which was never hit.
14238 The second marker indicates whether the breakpoint is enabled or not:
14241 Breakpoint is enabled.
14244 Breakpoint is disabled.
14247 The source, assembly and register windows are attached to the thread
14248 and the frame position. They are updated when the current thread
14249 changes, when the frame changes or when the program counter changes.
14250 These three windows are arranged by the TUI according to several
14251 layouts. The layout defines which of these three windows are visible.
14252 The following layouts are available:
14258 * source and assembly
14260 * source and registers
14262 * assembly and registers
14265 On top of the command window a status line gives various information
14266 concerning the current process begin debugged. The status line is
14267 updated when the information it shows changes. The following fields
14271 Indicates the current gdb target (*note Specifying a Debugging
14275 Gives information about the current process or thread number.
14276 When no process is being debugged, this field is set to `No
14280 Gives the current function name for the selected frame. The name
14281 is demangled if demangling is turned on (*note Print Settings::).
14282 When there is no symbol corresponding to the current program
14283 counter the string `??' is displayed.
14286 Indicates the current line number for the selected frame. When
14287 the current line number is not known the string `??' is displayed.
14290 Indicates the current program counter address.
14294 File: gdb.info, Node: TUI Keys, Next: TUI Single Key Mode, Prev: TUI Overview, Up: TUI
14296 22.2 TUI Key Bindings
14297 =====================
14299 The TUI installs several key bindings in the readline keymaps (*note
14300 Command Line Editing::). They allow to leave or enter in the TUI mode
14301 or they operate directly on the TUI layout and windows. The TUI also
14302 provides a _SingleKey_ keymap which binds several keys directly to GDB
14303 commands. The following key bindings are installed for both TUI mode
14304 and the GDB standard mode.
14309 Enter or leave the TUI mode. When the TUI mode is left, the
14310 curses window management is left and GDB operates using its
14311 standard mode writing on the terminal directly. When the TUI mode
14312 is entered, the control is given back to the curses windows. The
14313 screen is then refreshed.
14316 Use a TUI layout with only one window. The layout will either be
14317 `source' or `assembly'. When the TUI mode is not active, it will
14318 switch to the TUI mode.
14320 Think of this key binding as the Emacs `C-x 1' binding.
14323 Use a TUI layout with at least two windows. When the current
14324 layout shows already two windows, a next layout with two windows
14325 is used. When a new layout is chosen, one window will always be
14326 common to the previous layout and the new one.
14328 Think of it as the Emacs `C-x 2' binding.
14331 Change the active window. The TUI associates several key bindings
14332 (like scrolling and arrow keys) to the active window. This command
14333 gives the focus to the next TUI window.
14335 Think of it as the Emacs `C-x o' binding.
14338 Use the TUI _SingleKey_ keymap that binds single key to gdb
14339 commands (*note TUI Single Key Mode::).
14342 The following key bindings are handled only by the TUI mode:
14345 Scroll the active window one page up.
14348 Scroll the active window one page down.
14351 Scroll the active window one line up.
14354 Scroll the active window one line down.
14357 Scroll the active window one column left.
14360 Scroll the active window one column right.
14363 Refresh the screen.
14366 In the TUI mode, the arrow keys are used by the active window for
14367 scrolling. This means they are available for readline when the active
14368 window is the command window. When the command window does not have
14369 the focus, it is necessary to use other readline key bindings such as
14370 `C-p', `C-n', `C-b' and `C-f'.
14373 File: gdb.info, Node: TUI Single Key Mode, Next: TUI Commands, Prev: TUI Keys, Up: TUI
14375 22.3 TUI Single Key Mode
14376 ========================
14378 The TUI provides a _SingleKey_ mode in which it installs a particular
14379 key binding in the readline keymaps to connect single keys to some gdb
14395 exit the _SingleKey_ mode.
14413 Other keys temporarily switch to the GDB command prompt. The key
14414 that was pressed is inserted in the editing buffer so that it is
14415 possible to type most GDB commands without interaction with the TUI
14416 _SingleKey_ mode. Once the command is entered the TUI _SingleKey_ mode
14417 is restored. The only way to permanently leave this mode is by typing
14421 File: gdb.info, Node: TUI Commands, Next: TUI Configuration, Prev: TUI Single Key Mode, Up: TUI
14423 22.4 TUI specific commands
14424 ==========================
14426 The TUI has specific commands to control the text windows. These
14427 commands are always available, that is they do not depend on the
14428 current terminal mode in which GDB runs. When GDB is in the standard
14429 mode, using these commands will automatically switch in the TUI mode.
14432 List and give the size of all displayed windows.
14435 Display the next layout.
14438 Display the previous layout.
14441 Display the source window only.
14444 Display the assembly window only.
14447 Display the source and assembly window.
14450 Display the register window together with the source or assembly
14453 `focus next | prev | src | asm | regs | split'
14454 Set the focus to the named window. This command allows to change
14455 the active window so that scrolling keys can be affected to
14459 Refresh the screen. This is similar to typing `C-L'.
14462 Show the floating point registers in the register window.
14465 Show the general registers in the register window.
14468 Show the next register group. The list of register groups as well
14469 as their order is target specific. The predefined register groups
14470 are the following: `general', `float', `system', `vector', `all',
14474 Show the system registers in the register window.
14477 Update the source window and the current execution point.
14479 `winheight NAME +COUNT'
14480 `winheight NAME -COUNT'
14481 Change the height of the window NAME by COUNT lines. Positive
14482 counts increase the height, while negative counts decrease it.
14485 Set the width of tab stops to be NCHARS characters.
14489 File: gdb.info, Node: TUI Configuration, Prev: TUI Commands, Up: TUI
14491 22.5 TUI configuration variables
14492 ================================
14494 The TUI has several configuration variables that control the appearance
14495 of windows on the terminal.
14497 `set tui border-kind KIND'
14498 Select the border appearance for the source, assembly and register
14499 windows. The possible values are the following:
14501 Use a space character to draw the border.
14504 Use ascii characters + - and | to draw the border.
14507 Use the Alternate Character Set to draw the border. The
14508 border is drawn using character line graphics if the terminal
14512 `set tui active-border-mode MODE'
14513 Select the attributes to display the border of the active window.
14514 The possible values are `normal', `standout', `reverse', `half',
14515 `half-standout', `bold' and `bold-standout'.
14517 `set tui border-mode MODE'
14518 Select the attributes to display the border of other windows. The
14519 MODE can be one of the following:
14521 Use normal attributes to display the border.
14527 Use reverse video mode.
14530 Use half bright mode.
14533 Use half bright and standout mode.
14536 Use extra bright or bold mode.
14539 Use extra bright or bold and standout mode.
14544 File: gdb.info, Node: Emacs, Next: Annotations, Prev: Interpreters, Up: Top
14546 23 Using GDB under GNU Emacs
14547 ****************************
14549 A special interface allows you to use GNU Emacs to view (and edit) the
14550 source files for the program you are debugging with GDB.
14552 To use this interface, use the command `M-x gdb' in Emacs. Give the
14553 executable file you want to debug as an argument. This command starts
14554 GDB as a subprocess of Emacs, with input and output through a newly
14555 created Emacs buffer.
14557 Using GDB under Emacs is just like using GDB normally except for two
14560 * All "terminal" input and output goes through the Emacs buffer.
14562 This applies both to GDB commands and their output, and to the input
14563 and output done by the program you are debugging.
14565 This is useful because it means that you can copy the text of
14566 previous commands and input them again; you can even use parts of the
14567 output in this way.
14569 All the facilities of Emacs' Shell mode are available for interacting
14570 with your program. In particular, you can send signals the usual
14571 way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
14573 * GDB displays source code through Emacs.
14575 Each time GDB displays a stack frame, Emacs automatically finds the
14576 source file for that frame and puts an arrow (`=>') at the left margin
14577 of the current line. Emacs uses a separate buffer for source display,
14578 and splits the screen to show both your GDB session and the source.
14580 Explicit GDB `list' or search commands still produce output as
14581 usual, but you probably have no reason to use them from Emacs.
14583 If you specify an absolute file name when prompted for the `M-x gdb'
14584 argument, then Emacs sets your current working directory to where your
14585 program resides. If you only specify the file name, then Emacs sets
14586 your current working directory to to the directory associated with the
14587 previous buffer. In this case, GDB may find your program by searching
14588 your environment's `PATH' variable, but on some operating systems it
14589 might not find the source. So, although the GDB input and output
14590 session proceeds normally, the auxiliary buffer does not display the
14591 current source and line of execution.
14593 The initial working directory of GDB is printed on the top line of
14594 the GDB I/O buffer and this serves as a default for the commands that
14595 specify files for GDB to operate on. *Note Commands to specify files:
14598 By default, `M-x gdb' calls the program called `gdb'. If you need
14599 to call GDB by a different name (for example, if you keep several
14600 configurations around, with different names) you can customize the
14601 Emacs variable `gud-gdb-command-name' to run the one you want.
14603 In the GDB I/O buffer, you can use these special Emacs commands in
14604 addition to the standard Shell mode commands:
14607 Describe the features of Emacs' GDB Mode.
14610 Execute to another source line, like the GDB `step' command; also
14611 update the display window to show the current file and location.
14614 Execute to next source line in this function, skipping all function
14615 calls, like the GDB `next' command. Then update the display window
14616 to show the current file and location.
14619 Execute one instruction, like the GDB `stepi' command; update
14620 display window accordingly.
14623 Execute until exit from the selected stack frame, like the GDB
14627 Continue execution of your program, like the GDB `continue'
14631 Go up the number of frames indicated by the numeric argument
14632 (*note Numeric Arguments: (Emacs)Arguments.), like the GDB `up'
14636 Go down the number of frames indicated by the numeric argument,
14637 like the GDB `down' command.
14639 In any source file, the Emacs command `C-x <SPC>' (`gud-break')
14640 tells GDB to set a breakpoint on the source line point is on.
14642 If you type `M-x speedbar', then Emacs displays a separate frame
14643 which shows a backtrace when the GDB I/O buffer is current. Move point
14644 to any frame in the stack and type <RET> to make it become the current
14645 frame and display the associated source in the source buffer.
14646 Alternatively, click `Mouse-2' to make the selected frame become the
14649 If you accidentally delete the source-display buffer, an easy way to
14650 get it back is to type the command `f' in the GDB buffer, to request a
14651 frame display; when you run under Emacs, this recreates the source
14652 buffer if necessary to show you the context of the current frame.
14654 The source files displayed in Emacs are in ordinary Emacs buffers
14655 which are visiting the source files in the usual way. You can edit the
14656 files with these buffers if you wish; but keep in mind that GDB
14657 communicates with Emacs in terms of line numbers. If you add or delete
14658 lines from the text, the line numbers that GDB knows cease to
14659 correspond properly with the code.
14661 The description given here is for GNU Emacs version 21.3 and a more
14662 detailed description of its interaction with GDB is given in the Emacs
14663 manual (*note Debuggers: (Emacs)Debuggers.).
14666 File: gdb.info, Node: GDB/MI, Next: GDB Bugs, Prev: Annotations, Up: Top
14668 24 The GDB/MI Interface
14669 ***********************
14671 Function and Purpose
14672 ====================
14674 GDB/MI is a line based machine oriented text interface to GDB and is
14675 activated by specifying using the `--interpreter' command line option
14676 (*note Mode Options::). It is specifically intended to support the
14677 development of systems which use the debugger as just one small
14678 component of a larger system.
14680 This chapter is a specification of the GDB/MI interface. It is
14681 written in the form of a reference manual.
14683 Note that GDB/MI is still under construction, so some of the
14684 features described below are incomplete and subject to change (*note
14685 GDB/MI Development and Front Ends: GDB/MI Development and Front Ends.).
14687 Notation and Terminology
14688 ========================
14690 This chapter uses the following notation:
14692 * `|' separates two alternatives.
14694 * `[ SOMETHING ]' indicates that SOMETHING is optional: it may or
14697 * `( GROUP )*' means that GROUP inside the parentheses may repeat
14698 zero or more times.
14700 * `( GROUP )+' means that GROUP inside the parentheses may repeat
14703 * `"STRING"' means a literal STRING.
14707 * GDB/MI Command Syntax::
14708 * GDB/MI Compatibility with CLI::
14709 * GDB/MI Development and Front Ends::
14710 * GDB/MI Output Records::
14711 * GDB/MI Simple Examples::
14712 * GDB/MI Command Description Format::
14713 * GDB/MI Breakpoint Commands::
14714 * GDB/MI Program Context::
14715 * GDB/MI Thread Commands::
14716 * GDB/MI Program Execution::
14717 * GDB/MI Stack Manipulation::
14718 * GDB/MI Variable Objects::
14719 * GDB/MI Data Manipulation::
14720 * GDB/MI Tracepoint Commands::
14721 * GDB/MI Symbol Query::
14722 * GDB/MI File Commands::
14723 * GDB/MI Target Manipulation::
14724 * GDB/MI Miscellaneous Commands::
14727 File: gdb.info, Node: GDB/MI Command Syntax, Next: GDB/MI Compatibility with CLI, Up: GDB/MI
14729 24.1 GDB/MI Command Syntax
14730 ==========================
14734 * GDB/MI Input Syntax::
14735 * GDB/MI Output Syntax::
14738 File: gdb.info, Node: GDB/MI Input Syntax, Next: GDB/MI Output Syntax, Up: GDB/MI Command Syntax
14740 24.1.1 GDB/MI Input Syntax
14741 --------------------------
14744 `CLI-COMMAND | MI-COMMAND'
14747 `[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
14751 `[ TOKEN ] "-" OPERATION ( " " OPTION )* `[' " --" `]' ( " "
14755 "any sequence of digits"
14758 `"-" PARAMETER [ " " PARAMETER ]'
14761 `NON-BLANK-SEQUENCE | C-STRING'
14764 _any of the operations described in this chapter_
14766 `NON-BLANK-SEQUENCE ==>'
14767 _anything, provided it doesn't contain special characters such as
14768 "-", NL, """ and of course " "_
14771 `""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
14778 * The CLI commands are still handled by the MI interpreter; their
14779 output is described below.
14781 * The `TOKEN', when present, is passed back when the command
14784 * Some MI commands accept optional arguments as part of the parameter
14785 list. Each option is identified by a leading `-' (dash) and may be
14786 followed by an optional argument parameter. Options occur first
14787 in the parameter list and can be delimited from normal parameters
14788 using `--' (this is useful when some parameters begin with a dash).
14792 * We want easy access to the existing CLI syntax (for debugging).
14794 * We want it to be easy to spot a MI operation.
14797 File: gdb.info, Node: GDB/MI Output Syntax, Prev: GDB/MI Input Syntax, Up: GDB/MI Command Syntax
14799 24.1.2 GDB/MI Output Syntax
14800 ---------------------------
14802 The output from GDB/MI consists of zero or more out-of-band records
14803 followed, optionally, by a single result record. This result record is
14804 for the most recent command. The sequence of output records is
14805 terminated by `(gdb)'.
14807 If an input command was prefixed with a `TOKEN' then the
14808 corresponding output for that command will also be prefixed by that same
14812 `( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
14814 `RESULT-RECORD ==>'
14815 ` [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
14817 `OUT-OF-BAND-RECORD ==>'
14818 `ASYNC-RECORD | STREAM-RECORD'
14821 `EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
14823 `EXEC-ASYNC-OUTPUT ==>'
14824 `[ TOKEN ] "*" ASYNC-OUTPUT'
14826 `STATUS-ASYNC-OUTPUT ==>'
14827 `[ TOKEN ] "+" ASYNC-OUTPUT'
14829 `NOTIFY-ASYNC-OUTPUT ==>'
14830 `[ TOKEN ] "=" ASYNC-OUTPUT'
14833 `ASYNC-CLASS ( "," RESULT )* NL'
14836 `"done" | "running" | "connected" | "error" | "exit"'
14839 `"stopped" | OTHERS' (where OTHERS will be added depending on the
14840 needs--this is still in development).
14843 ` VARIABLE "=" VALUE'
14849 ` CONST | TUPLE | LIST '
14855 ` "{}" | "{" RESULT ( "," RESULT )* "}" '
14858 ` "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
14861 `STREAM-RECORD ==>'
14862 `CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
14864 `CONSOLE-STREAM-OUTPUT ==>'
14867 `TARGET-STREAM-OUTPUT ==>'
14870 `LOG-STREAM-OUTPUT ==>'
14877 _any sequence of digits_.
14881 * All output sequences end in a single line containing a period.
14883 * The `TOKEN' is from the corresponding request. If an execution
14884 command is interrupted by the `-exec-interrupt' command, the TOKEN
14885 associated with the `*stopped' message is the one of the original
14886 execution command, not the one of the interrupt command.
14888 * STATUS-ASYNC-OUTPUT contains on-going status information about the
14889 progress of a slow operation. It can be discarded. All status
14890 output is prefixed by `+'.
14892 * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
14893 (stopped, started, disappeared). All async output is prefixed by
14896 * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
14897 client should handle (e.g., a new breakpoint information). All
14898 notify output is prefixed by `='.
14900 * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
14901 the console. It is the textual response to a CLI command. All
14902 the console output is prefixed by `~'.
14904 * TARGET-STREAM-OUTPUT is the output produced by the target program.
14905 All the target output is prefixed by `@'.
14907 * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
14908 instance messages that should be displayed as part of an error
14909 log. All the log output is prefixed by `&'.
14911 * New GDB/MI commands should only output LISTS containing VALUES.
14914 *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
14915 about the various output records.
14918 File: gdb.info, Node: GDB/MI Compatibility with CLI, Next: GDB/MI Development and Front Ends, Prev: GDB/MI Command Syntax, Up: GDB/MI
14920 24.2 GDB/MI Compatibility with CLI
14921 ==================================
14923 For the developers convenience CLI commands can be entered directly,
14924 but there may be some unexpected behaviour. For example, commands that
14925 query the user will behave as if the user replied yes, breakpoint
14926 command lists are not executed and some CLI commands, such as `if',
14927 `when' and `define', prompt for further input with `>', which is not
14930 This feature may be removed at some stage in the future and it is
14931 recommended that front ends use the `-interpreter-exec' command (*note
14932 -interpreter-exec::).
14935 File: gdb.info, Node: GDB/MI Development and Front Ends, Next: GDB/MI Output Records, Prev: GDB/MI Compatibility with CLI, Up: GDB/MI
14937 24.3 GDB/MI Development and Front Ends
14938 ======================================
14940 The application which takes the MI output and presents the state of the
14941 program being debugged to the user is called a "front end".
14943 Although GDB/MI is still incomplete, it is currently being used by a
14944 variety of front ends to GDB. This makes it difficult to introduce new
14945 functionality without breaking existing usage. This section tries to
14946 minimize the problems by describing how the protocol might change.
14948 Some changes in MI need not break a carefully designed front end, and
14949 for these the MI version will remain unchanged. The following is a
14950 list of changes that may occur within one level, so front ends should
14951 parse MI output in a way that can handle them:
14953 * New MI commands may be added.
14955 * New fields may be added to the output of any MI command.
14958 If the changes are likely to break front ends, the MI version level
14959 will be increased by one. This will allow the front end to parse the
14960 output according to the MI version. Apart from mi0, new versions of
14961 GDB will not support old versions of MI and it will be the
14962 responsibility of the front end to work with the new one.
14964 The best way to avoid unexpected changes in MI that might break your
14965 front end is to make your project known to GDB developers and follow
14966 development on <gdb@sourceware.org> and <gdb-patches@sourceware.org>.
14967 There is also the mailing list <dmi-discuss@lists.freestandards.org>,
14968 hosted by the Free Standards Group, which has the aim of creating a a
14969 more general MI protocol called Debugger Machine Interface (DMI) that
14970 will become a standard for all debuggers, not just GDB.
14973 File: gdb.info, Node: GDB/MI Output Records, Next: GDB/MI Simple Examples, Prev: GDB/MI Development and Front Ends, Up: GDB/MI
14975 24.4 GDB/MI Output Records
14976 ==========================
14980 * GDB/MI Result Records::
14981 * GDB/MI Stream Records::
14982 * GDB/MI Out-of-band Records::
14985 File: gdb.info, Node: GDB/MI Result Records, Next: GDB/MI Stream Records, Up: GDB/MI Output Records
14987 24.4.1 GDB/MI Result Records
14988 ----------------------------
14990 In addition to a number of out-of-band notifications, the response to a
14991 GDB/MI command includes one of the following result indications:
14993 `"^done" [ "," RESULTS ]'
14994 The synchronous operation was successful, `RESULTS' are the return
14998 The asynchronous operation was successfully started. The target is
15002 GDB has connected to a remote target.
15004 `"^error" "," C-STRING'
15005 The operation failed. The `C-STRING' contains the corresponding
15009 GDB has terminated.
15013 File: gdb.info, Node: GDB/MI Stream Records, Next: GDB/MI Out-of-band Records, Prev: GDB/MI Result Records, Up: GDB/MI Output Records
15015 24.4.2 GDB/MI Stream Records
15016 ----------------------------
15018 GDB internally maintains a number of output streams: the console, the
15019 target, and the log. The output intended for each of these streams is
15020 funneled through the GDB/MI interface using "stream records".
15022 Each stream record begins with a unique "prefix character" which
15023 identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output
15024 Syntax.). In addition to the prefix, each stream record contains a
15025 `STRING-OUTPUT'. This is either raw text (with an implicit new line)
15026 or a quoted C string (which does not contain an implicit newline).
15028 `"~" STRING-OUTPUT'
15029 The console output stream contains text that should be displayed
15030 in the CLI console window. It contains the textual responses to
15033 `"@" STRING-OUTPUT'
15034 The target output stream contains any textual output from the
15035 running target. This is only present when GDB's event loop is
15036 truly asynchronous, which is currently only the case for remote
15039 `"&" STRING-OUTPUT'
15040 The log stream contains debugging messages being produced by GDB's
15044 File: gdb.info, Node: GDB/MI Out-of-band Records, Prev: GDB/MI Stream Records, Up: GDB/MI Output Records
15046 24.4.3 GDB/MI Out-of-band Records
15047 ---------------------------------
15049 "Out-of-band" records are used to notify the GDB/MI client of
15050 additional changes that have occurred. Those changes can either be a
15051 consequence of GDB/MI (e.g., a breakpoint modified) or a result of
15052 target activity (e.g., target stopped).
15054 The following is a preliminary list of possible out-of-band records.
15055 In particular, the EXEC-ASYNC-OUTPUT records.
15057 `*stopped,reason="REASON"'
15059 REASON can be one of the following:
15062 A breakpoint was reached.
15064 `watchpoint-trigger'
15065 A watchpoint was triggered.
15067 `read-watchpoint-trigger'
15068 A read watchpoint was triggered.
15070 `access-watchpoint-trigger'
15071 An access watchpoint was triggered.
15073 `function-finished'
15074 An -exec-finish or similar CLI command was accomplished.
15077 An -exec-until or similar CLI command was accomplished.
15080 A watchpoint has gone out of scope.
15082 `end-stepping-range'
15083 An -exec-next, -exec-next-instruction, -exec-step,
15084 -exec-step-instruction or similar CLI command was accomplished.
15087 The inferior exited because of a signal.
15090 The inferior exited.
15093 The inferior exited normally.
15096 A signal was received by the inferior.
15099 File: gdb.info, Node: GDB/MI Simple Examples, Next: GDB/MI Command Description Format, Prev: GDB/MI Output Records, Up: GDB/MI
15101 24.5 Simple Examples of GDB/MI Interaction
15102 ==========================================
15104 This subsection presents several simple examples of interaction using
15105 the GDB/MI interface. In these examples, `->' means that the following
15106 line is passed to GDB/MI as input, while `<-' means the output received
15109 Note the the line breaks shown in the examples are here only for
15110 readability, they don't appear in the real output.
15112 Setting a breakpoint
15113 --------------------
15115 Setting a breakpoint generates synchronous output which contains
15116 detailed information of the breakpoint.
15118 -> -break-insert main
15119 <- ^done,bkpt={number="1",type="breakpoint",disp="keep",
15120 enabled="y",addr="0x08048564",func="main",file="myprog.c",
15121 fullname="/home/nickrob/myprog.c",line="68",times="0"}
15127 Program execution generates asynchronous records and MI gives the
15128 reason that execution stopped.
15133 <- *stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",
15134 frame={addr="0x08048564",func="main",
15135 args=[{name="argc",value="1"},{name="argv",value="0xbfc4d4d4"}],
15136 file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"}
15141 <- *stopped,reason="exited-normally"
15147 Quitting GDB just prints the result class `^exit'.
15156 Here's what happens if you pass a non-existent command:
15159 <- ^error,msg="Undefined MI command: rubbish"
15163 File: gdb.info, Node: GDB/MI Command Description Format, Next: GDB/MI Breakpoint Commands, Prev: GDB/MI Simple Examples, Up: GDB/MI
15165 24.6 GDB/MI Command Description Format
15166 ======================================
15168 The remaining sections describe blocks of commands. Each block of
15169 commands is laid out in a fashion similar to this section.
15174 The motivation for this collection of commands.
15179 A brief introduction to this collection of commands as a whole.
15184 For each command in the block, the following is described:
15197 The corresponding GDB CLI command(s), if any.
15202 Example(s) formatted for readability. Some of the described commands
15203 have not been implemented yet and these are labeled N.A. (not
15207 File: gdb.info, Node: GDB/MI Breakpoint Commands, Next: GDB/MI Program Context, Prev: GDB/MI Command Description Format, Up: GDB/MI
15209 24.7 GDB/MI Breakpoint Commands
15210 ===============================
15212 This section documents GDB/MI commands for manipulating breakpoints.
15214 The `-break-after' Command
15215 --------------------------
15220 -break-after NUMBER COUNT
15222 The breakpoint number NUMBER is not in effect until it has been hit
15223 COUNT times. To see how this is reflected in the output of the
15224 `-break-list' command, see the description of the `-break-list' command
15230 The corresponding GDB command is `ignore'.
15237 ^done,bkpt={number="1",addr="0x000100d0",file="hello.c",
15238 fullname="/home/foo/hello.c",line="5",times="0"}
15245 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
15246 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15247 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15248 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15249 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15250 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15251 {width="40",alignment="2",col_name="what",colhdr="What"}],
15252 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15253 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
15254 line="5",times="0",ignore="3"}]}
15257 The `-break-condition' Command
15258 ------------------------------
15263 -break-condition NUMBER EXPR
15265 Breakpoint NUMBER will stop the program only if the condition in
15266 EXPR is true. The condition becomes part of the `-break-list' output
15267 (see the description of the `-break-list' command below).
15272 The corresponding GDB command is `condition'.
15278 -break-condition 1 1
15282 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
15283 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15284 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15285 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15286 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15287 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15288 {width="40",alignment="2",col_name="what",colhdr="What"}],
15289 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15290 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
15291 line="5",cond="1",times="0",ignore="3"}]}
15294 The `-break-delete' Command
15295 ---------------------------
15300 -break-delete ( BREAKPOINT )+
15302 Delete the breakpoint(s) whose number(s) are specified in the
15303 argument list. This is obviously reflected in the breakpoint list.
15308 The corresponding GDB command is `delete'.
15318 ^done,BreakpointTable={nr_rows="0",nr_cols="6",
15319 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15320 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15321 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15322 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15323 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15324 {width="40",alignment="2",col_name="what",colhdr="What"}],
15328 The `-break-disable' Command
15329 ----------------------------
15334 -break-disable ( BREAKPOINT )+
15336 Disable the named BREAKPOINT(s). The field `enabled' in the break
15337 list is now set to `n' for the named BREAKPOINT(s).
15342 The corresponding GDB command is `disable'.
15352 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
15353 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15354 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15355 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15356 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15357 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15358 {width="40",alignment="2",col_name="what",colhdr="What"}],
15359 body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
15360 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
15361 line="5",times="0"}]}
15364 The `-break-enable' Command
15365 ---------------------------
15370 -break-enable ( BREAKPOINT )+
15372 Enable (previously disabled) BREAKPOINT(s).
15377 The corresponding GDB command is `enable'.
15387 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
15388 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15389 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15390 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15391 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15392 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15393 {width="40",alignment="2",col_name="what",colhdr="What"}],
15394 body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
15395 addr="0x000100d0",func="main",file="hello.c",fullname="/home/foo/hello.c",
15396 line="5",times="0"}]}
15399 The `-break-info' Command
15400 -------------------------
15405 -break-info BREAKPOINT
15407 Get information about a single breakpoint.
15412 The corresponding GDB command is `info break BREAKPOINT'.
15419 The `-break-insert' Command
15420 ---------------------------
15425 -break-insert [ -t ] [ -h ] [ -r ]
15426 [ -c CONDITION ] [ -i IGNORE-COUNT ]
15427 [ -p THREAD ] [ LINE | ADDR ]
15429 If specified, LINE, can be one of:
15435 * filename:function
15439 The possible optional parameters of this command are:
15442 Insert a temporary breakpoint.
15445 Insert a hardware breakpoint.
15448 Make the breakpoint conditional on CONDITION.
15451 Initialize the IGNORE-COUNT.
15454 Insert a regular breakpoint in all the functions whose names match
15455 the given regular expression. Other flags are not applicable to
15461 The result is in the form:
15463 ^done,bkpt={number="NUMBER",type="TYPE",disp="del"|"keep",
15464 enabled="y"|"n",addr="HEX",func="FUNCNAME",file="FILENAME",
15465 fullname="FULL_FILENAME",line="LINENO",[thread="THREADNO,]
15468 where NUMBER is the GDB number for this breakpoint, FUNCNAME is the
15469 name of the function where the breakpoint was inserted, FILENAME is the
15470 name of the source file which contains this function, LINENO is the
15471 source line number within that file and TIMES the number of times that
15472 the breakpoint has been hit (always 0 for -break-insert but may be
15473 greater for -break-info or -break-list which use the same output).
15475 Note: this format is open to change.
15480 The corresponding GDB commands are `break', `tbreak', `hbreak',
15481 `thbreak', and `rbreak'.
15488 ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",
15489 fullname="/home/foo/recursive2.c,line="4",times="0"}
15491 -break-insert -t foo
15492 ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",
15493 fullname="/home/foo/recursive2.c,line="11",times="0"}
15496 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
15497 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15498 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15499 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15500 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15501 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15502 {width="40",alignment="2",col_name="what",colhdr="What"}],
15503 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15504 addr="0x0001072c", func="main",file="recursive2.c",
15505 fullname="/home/foo/recursive2.c,"line="4",times="0"},
15506 bkpt={number="2",type="breakpoint",disp="del",enabled="y",
15507 addr="0x00010774",func="foo",file="recursive2.c",
15508 fullname="/home/foo/recursive2.c",line="11",times="0"}]}
15510 -break-insert -r foo.*
15511 ~int foo(int, int);
15512 ^done,bkpt={number="3",addr="0x00010774",file="recursive2.c,
15513 "fullname="/home/foo/recursive2.c",line="11",times="0"}
15516 The `-break-list' Command
15517 -------------------------
15524 Displays the list of inserted breakpoints, showing the following
15528 number of the breakpoint
15531 type of the breakpoint: `breakpoint' or `watchpoint'
15534 should the breakpoint be deleted or disabled when it is hit: `keep'
15538 is the breakpoint enabled or no: `y' or `n'
15541 memory location at which the breakpoint is set
15544 logical location of the breakpoint, expressed by function name,
15545 file name, line number
15548 number of times the breakpoint has been hit
15550 If there are no breakpoints or watchpoints, the `BreakpointTable'
15551 `body' field is an empty list.
15556 The corresponding GDB command is `info break'.
15563 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
15564 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15565 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15566 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15567 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15568 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15569 {width="40",alignment="2",col_name="what",colhdr="What"}],
15570 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15571 addr="0x000100d0",func="main",file="hello.c",line="5",times="0"},
15572 bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
15573 addr="0x00010114",func="foo",file="hello.c",fullname="/home/foo/hello.c",
15574 line="13",times="0"}]}
15577 Here's an example of the result when there are no breakpoints:
15581 ^done,BreakpointTable={nr_rows="0",nr_cols="6",
15582 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15583 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15584 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15585 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15586 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15587 {width="40",alignment="2",col_name="what",colhdr="What"}],
15591 The `-break-watch' Command
15592 --------------------------
15597 -break-watch [ -a | -r ]
15599 Create a watchpoint. With the `-a' option it will create an
15600 "access" watchpoint, i.e. a watchpoint that triggers either on a read
15601 from or on a write to the memory location. With the `-r' option, the
15602 watchpoint created is a "read" watchpoint, i.e. it will trigger only
15603 when the memory location is accessed for reading. Without either of
15604 the options, the watchpoint created is a regular watchpoint, i.e. it
15605 will trigger when the memory location is accessed for writing. *Note
15606 Setting watchpoints: Set Watchpoints.
15608 Note that `-break-list' will report a single list of watchpoints and
15609 breakpoints inserted.
15614 The corresponding GDB commands are `watch', `awatch', and `rwatch'.
15619 Setting a watchpoint on a variable in the `main' function:
15623 ^done,wpt={number="2",exp="x"}
15627 ^done,reason="watchpoint-trigger",wpt={number="2",exp="x"},
15628 value={old="-268439212",new="55"},
15629 frame={func="main",args=[],file="recursive2.c",
15630 fullname="/home/foo/bar/recursive2.c",line="5"}
15633 Setting a watchpoint on a variable local to a function. GDB will
15634 stop the program execution twice: first for the variable changing
15635 value, then for the watchpoint going out of scope.
15639 ^done,wpt={number="5",exp="C"}
15643 ^done,reason="watchpoint-trigger",
15644 wpt={number="5",exp="C"},value={old="-276895068",new="3"},
15645 frame={func="callee4",args=[],
15646 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15647 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
15651 ^done,reason="watchpoint-scope",wpnum="5",
15652 frame={func="callee3",args=[{name="strarg",
15653 value="0x11940 \"A string argument.\""}],
15654 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15655 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
15658 Listing breakpoints and watchpoints, at different points in the
15659 program execution. Note that once the watchpoint goes out of scope, it
15664 ^done,wpt={number="2",exp="C"}
15667 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
15668 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15669 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15670 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15671 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15672 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15673 {width="40",alignment="2",col_name="what",colhdr="What"}],
15674 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15675 addr="0x00010734",func="callee4",
15676 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15677 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c"line="8",times="1"},
15678 bkpt={number="2",type="watchpoint",disp="keep",
15679 enabled="y",addr="",what="C",times="0"}]}
15683 ^done,reason="watchpoint-trigger",wpt={number="2",exp="C"},
15684 value={old="-276895068",new="3"},
15685 frame={func="callee4",args=[],
15686 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15687 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
15690 ^done,BreakpointTable={nr_rows="2",nr_cols="6",
15691 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15692 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15693 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15694 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15695 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15696 {width="40",alignment="2",col_name="what",colhdr="What"}],
15697 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15698 addr="0x00010734",func="callee4",
15699 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15700 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"},
15701 bkpt={number="2",type="watchpoint",disp="keep",
15702 enabled="y",addr="",what="C",times="-5"}]}
15706 ^done,reason="watchpoint-scope",wpnum="2",
15707 frame={func="callee3",args=[{name="strarg",
15708 value="0x11940 \"A string argument.\""}],
15709 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15710 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
15713 ^done,BreakpointTable={nr_rows="1",nr_cols="6",
15714 hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
15715 {width="14",alignment="-1",col_name="type",colhdr="Type"},
15716 {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
15717 {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
15718 {width="10",alignment="-1",col_name="addr",colhdr="Address"},
15719 {width="40",alignment="2",col_name="what",colhdr="What"}],
15720 body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
15721 addr="0x00010734",func="callee4",
15722 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
15723 fullname="/home/foo/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
15728 File: gdb.info, Node: GDB/MI Program Context, Next: GDB/MI Thread Commands, Prev: GDB/MI Breakpoint Commands, Up: GDB/MI
15730 24.8 GDB/MI Program Context
15731 ============================
15733 The `-exec-arguments' Command
15734 -----------------------------
15739 -exec-arguments ARGS
15741 Set the inferior program arguments, to be used in the next
15747 The corresponding GDB command is `set args'.
15752 Don't have one around.
15754 The `-exec-show-arguments' Command
15755 ----------------------------------
15760 -exec-show-arguments
15762 Print the arguments of the program.
15767 The corresponding GDB command is `show args'.
15774 The `-environment-cd' Command
15775 -----------------------------
15780 -environment-cd PATHDIR
15782 Set GDB's working directory.
15787 The corresponding GDB command is `cd'.
15793 -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
15797 The `-environment-directory' Command
15798 ------------------------------------
15803 -environment-directory [ -r ] [ PATHDIR ]+
15805 Add directories PATHDIR to beginning of search path for source files.
15806 If the `-r' option is used, the search path is reset to the default
15807 search path. If directories PATHDIR are supplied in addition to the
15808 `-r' option, the search path is first reset and then addition occurs as
15809 normal. Multiple directories may be specified, separated by blanks.
15810 Specifying multiple directories in a single command results in the
15811 directories added to the beginning of the search path in the same order
15812 they were presented in the command. If blanks are needed as part of a
15813 directory name, double-quotes should be used around the name. In the
15814 command output, the path will show up separated by the system
15815 directory-separator character. The directory-seperator character must
15816 not be used in any directory name. If no directories are specified,
15817 the current search path is displayed.
15822 The corresponding GDB command is `dir'.
15828 -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
15829 ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
15831 -environment-directory ""
15832 ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
15834 -environment-directory -r /home/jjohnstn/src/gdb /usr/src
15835 ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
15837 -environment-directory -r
15838 ^done,source-path="$cdir:$cwd"
15841 The `-environment-path' Command
15842 -------------------------------
15847 -environment-path [ -r ] [ PATHDIR ]+
15849 Add directories PATHDIR to beginning of search path for object files.
15850 If the `-r' option is used, the search path is reset to the original
15851 search path that existed at gdb start-up. If directories PATHDIR are
15852 supplied in addition to the `-r' option, the search path is first reset
15853 and then addition occurs as normal. Multiple directories may be
15854 specified, separated by blanks. Specifying multiple directories in a
15855 single command results in the directories added to the beginning of the
15856 search path in the same order they were presented in the command. If
15857 blanks are needed as part of a directory name, double-quotes should be
15858 used around the name. In the command output, the path will show up
15859 separated by the system directory-separator character. The
15860 directory-seperator character must not be used in any directory name.
15861 If no directories are specified, the current path is displayed.
15866 The corresponding GDB command is `path'.
15873 ^done,path="/usr/bin"
15875 -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
15876 ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
15878 -environment-path -r /usr/local/bin
15879 ^done,path="/usr/local/bin:/usr/bin"
15882 The `-environment-pwd' Command
15883 ------------------------------
15890 Show the current working directory.
15895 The corresponding GDB command is `pwd'.
15902 ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
15906 File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Program Execution, Prev: GDB/MI Program Context, Up: GDB/MI
15908 24.9 GDB/MI Thread Commands
15909 ===========================
15911 The `-thread-info' Command
15912 --------------------------
15929 The `-thread-list-all-threads' Command
15930 --------------------------------------
15935 -thread-list-all-threads
15940 The equivalent GDB command is `info threads'.
15947 The `-thread-list-ids' Command
15948 ------------------------------
15955 Produces a list of the currently known GDB thread ids. At the end
15956 of the list it also prints the total number of such threads.
15961 Part of `info threads' supplies the same information.
15966 No threads present, besides the main process:
15970 ^done,thread-ids={},number-of-threads="0"
15977 ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
15978 number-of-threads="3"
15981 The `-thread-select' Command
15982 ----------------------------
15987 -thread-select THREADNUM
15989 Make THREADNUM the current thread. It prints the number of the new
15990 current thread, and the topmost frame for that thread.
15995 The corresponding GDB command is `thread'.
16004 *stopped,reason="end-stepping-range",thread-id="2",line="187",
16005 file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
16009 thread-ids={thread-id="3",thread-id="2",thread-id="1"},
16010 number-of-threads="3"
16013 ^done,new-thread-id="3",
16014 frame={level="0",func="vprintf",
16015 args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
16016 {name="arg",value="0x2"}],file="vprintf.c",line="31"}
16020 File: gdb.info, Node: GDB/MI Program Execution, Next: GDB/MI Stack Manipulation, Prev: GDB/MI Thread Commands, Up: GDB/MI
16022 24.10 GDB/MI Program Execution
16023 ==============================
16025 These are the asynchronous commands which generate the out-of-band
16026 record `*stopped'. Currently GDB only really executes asynchronously
16027 with remote targets and this interaction is mimicked in other cases.
16029 The `-exec-continue' Command
16030 ----------------------------
16037 Resumes the execution of the inferior program until a breakpoint is
16038 encountered, or until the inferior exits.
16043 The corresponding GDB corresponding is `continue'.
16052 *stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[],
16053 file="hello.c",fullname="/home/foo/bar/hello.c",line="13"}
16056 The `-exec-finish' Command
16057 --------------------------
16064 Resumes the execution of the inferior program until the current
16065 function is exited. Displays the results returned by the function.
16070 The corresponding GDB command is `finish'.
16075 Function returning `void'.
16081 *stopped,reason="function-finished",frame={func="main",args=[],
16082 file="hello.c",fullname="/home/foo/bar/hello.c",line="7"}
16085 Function returning other than `void'. The name of the internal GDB
16086 variable storing the result is printed, together with the value itself.
16091 *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
16092 args=[{name="a",value="1"],{name="b",value="9"}},
16093 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16094 gdb-result-var="$1",return-value="0"
16097 The `-exec-interrupt' Command
16098 -----------------------------
16105 Interrupts the background execution of the target. Note how the
16106 token associated with the stop message is the one for the execution
16107 command that has been interrupted. The token for the interrupt itself
16108 only appears in the `^done' output. If the user is trying to interrupt
16109 a non-running program, an error message will be printed.
16114 The corresponding GDB command is `interrupt'.
16127 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
16128 frame={addr="0x00010140",func="foo",args=[],file="try.c",
16129 fullname="/home/foo/bar/try.c",line="13"}
16134 ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
16137 The `-exec-next' Command
16138 ------------------------
16145 Resumes execution of the inferior program, stopping when the
16146 beginning of the next source line is reached.
16151 The corresponding GDB command is `next'.
16159 *stopped,reason="end-stepping-range",line="8",file="hello.c"
16162 The `-exec-next-instruction' Command
16163 ------------------------------------
16168 -exec-next-instruction
16170 Executes one machine instruction. If the instruction is a function
16171 call, continues until the function returns. If the program stops at an
16172 instruction in the middle of a source line, the address will be printed
16178 The corresponding GDB command is `nexti'.
16184 -exec-next-instruction
16188 *stopped,reason="end-stepping-range",
16189 addr="0x000100d4",line="5",file="hello.c"
16192 The `-exec-return' Command
16193 --------------------------
16200 Makes current function return immediately. Doesn't execute the
16201 inferior. Displays the new current frame.
16206 The corresponding GDB command is `return'.
16212 200-break-insert callee4
16213 200^done,bkpt={number="1",addr="0x00010734",
16214 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
16219 000*stopped,reason="breakpoint-hit",bkptno="1",
16220 frame={func="callee4",args=[],
16221 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16222 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
16228 111^done,frame={level="0",func="callee3",
16229 args=[{name="strarg",
16230 value="0x11940 \"A string argument.\""}],
16231 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16232 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
16235 The `-exec-run' Command
16236 -----------------------
16243 Starts execution of the inferior from the beginning. The inferior
16244 executes until either a breakpoint is encountered or the program exits.
16245 In the latter case the output will include an exit code, if the
16246 program has exited exceptionally.
16251 The corresponding GDB command is `run'.
16258 ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
16263 *stopped,reason="breakpoint-hit",bkptno="1",
16264 frame={func="main",args=[],file="recursive2.c",
16265 fullname="/home/foo/bar/recursive2.c",line="4"}
16268 Program exited normally:
16275 *stopped,reason="exited-normally"
16278 Program exited exceptionally:
16285 *stopped,reason="exited",exit-code="01"
16288 Another way the program can terminate is if it receives a signal
16289 such as `SIGINT'. In this case, GDB/MI displays this:
16292 *stopped,reason="exited-signalled",signal-name="SIGINT",
16293 signal-meaning="Interrupt"
16295 The `-exec-step' Command
16296 ------------------------
16303 Resumes execution of the inferior program, stopping when the
16304 beginning of the next source line is reached, if the next source line
16305 is not a function call. If it is, stop at the first instruction of the
16311 The corresponding GDB command is `step'.
16316 Stepping into a function:
16321 *stopped,reason="end-stepping-range",
16322 frame={func="foo",args=[{name="a",value="10"},
16323 {name="b",value="0"}],file="recursive2.c",
16324 fullname="/home/foo/bar/recursive2.c",line="11"}
16332 *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
16335 The `-exec-step-instruction' Command
16336 ------------------------------------
16341 -exec-step-instruction
16343 Resumes the inferior which executes one machine instruction. The
16344 output, once GDB has stopped, will vary depending on whether we have
16345 stopped in the middle of a source line or not. In the former case, the
16346 address at which the program stopped will be printed as well.
16351 The corresponding GDB command is `stepi'.
16357 -exec-step-instruction
16361 *stopped,reason="end-stepping-range",
16362 frame={func="foo",args=[],file="try.c",
16363 fullname="/home/foo/bar/try.c",line="10"}
16365 -exec-step-instruction
16369 *stopped,reason="end-stepping-range",
16370 frame={addr="0x000100f4",func="foo",args=[],file="try.c",
16371 fullname="/home/foo/bar/try.c",line="10"}
16374 The `-exec-until' Command
16375 -------------------------
16380 -exec-until [ LOCATION ]
16382 Executes the inferior until the LOCATION specified in the argument
16383 is reached. If there is no argument, the inferior executes until a
16384 source line greater than the current one is reached. The reason for
16385 stopping in this case will be `location-reached'.
16390 The corresponding GDB command is `until'.
16396 -exec-until recursive2.c:6
16400 *stopped,reason="location-reached",frame={func="main",args=[],
16401 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"}
16405 File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Variable Objects, Prev: GDB/MI Program Execution, Up: GDB/MI
16407 24.11 GDB/MI Stack Manipulation Commands
16408 ========================================
16410 The `-stack-info-frame' Command
16411 -------------------------------
16418 Get info on the selected frame.
16423 The corresponding GDB command is `info frame' or `frame' (without
16431 ^done,frame={level="1",addr="0x0001076c",func="callee3",
16432 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16433 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"}
16436 The `-stack-info-depth' Command
16437 -------------------------------
16442 -stack-info-depth [ MAX-DEPTH ]
16444 Return the depth of the stack. If the integer argument MAX-DEPTH is
16445 specified, do not count beyond MAX-DEPTH frames.
16450 There's no equivalent GDB command.
16455 For a stack with frame levels 0 through 11:
16461 -stack-info-depth 4
16464 -stack-info-depth 12
16467 -stack-info-depth 11
16470 -stack-info-depth 13
16474 The `-stack-list-arguments' Command
16475 -----------------------------------
16480 -stack-list-arguments SHOW-VALUES
16481 [ LOW-FRAME HIGH-FRAME ]
16483 Display a list of the arguments for the frames between LOW-FRAME and
16484 HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
16485 list the arguments for the whole call stack. If the two arguments are
16486 equal, show the single frame at the corresponding level. It is an
16487 error if LOW-FRAME is larger than the actual number of frames. On the
16488 other hand, HIGH-FRAME may be larger than the actual number of frames,
16489 in which case only existing frames will be returned.
16491 The SHOW-VALUES argument must have a value of 0 or 1. A value of 0
16492 means that only the names of the arguments are listed, a value of 1
16493 means that both names and values of the arguments are printed.
16498 GDB does not have an equivalent command. `gdbtk' has a `gdb_get_args'
16499 command which partially overlaps with the functionality of
16500 `-stack-list-arguments'.
16509 frame={level="0",addr="0x00010734",func="callee4",
16510 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16511 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"},
16512 frame={level="1",addr="0x0001076c",func="callee3",
16513 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16514 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"},
16515 frame={level="2",addr="0x0001078c",func="callee2",
16516 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16517 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"},
16518 frame={level="3",addr="0x000107b4",func="callee1",
16519 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16520 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"},
16521 frame={level="4",addr="0x000107e0",func="main",
16522 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
16523 fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"}]
16525 -stack-list-arguments 0
16528 frame={level="0",args=[]},
16529 frame={level="1",args=[name="strarg"]},
16530 frame={level="2",args=[name="intarg",name="strarg"]},
16531 frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
16532 frame={level="4",args=[]}]
16534 -stack-list-arguments 1
16537 frame={level="0",args=[]},
16539 args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
16540 frame={level="2",args=[
16541 {name="intarg",value="2"},
16542 {name="strarg",value="0x11940 \"A string argument.\""}]},
16543 {frame={level="3",args=[
16544 {name="intarg",value="2"},
16545 {name="strarg",value="0x11940 \"A string argument.\""},
16546 {name="fltarg",value="3.5"}]},
16547 frame={level="4",args=[]}]
16549 -stack-list-arguments 0 2 2
16550 ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
16552 -stack-list-arguments 1 2 2
16553 ^done,stack-args=[frame={level="2",
16554 args=[{name="intarg",value="2"},
16555 {name="strarg",value="0x11940 \"A string argument.\""}]}]
16558 The `-stack-list-frames' Command
16559 --------------------------------
16564 -stack-list-frames [ LOW-FRAME HIGH-FRAME ]
16566 List the frames currently on the stack. For each frame it displays
16567 the following info:
16570 The frame number, 0 being the topmost frame, i.e. the innermost
16574 The `$pc' value for that frame.
16580 File name of the source file where the function lives.
16583 Line number corresponding to the `$pc'.
16585 If invoked without arguments, this command prints a backtrace for the
16586 whole stack. If given two integer arguments, it shows the frames whose
16587 levels are between the two arguments (inclusive). If the two arguments
16588 are equal, it shows the single frame at the corresponding level. It is
16589 an error if LOW-FRAME is larger than the actual number of frames. On
16590 the other hand, HIGH-FRAME may be larger than the actual number of
16591 frames, in which case only existing frames will be returned.
16596 The corresponding GDB commands are `backtrace' and `where'.
16601 Full stack backtrace:
16606 [frame={level="0",addr="0x0001076c",func="foo",
16607 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"},
16608 frame={level="1",addr="0x000107a4",func="foo",
16609 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16610 frame={level="2",addr="0x000107a4",func="foo",
16611 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16612 frame={level="3",addr="0x000107a4",func="foo",
16613 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16614 frame={level="4",addr="0x000107a4",func="foo",
16615 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16616 frame={level="5",addr="0x000107a4",func="foo",
16617 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16618 frame={level="6",addr="0x000107a4",func="foo",
16619 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16620 frame={level="7",addr="0x000107a4",func="foo",
16621 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16622 frame={level="8",addr="0x000107a4",func="foo",
16623 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16624 frame={level="9",addr="0x000107a4",func="foo",
16625 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16626 frame={level="10",addr="0x000107a4",func="foo",
16627 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16628 frame={level="11",addr="0x00010738",func="main",
16629 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"}]
16632 Show frames between LOW_FRAME and HIGH_FRAME:
16635 -stack-list-frames 3 5
16637 [frame={level="3",addr="0x000107a4",func="foo",
16638 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16639 frame={level="4",addr="0x000107a4",func="foo",
16640 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"},
16641 frame={level="5",addr="0x000107a4",func="foo",
16642 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}]
16645 Show a single frame:
16648 -stack-list-frames 3 3
16650 [frame={level="3",addr="0x000107a4",func="foo",
16651 file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"}]
16654 The `-stack-list-locals' Command
16655 --------------------------------
16660 -stack-list-locals PRINT-VALUES
16662 Display the local variable names for the selected frame. If
16663 PRINT-VALUES is 0 or `--no-values', print only the names of the
16664 variables; if it is 1 or `--all-values', print also their values; and
16665 if it is 2 or `--simple-values', print the name, type and value for
16666 simple data types and the name and type for arrays, structures and
16667 unions. In this last case, a frontend can immediately display the
16668 value of simple data types and create variable objects for other data
16669 types when the the user wishes to explore their values in more detail.
16674 `info locals' in GDB, `gdb_get_locals' in `gdbtk'.
16680 -stack-list-locals 0
16681 ^done,locals=[name="A",name="B",name="C"]
16683 -stack-list-locals --all-values
16684 ^done,locals=[{name="A",value="1"},{name="B",value="2"},
16685 {name="C",value="{1, 2, 3}"}]
16686 -stack-list-locals --simple-values
16687 ^done,locals=[{name="A",type="int",value="1"},
16688 {name="B",type="int",value="2"},{name="C",type="int [3]"}]
16691 The `-stack-select-frame' Command
16692 ---------------------------------
16697 -stack-select-frame FRAMENUM
16699 Change the selected frame. Select a different frame FRAMENUM on the
16705 The corresponding GDB commands are `frame', `up', `down',
16706 `select-frame', `up-silent', and `down-silent'.
16712 -stack-select-frame 2
16717 File: gdb.info, Node: GDB/MI Variable Objects, Next: GDB/MI Data Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
16719 24.12 GDB/MI Variable Objects
16720 =============================
16722 Motivation for Variable Objects in GDB/MI
16723 -----------------------------------------
16725 For the implementation of a variable debugger window (locals, watched
16726 expressions, etc.), we are proposing the adaptation of the existing code
16729 The two main reasons for that are:
16731 1. It has been proven in practice (it is already on its second
16734 2. It will shorten development time (needless to say how important it
16737 The original interface was designed to be used by Tcl code, so it was
16738 slightly changed so it could be used through GDB/MI. This section
16739 describes the GDB/MI operations that will be available and gives some
16740 hints about their use.
16742 _Note_: In addition to the set of operations described here, we
16743 expect the GUI implementation of a variable window to require, at
16744 least, the following operations:
16746 * `-gdb-show' `output-radix'
16748 * `-stack-list-arguments'
16750 * `-stack-list-locals'
16752 * `-stack-select-frame'
16754 Introduction to Variable Objects in GDB/MI
16755 ------------------------------------------
16757 The basic idea behind variable objects is the creation of a named object
16758 to represent a variable, an expression, a memory location or even a CPU
16759 register. For each object created, a set of operations is available for
16760 examining or changing its properties.
16762 Furthermore, complex data types, such as C structures, are
16763 represented in a tree format. For instance, the `struct' type variable
16764 is the root and the children will represent the struct members. If a
16765 child is itself of a complex type, it will also have children of its
16766 own. Appropriate language differences are handled for C, C++ and Java.
16768 When returning the actual values of the objects, this facility allows
16769 for the individual selection of the display format used in the result
16770 creation. It can be chosen among: binary, decimal, hexadecimal, octal
16771 and natural. Natural refers to a default format automatically chosen
16772 based on the variable type (like decimal for an `int', hex for
16775 The following is the complete set of GDB/MI operations defined to
16776 access this functionality:
16778 *Operation* *Description*
16779 `-var-create' create a variable object
16780 `-var-delete' delete the variable object and its children
16781 `-var-set-format' set the display format of this variable
16782 `-var-show-format' show the display format of this variable
16783 `-var-info-num-children' tells how many children this object has
16784 `-var-list-children' return a list of the object's children
16785 `-var-info-type' show the type of this variable object
16786 `-var-info-expression' print what this variable object represents
16787 `-var-show-attributes' is this variable editable? does it exist
16789 `-var-evaluate-expression' get the value of this variable
16790 `-var-assign' set the value of this variable
16791 `-var-update' update the variable and its children
16793 In the next subsection we describe each operation in detail and
16794 suggest how it can be used.
16796 Description And Use of Operations on Variable Objects
16797 -----------------------------------------------------
16799 The `-var-create' Command
16800 -------------------------
16805 -var-create {NAME | "-"}
16806 {FRAME-ADDR | "*"} EXPRESSION
16808 This operation creates a variable object, which allows the
16809 monitoring of a variable, the result of an expression, a memory cell or
16812 The NAME parameter is the string by which the object can be
16813 referenced. It must be unique. If `-' is specified, the varobj system
16814 will generate a string "varNNNNNN" automatically. It will be unique
16815 provided that one does not specify NAME on that format. The command
16816 fails if a duplicate name is found.
16818 The frame under which the expression should be evaluated can be
16819 specified by FRAME-ADDR. A `*' indicates that the current frame should
16822 EXPRESSION is any expression valid on the current language set (must
16823 not begin with a `*'), or one of the following:
16825 * `*ADDR', where ADDR is the address of a memory cell
16827 * `*ADDR-ADDR' -- a memory address range (TBD)
16829 * `$REGNAME' -- a CPU register name
16834 This operation returns the name, number of children and the type of the
16835 object created. Type is returned as a string as the ones generated by
16838 name="NAME",numchild="N",type="TYPE"
16840 The `-var-delete' Command
16841 -------------------------
16848 Deletes a previously created variable object and all of its children.
16850 Returns an error if the object NAME is not found.
16852 The `-var-set-format' Command
16853 -----------------------------
16858 -var-set-format NAME FORMAT-SPEC
16860 Sets the output format for the value of the object NAME to be
16863 The syntax for the FORMAT-SPEC is as follows:
16866 {binary | decimal | hexadecimal | octal | natural}
16868 The `-var-show-format' Command
16869 ------------------------------
16874 -var-show-format NAME
16876 Returns the format used to display the value of the object NAME.
16881 The `-var-info-num-children' Command
16882 ------------------------------------
16887 -var-info-num-children NAME
16889 Returns the number of children of a variable object NAME:
16893 The `-var-list-children' Command
16894 --------------------------------
16899 -var-list-children [PRINT-VALUES] NAME
16901 Return a list of the children of the specified variable object and
16902 create variable objects for them, if they do not already exist. With a
16903 single argument or if PRINT-VALUES has a value for of 0 or
16904 `--no-values', print only the names of the variables; if PRINT-VALUES
16905 is 1 or `--all-values', also print their values; and if it is 2 or
16906 `--simple-values' print the name and value for simple data types and
16907 just the name for arrays, structures and unions.
16913 -var-list-children n
16914 ^done,numchild=N,children=[{name=NAME,
16915 numchild=N,type=TYPE},(repeats N times)]
16917 -var-list-children --all-values n
16918 ^done,numchild=N,children=[{name=NAME,
16919 numchild=N,value=VALUE,type=TYPE},(repeats N times)]
16921 The `-var-info-type' Command
16922 ----------------------------
16927 -var-info-type NAME
16929 Returns the type of the specified variable NAME. The type is
16930 returned as a string in the same format as it is output by the GDB CLI:
16934 The `-var-info-expression' Command
16935 ----------------------------------
16940 -var-info-expression NAME
16942 Returns what is represented by the variable object NAME:
16944 lang=LANG-SPEC,exp=EXPRESSION
16946 where LANG-SPEC is `{"C" | "C++" | "Java"}'.
16948 The `-var-show-attributes' Command
16949 ----------------------------------
16954 -var-show-attributes NAME
16956 List attributes of the specified variable object NAME:
16958 status=ATTR [ ( ,ATTR )* ]
16960 where ATTR is `{ { editable | noneditable } | TBD }'.
16962 The `-var-evaluate-expression' Command
16963 --------------------------------------
16968 -var-evaluate-expression NAME
16970 Evaluates the expression that is represented by the specified
16971 variable object and returns its value as a string in the current format
16972 specified for the object:
16976 Note that one must invoke `-var-list-children' for a variable before
16977 the value of a child variable can be evaluated.
16979 The `-var-assign' Command
16980 -------------------------
16985 -var-assign NAME EXPRESSION
16987 Assigns the value of EXPRESSION to the variable object specified by
16988 NAME. The object must be `editable'. If the variable's value is
16989 altered by the assign, the variable will show up in any subsequent
16990 `-var-update' list.
17000 ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
17003 The `-var-update' Command
17004 -------------------------
17009 -var-update [PRINT-VALUES] {NAME | "*"}
17011 Update the value of the variable object NAME by evaluating its
17012 expression after fetching all the new values from memory or registers.
17013 A `*' causes all existing variable objects to be updated. The option
17014 PRINT-VALUES determines whether names both and values, or just names
17015 are printed in the manner described for `-var-list-children' (*note
17016 -var-list-children::).
17025 -var-update --all-values var1
17026 ^done,changelist=[{name="var1",value="3",in_scope="true",
17027 type_changed="false"}]
17031 File: gdb.info, Node: GDB/MI Data Manipulation, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Variable Objects, Up: GDB/MI
17033 24.13 GDB/MI Data Manipulation
17034 ==============================
17036 This section describes the GDB/MI commands that manipulate data:
17037 examine memory and registers, evaluate expressions, etc.
17039 The `-data-disassemble' Command
17040 -------------------------------
17046 [ -s START-ADDR -e END-ADDR ]
17047 | [ -f FILENAME -l LINENUM [ -n LINES ] ]
17053 is the beginning address (or `$pc')
17059 is the name of the file to disassemble
17062 is the line number to disassemble around
17065 is the the number of disassembly lines to be produced. If it is
17066 -1, the whole function will be disassembled, in case no END-ADDR is
17067 specified. If END-ADDR is specified as a non-zero value, and
17068 LINES is lower than the number of disassembly lines between
17069 START-ADDR and END-ADDR, only LINES lines are displayed; if LINES
17070 is higher than the number of lines between START-ADDR and
17071 END-ADDR, only the lines up to END-ADDR are displayed.
17074 is either 0 (meaning only disassembly) or 1 (meaning mixed source
17080 The output for each instruction is composed of four fields:
17090 Note that whatever included in the instruction field, is not
17091 manipulated directely by GDB/MI, i.e. it is not possible to adjust its
17097 There's no direct mapping from this command to the CLI.
17102 Disassemble from the current value of `$pc' to `$pc + 20':
17105 -data-disassemble -s $pc -e "$pc + 20" -- 0
17108 {address="0x000107c0",func-name="main",offset="4",
17109 inst="mov 2, %o0"},
17110 {address="0x000107c4",func-name="main",offset="8",
17111 inst="sethi %hi(0x11800), %o2"},
17112 {address="0x000107c8",func-name="main",offset="12",
17113 inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
17114 {address="0x000107cc",func-name="main",offset="16",
17115 inst="sethi %hi(0x11800), %o2"},
17116 {address="0x000107d0",func-name="main",offset="20",
17117 inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
17120 Disassemble the whole `main' function. Line 32 is part of `main'.
17122 -data-disassemble -f basics.c -l 32 -- 0
17124 {address="0x000107bc",func-name="main",offset="0",
17125 inst="save %sp, -112, %sp"},
17126 {address="0x000107c0",func-name="main",offset="4",
17127 inst="mov 2, %o0"},
17128 {address="0x000107c4",func-name="main",offset="8",
17129 inst="sethi %hi(0x11800), %o2"},
17131 {address="0x0001081c",func-name="main",offset="96",inst="ret "},
17132 {address="0x00010820",func-name="main",offset="100",inst="restore "}]
17135 Disassemble 3 instructions from the start of `main':
17138 -data-disassemble -f basics.c -l 32 -n 3 -- 0
17140 {address="0x000107bc",func-name="main",offset="0",
17141 inst="save %sp, -112, %sp"},
17142 {address="0x000107c0",func-name="main",offset="4",
17143 inst="mov 2, %o0"},
17144 {address="0x000107c4",func-name="main",offset="8",
17145 inst="sethi %hi(0x11800), %o2"}]
17148 Disassemble 3 instructions from the start of `main' in mixed mode:
17151 -data-disassemble -f basics.c -l 32 -n 3 -- 1
17153 src_and_asm_line={line="31",
17154 file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
17155 testsuite/gdb.mi/basics.c",line_asm_insn=[
17156 {address="0x000107bc",func-name="main",offset="0",
17157 inst="save %sp, -112, %sp"}]},
17158 src_and_asm_line={line="32",
17159 file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
17160 testsuite/gdb.mi/basics.c",line_asm_insn=[
17161 {address="0x000107c0",func-name="main",offset="4",
17162 inst="mov 2, %o0"},
17163 {address="0x000107c4",func-name="main",offset="8",
17164 inst="sethi %hi(0x11800), %o2"}]}]
17167 The `-data-evaluate-expression' Command
17168 ---------------------------------------
17173 -data-evaluate-expression EXPR
17175 Evaluate EXPR as an expression. The expression could contain an
17176 inferior function call. The function call will execute synchronously.
17177 If the expression contains spaces, it must be enclosed in double quotes.
17182 The corresponding GDB commands are `print', `output', and `call'. In
17183 `gdbtk' only, there's a corresponding `gdb_eval' command.
17188 In the following example, the numbers that precede the commands are the
17189 "tokens" described in *Note GDB/MI Command Syntax: GDB/MI Command
17190 Syntax. Notice how GDB/MI returns the same tokens in its output.
17192 211-data-evaluate-expression A
17195 311-data-evaluate-expression &A
17196 311^done,value="0xefffeb7c"
17198 411-data-evaluate-expression A+3
17201 511-data-evaluate-expression "A + 3"
17205 The `-data-list-changed-registers' Command
17206 ------------------------------------------
17211 -data-list-changed-registers
17213 Display a list of the registers that have changed.
17218 GDB doesn't have a direct analog for this command; `gdbtk' has the
17219 corresponding command `gdb_changed_register_list'.
17224 On a PPC MBX board:
17231 *stopped,reason="breakpoint-hit",bkptno="1",frame={func="main",
17232 args=[],file="try.c",fullname="/home/foo/bar/try.c",line="5"}
17234 -data-list-changed-registers
17235 ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
17236 "10","11","13","14","15","16","17","18","19","20","21","22","23",
17237 "24","25","26","27","28","30","31","64","65","66","67","69"]
17240 The `-data-list-register-names' Command
17241 ---------------------------------------
17246 -data-list-register-names [ ( REGNO )+ ]
17248 Show a list of register names for the current target. If no
17249 arguments are given, it shows a list of the names of all the registers.
17250 If integer numbers are given as arguments, it will print a list of the
17251 names of the registers corresponding to the arguments. To ensure
17252 consistency between a register name and its number, the output list may
17253 include empty register names.
17258 GDB does not have a command which corresponds to
17259 `-data-list-register-names'. In `gdbtk' there is a corresponding
17260 command `gdb_regnames'.
17265 For the PPC MBX board:
17267 -data-list-register-names
17268 ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
17269 "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
17270 "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
17271 "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
17272 "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
17273 "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
17274 "", "pc","ps","cr","lr","ctr","xer"]
17276 -data-list-register-names 1 2 3
17277 ^done,register-names=["r1","r2","r3"]
17280 The `-data-list-register-values' Command
17281 ----------------------------------------
17286 -data-list-register-values FMT [ ( REGNO )*]
17288 Display the registers' contents. FMT is the format according to
17289 which the registers' contents are to be returned, followed by an
17290 optional list of numbers specifying the registers to display. A
17291 missing list of numbers indicates that the contents of all the
17292 registers must be returned.
17294 Allowed formats for FMT are:
17317 The corresponding GDB commands are `info reg', `info all-reg', and (in
17318 `gdbtk') `gdb_fetch_registers'.
17323 For a PPC MBX board (note: line breaks are for readability only, they
17324 don't appear in the actual output):
17327 -data-list-register-values r 64 65
17328 ^done,register-values=[{number="64",value="0xfe00a300"},
17329 {number="65",value="0x00029002"}]
17331 -data-list-register-values x
17332 ^done,register-values=[{number="0",value="0xfe0043c8"},
17333 {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
17334 {number="3",value="0x0"},{number="4",value="0xa"},
17335 {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
17336 {number="7",value="0xfe011e98"},{number="8",value="0x2"},
17337 {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
17338 {number="11",value="0x1"},{number="12",value="0x0"},
17339 {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
17340 {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
17341 {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
17342 {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
17343 {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
17344 {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
17345 {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
17346 {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
17347 {number="29",value="0x0"},{number="30",value="0xfe010000"},
17348 {number="31",value="0x0"},{number="32",value="0x0"},
17349 {number="33",value="0x0"},{number="34",value="0x0"},
17350 {number="35",value="0x0"},{number="36",value="0x0"},
17351 {number="37",value="0x0"},{number="38",value="0x0"},
17352 {number="39",value="0x0"},{number="40",value="0x0"},
17353 {number="41",value="0x0"},{number="42",value="0x0"},
17354 {number="43",value="0x0"},{number="44",value="0x0"},
17355 {number="45",value="0x0"},{number="46",value="0x0"},
17356 {number="47",value="0x0"},{number="48",value="0x0"},
17357 {number="49",value="0x0"},{number="50",value="0x0"},
17358 {number="51",value="0x0"},{number="52",value="0x0"},
17359 {number="53",value="0x0"},{number="54",value="0x0"},
17360 {number="55",value="0x0"},{number="56",value="0x0"},
17361 {number="57",value="0x0"},{number="58",value="0x0"},
17362 {number="59",value="0x0"},{number="60",value="0x0"},
17363 {number="61",value="0x0"},{number="62",value="0x0"},
17364 {number="63",value="0x0"},{number="64",value="0xfe00a300"},
17365 {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
17366 {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
17367 {number="69",value="0x20002b03"}]
17370 The `-data-read-memory' Command
17371 -------------------------------
17376 -data-read-memory [ -o BYTE-OFFSET ]
17377 ADDRESS WORD-FORMAT WORD-SIZE
17378 NR-ROWS NR-COLS [ ASCHAR ]
17383 An expression specifying the address of the first memory word to be
17384 read. Complex expressions containing embedded white space should
17385 be quoted using the C convention.
17388 The format to be used to print the memory words. The notation is
17389 the same as for GDB's `print' command (*note Output formats:
17393 The size of each memory word in bytes.
17396 The number of rows in the output table.
17399 The number of columns in the output table.
17402 If present, indicates that each row should include an ASCII dump.
17403 The value of ASCHAR is used as a padding character when a byte is
17404 not a member of the printable ASCII character set (printable ASCII
17405 characters are those whose code is between 32 and 126,
17409 An offset to add to the ADDRESS before fetching memory.
17411 This command displays memory contents as a table of NR-ROWS by
17412 NR-COLS words, each word being WORD-SIZE bytes. In total, `NR-ROWS *
17413 NR-COLS * WORD-SIZE' bytes are read (returned as `total-bytes').
17414 Should less than the requested number of bytes be returned by the
17415 target, the missing words are identified using `N/A'. The number of
17416 bytes read from the target is returned in `nr-bytes' and the starting
17417 address used to read memory in `addr'.
17419 The address of the next/previous row or page is available in
17420 `next-row' and `prev-row', `next-page' and `prev-page'.
17425 The corresponding GDB command is `x'. `gdbtk' has `gdb_get_mem' memory
17431 Read six bytes of memory starting at `bytes+6' but then offset by `-6'
17432 bytes. Format as three rows of two columns. One byte per word.
17433 Display each word in hex.
17436 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
17437 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
17438 next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
17439 prev-page="0x0000138a",memory=[
17440 {addr="0x00001390",data=["0x00","0x01"]},
17441 {addr="0x00001392",data=["0x02","0x03"]},
17442 {addr="0x00001394",data=["0x04","0x05"]}]
17445 Read two bytes of memory starting at address `shorts + 64' and
17446 display as a single word formatted in decimal.
17449 5-data-read-memory shorts+64 d 2 1 1
17450 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
17451 next-row="0x00001512",prev-row="0x0000150e",
17452 next-page="0x00001512",prev-page="0x0000150e",memory=[
17453 {addr="0x00001510",data=["128"]}]
17456 Read thirty two bytes of memory starting at `bytes+16' and format as
17457 eight rows of four columns. Include a string encoding with `x' used as
17458 the non-printable character.
17461 4-data-read-memory bytes+16 x 1 8 4 x
17462 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
17463 next-row="0x000013c0",prev-row="0x0000139c",
17464 next-page="0x000013c0",prev-page="0x00001380",memory=[
17465 {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
17466 {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
17467 {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
17468 {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
17469 {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
17470 {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
17471 {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
17472 {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
17476 File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Symbol Query, Prev: GDB/MI Data Manipulation, Up: GDB/MI
17478 24.14 GDB/MI Tracepoint Commands
17479 ================================
17481 The tracepoint commands are not yet implemented.
17484 File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI File Commands, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
17486 24.15 GDB/MI Symbol Query Commands
17487 ==================================
17489 The `-symbol-info-address' Command
17490 ----------------------------------
17495 -symbol-info-address SYMBOL
17497 Describe where SYMBOL is stored.
17502 The corresponding GDB command is `info address'.
17509 The `-symbol-info-file' Command
17510 -------------------------------
17517 Show the file for the symbol.
17522 There's no equivalent GDB command. `gdbtk' has `gdb_find_file'.
17529 The `-symbol-info-function' Command
17530 -----------------------------------
17535 -symbol-info-function
17537 Show which function the symbol lives in.
17542 `gdb_get_function' in `gdbtk'.
17549 The `-symbol-info-line' Command
17550 -------------------------------
17557 Show the core addresses of the code for a source line.
17562 The corresponding GDB command is `info line'. `gdbtk' has the
17563 `gdb_get_line' and `gdb_get_file' commands.
17570 The `-symbol-info-symbol' Command
17571 ---------------------------------
17576 -symbol-info-symbol ADDR
17578 Describe what symbol is at location ADDR.
17583 The corresponding GDB command is `info symbol'.
17590 The `-symbol-list-functions' Command
17591 ------------------------------------
17596 -symbol-list-functions
17598 List the functions in the executable.
17603 `info functions' in GDB, `gdb_listfunc' and `gdb_search' in `gdbtk'.
17610 The `-symbol-list-lines' Command
17611 --------------------------------
17616 -symbol-list-lines FILENAME
17618 Print the list of lines that contain code and their associated
17619 program addresses for the given source filename. The entries are
17620 sorted in ascending PC order.
17625 There is no corresponding GDB command.
17631 -symbol-list-lines basics.c
17632 ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
17635 The `-symbol-list-types' Command
17636 --------------------------------
17643 List all the type names.
17648 The corresponding commands are `info types' in GDB, `gdb_search' in
17656 The `-symbol-list-variables' Command
17657 ------------------------------------
17662 -symbol-list-variables
17664 List all the global and static variable names.
17669 `info variables' in GDB, `gdb_search' in `gdbtk'.
17676 The `-symbol-locate' Command
17677 ----------------------------
17687 `gdb_loc' in `gdbtk'.
17694 The `-symbol-type' Command
17695 --------------------------
17700 -symbol-type VARIABLE
17702 Show type of VARIABLE.
17707 The corresponding GDB command is `ptype', `gdbtk' has
17708 `gdb_obj_variable'.
17716 File: gdb.info, Node: GDB/MI File Commands, Next: GDB/MI Target Manipulation, Prev: GDB/MI Symbol Query, Up: GDB/MI
17718 24.16 GDB/MI File Commands
17719 ==========================
17721 This section describes the GDB/MI commands to specify executable file
17722 names and to read in and obtain symbol table information.
17724 The `-file-exec-and-symbols' Command
17725 ------------------------------------
17730 -file-exec-and-symbols FILE
17732 Specify the executable file to be debugged. This file is the one
17733 from which the symbol table is also read. If no file is specified, the
17734 command clears the executable and symbol information. If breakpoints
17735 are set when using this command with no arguments, GDB will produce
17736 error messages. Otherwise, no output is produced, except a completion
17742 The corresponding GDB command is `file'.
17748 -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
17752 The `-file-exec-file' Command
17753 -----------------------------
17758 -file-exec-file FILE
17760 Specify the executable file to be debugged. Unlike
17761 `-file-exec-and-symbols', the symbol table is _not_ read from this
17762 file. If used without argument, GDB clears the information about the
17763 executable file. No output is produced, except a completion
17769 The corresponding GDB command is `exec-file'.
17775 -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
17779 The `-file-list-exec-sections' Command
17780 --------------------------------------
17785 -file-list-exec-sections
17787 List the sections of the current executable file.
17792 The GDB command `info file' shows, among the rest, the same information
17793 as this command. `gdbtk' has a corresponding command `gdb_load_info'.
17800 The `-file-list-exec-source-file' Command
17801 -----------------------------------------
17806 -file-list-exec-source-file
17808 List the line number, the current source file, and the absolute path
17809 to the current source file for the current executable.
17814 The GDB equivalent is `info source'
17820 123-file-list-exec-source-file
17821 123^done,line="1",file="foo.c",fullname="/home/bar/foo.c"
17824 The `-file-list-exec-source-files' Command
17825 ------------------------------------------
17830 -file-list-exec-source-files
17832 List the source files for the current executable.
17834 It will always output the filename, but only when GDB can find the
17835 absolute file name of a source file, will it output the fullname.
17840 The GDB equivalent is `info sources'. `gdbtk' has an analogous command
17847 -file-list-exec-source-files
17849 {file=foo.c,fullname=/home/foo.c},
17850 {file=/home/bar.c,fullname=/home/bar.c},
17851 {file=gdb_could_not_find_fullpath.c}]
17854 The `-file-list-shared-libraries' Command
17855 -----------------------------------------
17860 -file-list-shared-libraries
17862 List the shared libraries in the program.
17867 The corresponding GDB command is `info shared'.
17874 The `-file-list-symbol-files' Command
17875 -------------------------------------
17880 -file-list-symbol-files
17887 The corresponding GDB command is `info file' (part of it).
17894 The `-file-symbol-file' Command
17895 -------------------------------
17900 -file-symbol-file FILE
17902 Read symbol table info from the specified FILE argument. When used
17903 without arguments, clears GDB's symbol table info. No output is
17904 produced, except for a completion notification.
17909 The corresponding GDB command is `symbol-file'.
17915 -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
17920 File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI Miscellaneous Commands, Prev: GDB/MI File Commands, Up: GDB/MI
17922 24.17 GDB/MI Target Manipulation Commands
17923 =========================================
17925 The `-target-attach' Command
17926 ----------------------------
17931 -target-attach PID | FILE
17933 Attach to a process PID or a file FILE outside of GDB.
17938 The corresponding GDB command is `attach'.
17945 The `-target-compare-sections' Command
17946 --------------------------------------
17951 -target-compare-sections [ SECTION ]
17953 Compare data of section SECTION on target to the exec file. Without
17954 the argument, all sections are compared.
17959 The GDB equivalent is `compare-sections'.
17966 The `-target-detach' Command
17967 ----------------------------
17974 Detach from the remote target which normally resumes its execution.
17980 The corresponding GDB command is `detach'.
17990 The `-target-disconnect' Command
17991 --------------------------------
17998 Disconnect from the remote target. There's no output and the target
17999 is generally not resumed.
18004 The corresponding GDB command is `disconnect'.
18014 The `-target-download' Command
18015 ------------------------------
18022 Loads the executable onto the remote target. It prints out an
18023 update message every half second, which includes the fields:
18026 The name of the section.
18029 The size of what has been sent so far for that section.
18032 The size of the section.
18035 The total size of what was sent so far (the current and the
18036 previous sections).
18039 The size of the overall executable to download.
18041 Each message is sent as status record (*note GDB/MI Output Syntax:
18042 GDB/MI Output Syntax.).
18044 In addition, it prints the name and size of the sections, as they are
18045 downloaded. These messages include the following fields:
18048 The name of the section.
18051 The size of the section.
18054 The size of the overall executable to download.
18056 At the end, a summary is printed.
18061 The corresponding GDB command is `load'.
18066 Note: each status message appears on a single line. Here the messages
18067 have been broken down so that they can fit onto a page.
18071 +download,{section=".text",section-size="6668",total-size="9880"}
18072 +download,{section=".text",section-sent="512",section-size="6668",
18073 total-sent="512",total-size="9880"}
18074 +download,{section=".text",section-sent="1024",section-size="6668",
18075 total-sent="1024",total-size="9880"}
18076 +download,{section=".text",section-sent="1536",section-size="6668",
18077 total-sent="1536",total-size="9880"}
18078 +download,{section=".text",section-sent="2048",section-size="6668",
18079 total-sent="2048",total-size="9880"}
18080 +download,{section=".text",section-sent="2560",section-size="6668",
18081 total-sent="2560",total-size="9880"}
18082 +download,{section=".text",section-sent="3072",section-size="6668",
18083 total-sent="3072",total-size="9880"}
18084 +download,{section=".text",section-sent="3584",section-size="6668",
18085 total-sent="3584",total-size="9880"}
18086 +download,{section=".text",section-sent="4096",section-size="6668",
18087 total-sent="4096",total-size="9880"}
18088 +download,{section=".text",section-sent="4608",section-size="6668",
18089 total-sent="4608",total-size="9880"}
18090 +download,{section=".text",section-sent="5120",section-size="6668",
18091 total-sent="5120",total-size="9880"}
18092 +download,{section=".text",section-sent="5632",section-size="6668",
18093 total-sent="5632",total-size="9880"}
18094 +download,{section=".text",section-sent="6144",section-size="6668",
18095 total-sent="6144",total-size="9880"}
18096 +download,{section=".text",section-sent="6656",section-size="6668",
18097 total-sent="6656",total-size="9880"}
18098 +download,{section=".init",section-size="28",total-size="9880"}
18099 +download,{section=".fini",section-size="28",total-size="9880"}
18100 +download,{section=".data",section-size="3156",total-size="9880"}
18101 +download,{section=".data",section-sent="512",section-size="3156",
18102 total-sent="7236",total-size="9880"}
18103 +download,{section=".data",section-sent="1024",section-size="3156",
18104 total-sent="7748",total-size="9880"}
18105 +download,{section=".data",section-sent="1536",section-size="3156",
18106 total-sent="8260",total-size="9880"}
18107 +download,{section=".data",section-sent="2048",section-size="3156",
18108 total-sent="8772",total-size="9880"}
18109 +download,{section=".data",section-sent="2560",section-size="3156",
18110 total-sent="9284",total-size="9880"}
18111 +download,{section=".data",section-sent="3072",section-size="3156",
18112 total-sent="9796",total-size="9880"}
18113 ^done,address="0x10004",load-size="9880",transfer-rate="6586",
18117 The `-target-exec-status' Command
18118 ---------------------------------
18123 -target-exec-status
18125 Provide information on the state of the target (whether it is
18126 running or not, for instance).
18131 There's no equivalent GDB command.
18138 The `-target-list-available-targets' Command
18139 --------------------------------------------
18144 -target-list-available-targets
18146 List the possible targets to connect to.
18151 The corresponding GDB command is `help target'.
18158 The `-target-list-current-targets' Command
18159 ------------------------------------------
18164 -target-list-current-targets
18166 Describe the current target.
18171 The corresponding information is printed by `info file' (among other
18179 The `-target-list-parameters' Command
18180 -------------------------------------
18185 -target-list-parameters
18197 The `-target-select' Command
18198 ----------------------------
18203 -target-select TYPE PARAMETERS ...
18205 Connect GDB to the remote target. This command takes two args:
18208 The type of target, for instance `async', `remote', etc.
18211 Device names, host names and the like. *Note Commands for
18212 managing targets: Target Commands, for more details.
18214 The output is a connection notification, followed by the address at
18215 which the target program is, in the following form:
18217 ^connected,addr="ADDRESS",func="FUNCTION NAME",
18223 The corresponding GDB command is `target'.
18229 -target-select async /dev/ttya
18230 ^connected,addr="0xfe00a300",func="??",args=[]
18234 File: gdb.info, Node: GDB/MI Miscellaneous Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
18236 24.18 Miscellaneous GDB/MI Commands
18237 ===================================
18239 The `-gdb-exit' Command
18240 -----------------------
18247 Exit GDB immediately.
18252 Approximately corresponds to `quit'.
18261 The `-exec-abort' Command
18262 -------------------------
18269 Kill the inferior running program.
18274 The corresponding GDB command is `kill'.
18281 The `-gdb-set' Command
18282 ----------------------
18289 Set an internal GDB variable.
18294 The corresponding GDB command is `set'.
18304 The `-gdb-show' Command
18305 -----------------------
18312 Show the current value of a GDB variable.
18317 The corresponding GDB command is `show'.
18327 The `-gdb-version' Command
18328 --------------------------
18335 Show version information for GDB. Used mostly in testing.
18340 The GDB equivalent is `show version'. GDB by default shows this
18341 information when you start an interactive session.
18349 ~Copyright 2000 Free Software Foundation, Inc.
18350 ~GDB is free software, covered by the GNU General Public License, and
18351 ~you are welcome to change it and/or distribute copies of it under
18352 ~ certain conditions.
18353 ~Type "show copying" to see the conditions.
18354 ~There is absolutely no warranty for GDB. Type "show warranty" for
18356 ~This GDB was configured as
18357 "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
18361 The `-interpreter-exec' Command
18362 -------------------------------
18367 -interpreter-exec INTERPRETER COMMAND
18369 Execute the specified COMMAND in the given INTERPRETER.
18374 The corresponding GDB command is `interpreter-exec'.
18380 -interpreter-exec console "break main"
18381 &"During symbol reading, couldn't parse type; debugger out of date?.\n"
18382 &"During symbol reading, bad structure-type format.\n"
18383 ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
18387 The `-inferior-tty-set' Command
18388 -------------------------------
18393 -inferior-tty-set /dev/pts/1
18395 Set terminal for future runs of the program being debugged.
18400 The corresponding GDB command is `set inferior-tty' /dev/pts/1.
18406 -inferior-tty-set /dev/pts/1
18410 The `-inferior-tty-show' Command
18411 --------------------------------
18418 Show terminal for future runs of program being debugged.
18423 The corresponding GDB command is `show inferior-tty'.
18429 -inferior-tty-set /dev/pts/1
18433 ^done,inferior_tty_terminal="/dev/pts/1"
18437 File: gdb.info, Node: Annotations, Next: GDB/MI, Prev: Emacs, Up: Top
18442 This chapter describes annotations in GDB. Annotations were designed
18443 to interface GDB to graphical user interfaces or other similar programs
18444 which want to interact with GDB at a relatively high level.
18446 The annotation mechanism has largely been superseeded by GDB/MI
18451 * Annotations Overview:: What annotations are; the general syntax.
18452 * Prompting:: Annotations marking GDB's need for input.
18453 * Errors:: Annotations for error messages.
18454 * Invalidation:: Some annotations describe things now invalid.
18455 * Annotations for Running::
18456 Whether the program is running, how it stopped, etc.
18457 * Source Annotations:: Annotations describing source code.
18460 File: gdb.info, Node: Annotations Overview, Next: Prompting, Up: Annotations
18462 25.1 What is an Annotation?
18463 ===========================
18465 Annotations start with a newline character, two `control-z' characters,
18466 and the name of the annotation. If there is no additional information
18467 associated with this annotation, the name of the annotation is followed
18468 immediately by a newline. If there is additional information, the name
18469 of the annotation is followed by a space, the additional information,
18470 and a newline. The additional information cannot contain newline
18473 Any output not beginning with a newline and two `control-z'
18474 characters denotes literal output from GDB. Currently there is no need
18475 for GDB to output a newline followed by two `control-z' characters, but
18476 if there was such a need, the annotations could be extended with an
18477 `escape' annotation which means those three characters as output.
18479 The annotation LEVEL, which is specified using the `--annotate'
18480 command line option (*note Mode Options::), controls how much
18481 information GDB prints together with its prompt, values of expressions,
18482 source lines, and other types of output. Level 0 is for no anntations,
18483 level 1 is for use when GDB is run as a subprocess of GNU Emacs, level
18484 3 is the maximum annotation suitable for programs that control GDB, and
18485 level 2 annotations have been made obsolete (*note Limitations of the
18486 Annotation Interface: (annotate)Limitations.).
18488 `set annotate LEVEL'
18489 The GDB command `set annotate' sets the level of annotations to
18490 the specified LEVEL.
18493 Show the current annotation level.
18495 This chapter describes level 3 annotations.
18497 A simple example of starting up GDB with annotations is:
18501 Copyright 2003 Free Software Foundation, Inc.
18502 GDB is free software, covered by the GNU General Public License,
18503 and you are welcome to change it and/or distribute copies of it
18504 under certain conditions.
18505 Type "show copying" to see the conditions.
18506 There is absolutely no warranty for GDB. Type "show warranty"
18508 This GDB was configured as "i386-pc-linux-gnu"
18518 Here `quit' is input to GDB; the rest is output from GDB. The three
18519 lines beginning `^Z^Z' (where `^Z' denotes a `control-z' character) are
18520 annotations; the rest is output from GDB.
18523 File: gdb.info, Node: Prompting, Next: Errors, Prev: Annotations Overview, Up: Annotations
18525 25.2 Annotation for GDB Input
18526 =============================
18528 When GDB prompts for input, it annotates this fact so it is possible to
18529 know when to send output, when the output from a given command is over,
18532 Different kinds of input each have a different "input type". Each
18533 input type has three annotations: a `pre-' annotation, which denotes
18534 the beginning of any prompt which is being output, a plain annotation,
18535 which denotes the end of the prompt, and then a `post-' annotation
18536 which denotes the end of any echo which may (or may not) be associated
18537 with the input. For example, the `prompt' input type features the
18538 following annotations:
18544 The input types are
18547 When GDB is prompting for a command (the main GDB prompt).
18550 When GDB prompts for a set of commands, like in the `commands'
18551 command. The annotations are repeated for each command which is
18555 When GDB wants the user to select between various overloaded
18559 When GDB wants the user to confirm a potentially dangerous
18562 `prompt-for-continue'
18563 When GDB is asking the user to press return to continue. Note:
18564 Don't expect this to work well; instead use `set height 0' to
18565 disable prompting. This is because the counting of lines is buggy
18566 in the presence of annotations.
18569 File: gdb.info, Node: Errors, Next: Invalidation, Prev: Prompting, Up: Annotations
18576 This annotation occurs right before GDB responds to an interrupt.
18580 This annotation occurs right before GDB responds to an error.
18582 Quit and error annotations indicate that any annotations which GDB
18583 was in the middle of may end abruptly. For example, if a
18584 `value-history-begin' annotation is followed by a `error', one cannot
18585 expect to receive the matching `value-history-end'. One cannot expect
18586 not to receive it either, however; an error annotation does not
18587 necessarily mean that GDB is immediately returning all the way to the
18590 A quit or error annotation may be preceded by
18594 Any output between that and the quit or error annotation is the error
18597 Warning messages are not yet annotated.
18600 File: gdb.info, Node: Invalidation, Next: Annotations for Running, Prev: Errors, Up: Annotations
18602 25.4 Invalidation Notices
18603 =========================
18605 The following annotations say that certain pieces of state may have
18608 `^Z^Zframes-invalid'
18609 The frames (for example, output from the `backtrace' command) may
18612 `^Z^Zbreakpoints-invalid'
18613 The breakpoints may have changed. For example, the user just
18614 added or deleted a breakpoint.
18617 File: gdb.info, Node: Annotations for Running, Next: Source Annotations, Prev: Invalidation, Up: Annotations
18619 25.5 Running the Program
18620 ========================
18622 When the program starts executing due to a GDB command such as `step'
18627 is output. When the program stops,
18631 is output. Before the `stopped' annotation, a variety of
18632 annotations describe how the program stopped.
18634 `^Z^Zexited EXIT-STATUS'
18635 The program exited, and EXIT-STATUS is the exit status (zero for
18636 successful exit, otherwise nonzero).
18639 The program exited with a signal. After the `^Z^Zsignalled', the
18640 annotation continues:
18645 ^Z^Zsignal-name-end
18649 ^Z^Zsignal-string-end
18652 where NAME is the name of the signal, such as `SIGILL' or
18653 `SIGSEGV', and STRING is the explanation of the signal, such as
18654 `Illegal Instruction' or `Segmentation fault'. INTRO-TEXT,
18655 MIDDLE-TEXT, and END-TEXT are for the user's benefit and have no
18659 The syntax of this annotation is just like `signalled', but GDB is
18660 just saying that the program received the signal, not that it was
18661 terminated with it.
18663 `^Z^Zbreakpoint NUMBER'
18664 The program hit breakpoint number NUMBER.
18666 `^Z^Zwatchpoint NUMBER'
18667 The program hit watchpoint number NUMBER.
18670 File: gdb.info, Node: Source Annotations, Prev: Annotations for Running, Up: Annotations
18672 25.6 Displaying Source
18673 ======================
18675 The following annotation is used instead of displaying source code:
18677 ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
18679 where FILENAME is an absolute file name indicating which source
18680 file, LINE is the line number within that file (where 1 is the first
18681 line in the file), CHARACTER is the character position within the file
18682 (where 0 is the first character in the file) (for most debug formats
18683 this will necessarily point to the beginning of a line), MIDDLE is
18684 `middle' if ADDR is in the middle of the line, or `beg' if ADDR is at
18685 the beginning of the line, and ADDR is the address in the target
18686 program associated with the source which is being displayed. ADDR is
18687 in the form `0x' followed by one or more lowercase hex digits (note
18688 that this does not depend on the language).
18691 File: gdb.info, Node: GDB Bugs, Next: Formatting Documentation, Prev: GDB/MI, Up: Top
18693 26 Reporting Bugs in GDB
18694 ************************
18696 Your bug reports play an essential role in making GDB reliable.
18698 Reporting a bug may help you by bringing a solution to your problem,
18699 or it may not. But in any case the principal function of a bug report
18700 is to help the entire community by making the next version of GDB work
18701 better. Bug reports are your contribution to the maintenance of GDB.
18703 In order for a bug report to serve its purpose, you must include the
18704 information that enables us to fix the bug.
18708 * Bug Criteria:: Have you found a bug?
18709 * Bug Reporting:: How to report bugs
18712 File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
18714 26.1 Have you found a bug?
18715 ==========================
18717 If you are not sure whether you have found a bug, here are some
18720 * If the debugger gets a fatal signal, for any input whatever, that
18721 is a GDB bug. Reliable debuggers never crash.
18723 * If GDB produces an error message for valid input, that is a bug.
18724 (Note that if you're cross debugging, the problem may also be
18725 somewhere in the connection to the target.)
18727 * If GDB does not produce an error message for invalid input, that
18728 is a bug. However, you should note that your idea of "invalid
18729 input" might be our idea of "an extension" or "support for
18730 traditional practice".
18732 * If you are an experienced user of debugging tools, your suggestions
18733 for improvement of GDB are welcome in any case.
18736 File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
18738 26.2 How to report bugs
18739 =======================
18741 A number of companies and individuals offer support for GNU products.
18742 If you obtained GDB from a support organization, we recommend you
18743 contact that organization first.
18745 You can find contact information for many support companies and
18746 individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
18748 In any event, we also recommend that you submit bug reports for GDB.
18749 The prefered method is to submit them directly using GDB's Bugs web
18750 page (http://www.gnu.org/software/gdb/bugs/). Alternatively, the
18751 e-mail gateway <bug-gdb@gnu.org> can be used.
18753 *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
18754 newsgroups.* Most users of GDB do not want to receive bug reports.
18755 Those that do have arranged to receive `bug-gdb'.
18757 The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
18758 serves as a repeater. The mailing list and the newsgroup carry exactly
18759 the same messages. Often people think of posting bug reports to the
18760 newsgroup instead of mailing them. This appears to work, but it has one
18761 problem which can be crucial: a newsgroup posting often lacks a mail
18762 path back to the sender. Thus, if we need to ask for more information,
18763 we may be unable to reach you. For this reason, it is better to send
18764 bug reports to the mailing list.
18766 The fundamental principle of reporting bugs usefully is this:
18767 *report all the facts*. If you are not sure whether to state a fact or
18768 leave it out, state it!
18770 Often people omit facts because they think they know what causes the
18771 problem and assume that some details do not matter. Thus, you might
18772 assume that the name of the variable you use in an example does not
18773 matter. Well, probably it does not, but one cannot be sure. Perhaps
18774 the bug is a stray memory reference which happens to fetch from the
18775 location where that name is stored in memory; perhaps, if the name were
18776 different, the contents of that location would fool the debugger into
18777 doing the right thing despite the bug. Play it safe and give a
18778 specific, complete example. That is the easiest thing for you to do,
18779 and the most helpful.
18781 Keep in mind that the purpose of a bug report is to enable us to fix
18782 the bug. It may be that the bug has been reported previously, but
18783 neither you nor we can know that unless your bug report is complete and
18786 Sometimes people give a few sketchy facts and ask, "Does this ring a
18787 bell?" Those bug reports are useless, and we urge everyone to _refuse
18788 to respond to them_ except to chide the sender to report bugs properly.
18790 To enable us to fix the bug, you should include all these things:
18792 * The version of GDB. GDB announces it if you start with no
18793 arguments; you can also print it at any time using `show version'.
18795 Without this, we will not know whether there is any point in
18796 looking for the bug in the current version of GDB.
18798 * The type of machine you are using, and the operating system name
18799 and version number.
18801 * What compiler (and its version) was used to compile GDB--e.g.
18804 * What compiler (and its version) was used to compile the program
18805 you are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP
18806 C Compiler". For GCC, you can say `gcc --version' to get this
18807 information; for other compilers, see the documentation for those
18810 * The command arguments you gave the compiler to compile your
18811 example and observe the bug. For example, did you use `-O'? To
18812 guarantee you will not omit something important, list them all. A
18813 copy of the Makefile (or the output from make) is sufficient.
18815 If we were to try to guess the arguments, we would probably guess
18816 wrong and then we might not encounter the bug.
18818 * A complete input script, and all necessary source files, that will
18821 * A description of what behavior you observe that you believe is
18822 incorrect. For example, "It gets a fatal signal."
18824 Of course, if the bug is that GDB gets a fatal signal, then we
18825 will certainly notice it. But if the bug is incorrect output, we
18826 might not notice unless it is glaringly wrong. You might as well
18827 not give us a chance to make a mistake.
18829 Even if the problem you experience is a fatal signal, you should
18830 still say so explicitly. Suppose something strange is going on,
18831 such as, your copy of GDB is out of synch, or you have encountered
18832 a bug in the C library on your system. (This has happened!) Your
18833 copy might crash and ours would not. If you told us to expect a
18834 crash, then when ours fails to crash, we would know that the bug
18835 was not happening for us. If you had not told us to expect a
18836 crash, then we would not be able to draw any conclusion from our
18839 To collect all this information, you can use a session recording
18840 program such as `script', which is available on many Unix systems.
18841 Just run your GDB session inside `script' and then include the
18842 `typescript' file with your bug report.
18844 Another way to record a GDB session is to run GDB inside Emacs and
18845 then save the entire buffer to a file.
18847 * If you wish to suggest changes to the GDB source, send us context
18848 diffs. If you even discuss something in the GDB source, refer to
18849 it by context, not by line number.
18851 The line numbers in our development sources will not match those
18852 in your sources. Your line numbers would convey no useful
18856 Here are some things that are not necessary:
18858 * A description of the envelope of the bug.
18860 Often people who encounter a bug spend a lot of time investigating
18861 which changes to the input file will make the bug go away and which
18862 changes will not affect it.
18864 This is often time consuming and not very useful, because the way
18865 we will find the bug is by running a single example under the
18866 debugger with breakpoints, not by pure deduction from a series of
18867 examples. We recommend that you save your time for something else.
18869 Of course, if you can find a simpler example to report _instead_
18870 of the original one, that is a convenience for us. Errors in the
18871 output will be easier to spot, running under the debugger will take
18872 less time, and so on.
18874 However, simplification is not vital; if you do not want to do
18875 this, report the bug anyway and send us the entire test case you
18878 * A patch for the bug.
18880 A patch for the bug does help us if it is a good one. But do not
18881 omit the necessary information, such as the test case, on the
18882 assumption that a patch is all we need. We might see problems
18883 with your patch and decide to fix the problem another way, or we
18884 might not understand it at all.
18886 Sometimes with a program as complicated as GDB it is very hard to
18887 construct an example that will make the program follow a certain
18888 path through the code. If you do not send us the example, we will
18889 not be able to construct one, so we will not be able to verify
18890 that the bug is fixed.
18892 And if we cannot understand what bug you are trying to fix, or why
18893 your patch should be an improvement, we will not install it. A
18894 test case will help us to understand.
18896 * A guess about what the bug is or what it depends on.
18898 Such guesses are usually wrong. Even we cannot guess right about
18899 such things without first using the debugger to find the facts.
18902 File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Formatting Documentation, Up: Top
18904 27 Command Line Editing
18905 ***********************
18907 This chapter describes the basic features of the GNU command line
18912 * Introduction and Notation:: Notation used in this text.
18913 * Readline Interaction:: The minimum set of commands for editing a line.
18914 * Readline Init File:: Customizing Readline from a user's view.
18915 * Bindable Readline Commands:: A description of most of the Readline commands
18916 available for binding
18917 * Readline vi Mode:: A short description of how to make Readline
18918 behave like the vi editor.
18921 File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
18923 27.1 Introduction to Line Editing
18924 =================================
18926 The following paragraphs describe the notation used to represent
18929 The text `C-k' is read as `Control-K' and describes the character
18930 produced when the <k> key is pressed while the Control key is depressed.
18932 The text `M-k' is read as `Meta-K' and describes the character
18933 produced when the Meta key (if you have one) is depressed, and the <k>
18934 key is pressed. The Meta key is labeled <ALT> on many keyboards. On
18935 keyboards with two keys labeled <ALT> (usually to either side of the
18936 space bar), the <ALT> on the left side is generally set to work as a
18937 Meta key. The <ALT> key on the right may also be configured to work as
18938 a Meta key or may be configured as some other modifier, such as a
18939 Compose key for typing accented characters.
18941 If you do not have a Meta or <ALT> key, or another key working as a
18942 Meta key, the identical keystroke can be generated by typing <ESC>
18943 _first_, and then typing <k>. Either process is known as "metafying"
18946 The text `M-C-k' is read as `Meta-Control-k' and describes the
18947 character produced by "metafying" `C-k'.
18949 In addition, several keys have their own names. Specifically,
18950 <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
18951 when seen in this text, or in an init file (*note Readline Init File::).
18952 If your keyboard lacks a <LFD> key, typing <C-j> will produce the
18953 desired character. The <RET> key may be labeled <Return> or <Enter> on
18957 File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
18959 27.2 Readline Interaction
18960 =========================
18962 Often during an interactive session you type in a long line of text,
18963 only to notice that the first word on the line is misspelled. The
18964 Readline library gives you a set of commands for manipulating the text
18965 as you type it in, allowing you to just fix your typo, and not forcing
18966 you to retype the majority of the line. Using these editing commands,
18967 you move the cursor to the place that needs correction, and delete or
18968 insert the text of the corrections. Then, when you are satisfied with
18969 the line, you simply press <RET>. You do not have to be at the end of
18970 the line to press <RET>; the entire line is accepted regardless of the
18971 location of the cursor within the line.
18975 * Readline Bare Essentials:: The least you need to know about Readline.
18976 * Readline Movement Commands:: Moving about the input line.
18977 * Readline Killing Commands:: How to delete text, and how to get it back!
18978 * Readline Arguments:: Giving numeric arguments to commands.
18979 * Searching:: Searching through previous lines.
18982 File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
18984 27.2.1 Readline Bare Essentials
18985 -------------------------------
18987 In order to enter characters into the line, simply type them. The typed
18988 character appears where the cursor was, and then the cursor moves one
18989 space to the right. If you mistype a character, you can use your erase
18990 character to back up and delete the mistyped character.
18992 Sometimes you may mistype a character, and not notice the error
18993 until you have typed several other characters. In that case, you can
18994 type `C-b' to move the cursor to the left, and then correct your
18995 mistake. Afterwards, you can move the cursor to the right with `C-f'.
18997 When you add text in the middle of a line, you will notice that
18998 characters to the right of the cursor are `pushed over' to make room
18999 for the text that you have inserted. Likewise, when you delete text
19000 behind the cursor, characters to the right of the cursor are `pulled
19001 back' to fill in the blank space created by the removal of the text. A
19002 list of the bare essentials for editing the text of an input line
19006 Move back one character.
19009 Move forward one character.
19011 <DEL> or <Backspace>
19012 Delete the character to the left of the cursor.
19015 Delete the character underneath the cursor.
19017 Printing characters
19018 Insert the character into the line at the cursor.
19021 Undo the last editing command. You can undo all the way back to an
19024 (Depending on your configuration, the <Backspace> key be set to delete
19025 the character to the left of the cursor and the <DEL> key set to delete
19026 the character underneath the cursor, like `C-d', rather than the
19027 character to the left of the cursor.)
19030 File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
19032 27.2.2 Readline Movement Commands
19033 ---------------------------------
19035 The above table describes the most basic keystrokes that you need in
19036 order to do editing of the input line. For your convenience, many
19037 other commands have been added in addition to `C-b', `C-f', `C-d', and
19038 <DEL>. Here are some commands for moving more rapidly about the line.
19041 Move to the start of the line.
19044 Move to the end of the line.
19047 Move forward a word, where a word is composed of letters and
19051 Move backward a word.
19054 Clear the screen, reprinting the current line at the top.
19056 Notice how `C-f' moves forward a character, while `M-f' moves
19057 forward a word. It is a loose convention that control keystrokes
19058 operate on characters while meta keystrokes operate on words.
19061 File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
19063 27.2.3 Readline Killing Commands
19064 --------------------------------
19066 "Killing" text means to delete the text from the line, but to save it
19067 away for later use, usually by "yanking" (re-inserting) it back into
19068 the line. (`Cut' and `paste' are more recent jargon for `kill' and
19071 If the description for a command says that it `kills' text, then you
19072 can be sure that you can get the text back in a different (or the same)
19075 When you use a kill command, the text is saved in a "kill-ring".
19076 Any number of consecutive kills save all of the killed text together, so
19077 that when you yank it back, you get it all. The kill ring is not line
19078 specific; the text that you killed on a previously typed line is
19079 available to be yanked back later, when you are typing another line.
19081 Here is the list of commands for killing text.
19084 Kill the text from the current cursor position to the end of the
19088 Kill from the cursor to the end of the current word, or, if between
19089 words, to the end of the next word. Word boundaries are the same
19090 as those used by `M-f'.
19093 Kill from the cursor the start of the current word, or, if between
19094 words, to the start of the previous word. Word boundaries are the
19095 same as those used by `M-b'.
19098 Kill from the cursor to the previous whitespace. This is
19099 different than `M-<DEL>' because the word boundaries differ.
19102 Here is how to "yank" the text back into the line. Yanking means to
19103 copy the most-recently-killed text from the kill buffer.
19106 Yank the most recently killed text back into the buffer at the
19110 Rotate the kill-ring, and yank the new top. You can only do this
19111 if the prior command is `C-y' or `M-y'.
19114 File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
19116 27.2.4 Readline Arguments
19117 -------------------------
19119 You can pass numeric arguments to Readline commands. Sometimes the
19120 argument acts as a repeat count, other times it is the sign of the
19121 argument that is significant. If you pass a negative argument to a
19122 command which normally acts in a forward direction, that command will
19123 act in a backward direction. For example, to kill text back to the
19124 start of the line, you might type `M-- C-k'.
19126 The general way to pass numeric arguments to a command is to type
19127 meta digits before the command. If the first `digit' typed is a minus
19128 sign (`-'), then the sign of the argument will be negative. Once you
19129 have typed one meta digit to get the argument started, you can type the
19130 remainder of the digits, and then the command. For example, to give
19131 the `C-d' command an argument of 10, you could type `M-1 0 C-d', which
19132 will delete the next ten characters on the input line.
19135 File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
19137 27.2.5 Searching for Commands in the History
19138 --------------------------------------------
19140 Readline provides commands for searching through the command history
19141 for lines containing a specified string. There are two search modes:
19142 "incremental" and "non-incremental".
19144 Incremental searches begin before the user has finished typing the
19145 search string. As each character of the search string is typed,
19146 Readline displays the next entry from the history matching the string
19147 typed so far. An incremental search requires only as many characters
19148 as needed to find the desired history entry. To search backward in the
19149 history for a particular string, type `C-r'. Typing `C-s' searches
19150 forward through the history. The characters present in the value of
19151 the `isearch-terminators' variable are used to terminate an incremental
19152 search. If that variable has not been assigned a value, the <ESC> and
19153 `C-J' characters will terminate an incremental search. `C-g' will
19154 abort an incremental search and restore the original line. When the
19155 search is terminated, the history entry containing the search string
19156 becomes the current line.
19158 To find other matching entries in the history list, type `C-r' or
19159 `C-s' as appropriate. This will search backward or forward in the
19160 history for the next entry matching the search string typed so far.
19161 Any other key sequence bound to a Readline command will terminate the
19162 search and execute that command. For instance, a <RET> will terminate
19163 the search and accept the line, thereby executing the command from the
19164 history list. A movement command will terminate the search, make the
19165 last line found the current line, and begin editing.
19167 Readline remembers the last incremental search string. If two
19168 `C-r's are typed without any intervening characters defining a new
19169 search string, any remembered search string is used.
19171 Non-incremental searches read the entire search string before
19172 starting to search for matching history lines. The search string may be
19173 typed by the user or be part of the contents of the current line.
19176 File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
19178 27.3 Readline Init File
19179 =======================
19181 Although the Readline library comes with a set of Emacs-like
19182 keybindings installed by default, it is possible to use a different set
19183 of keybindings. Any user can customize programs that use Readline by
19184 putting commands in an "inputrc" file, conventionally in his home
19185 directory. The name of this file is taken from the value of the
19186 environment variable `INPUTRC'. If that variable is unset, the default
19189 When a program which uses the Readline library starts up, the init
19190 file is read, and the key bindings are set.
19192 In addition, the `C-x C-r' command re-reads this init file, thus
19193 incorporating any changes that you might have made to it.
19197 * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
19199 * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
19201 * Sample Init File:: An example inputrc file.
19204 File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
19206 27.3.1 Readline Init File Syntax
19207 --------------------------------
19209 There are only a few basic constructs allowed in the Readline init
19210 file. Blank lines are ignored. Lines beginning with a `#' are
19211 comments. Lines beginning with a `$' indicate conditional constructs
19212 (*note Conditional Init Constructs::). Other lines denote variable
19213 settings and key bindings.
19216 You can modify the run-time behavior of Readline by altering the
19217 values of variables in Readline using the `set' command within the
19218 init file. The syntax is simple:
19222 Here, for example, is how to change from the default Emacs-like
19223 key binding to use `vi' line editing commands:
19225 set editing-mode vi
19227 Variable names and values, where appropriate, are recognized
19228 without regard to case. Unrecognized variable names are ignored.
19230 Boolean variables (those that can be set to on or off) are set to
19231 on if the value is null or empty, ON (case-insensitive), or 1.
19232 Any other value results in the variable being set to off.
19234 A great deal of run-time behavior is changeable with the following
19238 Controls what happens when Readline wants to ring the
19239 terminal bell. If set to `none', Readline never rings the
19240 bell. If set to `visible', Readline uses a visible bell if
19241 one is available. If set to `audible' (the default),
19242 Readline attempts to ring the terminal's bell.
19244 `bind-tty-special-chars'
19245 If set to `on', Readline attempts to bind the control
19246 characters treated specially by the kernel's terminal driver
19247 to their Readline equivalents.
19250 The string to insert at the beginning of the line when the
19251 `insert-comment' command is executed. The default value is
19254 `completion-ignore-case'
19255 If set to `on', Readline performs filename matching and
19256 completion in a case-insensitive fashion. The default value
19259 `completion-query-items'
19260 The number of possible completions that determines when the
19261 user is asked whether the list of possibilities should be
19262 displayed. If the number of possible completions is greater
19263 than this value, Readline will ask the user whether or not he
19264 wishes to view them; otherwise, they are simply listed. This
19265 variable must be set to an integer value greater than or
19266 equal to 0. A negative value means Readline should never ask.
19267 The default limit is `100'.
19270 If set to `on', Readline will convert characters with the
19271 eighth bit set to an ASCII key sequence by stripping the
19272 eighth bit and prefixing an <ESC> character, converting them
19273 to a meta-prefixed key sequence. The default value is `on'.
19275 `disable-completion'
19276 If set to `On', Readline will inhibit word completion.
19277 Completion characters will be inserted into the line as if
19278 they had been mapped to `self-insert'. The default is `off'.
19281 The `editing-mode' variable controls which default set of key
19282 bindings is used. By default, Readline starts up in Emacs
19283 editing mode, where the keystrokes are most similar to Emacs.
19284 This variable can be set to either `emacs' or `vi'.
19287 When set to `on', Readline will try to enable the application
19288 keypad when it is called. Some systems need this to enable
19289 the arrow keys. The default is `off'.
19292 If set to `on', tilde expansion is performed when Readline
19293 attempts word completion. The default is `off'.
19295 `history-preserve-point'
19296 If set to `on', the history code attempts to place point at
19297 the same location on each history line retrieved with
19298 `previous-history' or `next-history'. The default is `off'.
19300 `horizontal-scroll-mode'
19301 This variable can be set to either `on' or `off'. Setting it
19302 to `on' means that the text of the lines being edited will
19303 scroll horizontally on a single screen line when they are
19304 longer than the width of the screen, instead of wrapping onto
19305 a new screen line. By default, this variable is set to `off'.
19308 If set to `on', Readline will enable eight-bit input (it will
19309 not clear the eighth bit in the characters it reads),
19310 regardless of what the terminal claims it can support. The
19311 default value is `off'. The name `meta-flag' is a synonym
19314 `isearch-terminators'
19315 The string of characters that should terminate an incremental
19316 search without subsequently executing the character as a
19317 command (*note Searching::). If this variable has not been
19318 given a value, the characters <ESC> and `C-J' will terminate
19319 an incremental search.
19322 Sets Readline's idea of the current keymap for key binding
19323 commands. Acceptable `keymap' names are `emacs',
19324 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
19325 `vi-command', and `vi-insert'. `vi' is equivalent to
19326 `vi-command'; `emacs' is equivalent to `emacs-standard'. The
19327 default value is `emacs'. The value of the `editing-mode'
19328 variable also affects the default keymap.
19331 If set to `on', completed directory names have a slash
19332 appended. The default is `on'.
19334 `mark-modified-lines'
19335 This variable, when set to `on', causes Readline to display an
19336 asterisk (`*') at the start of history lines which have been
19337 modified. This variable is `off' by default.
19339 `mark-symlinked-directories'
19340 If set to `on', completed names which are symbolic links to
19341 directories have a slash appended (subject to the value of
19342 `mark-directories'). The default is `off'.
19344 `match-hidden-files'
19345 This variable, when set to `on', causes Readline to match
19346 files whose names begin with a `.' (hidden files) when
19347 performing filename completion, unless the leading `.' is
19348 supplied by the user in the filename to be completed. This
19349 variable is `on' by default.
19352 If set to `on', Readline will display characters with the
19353 eighth bit set directly rather than as a meta-prefixed escape
19354 sequence. The default is `off'.
19357 If set to `on', Readline uses an internal `more'-like pager
19358 to display a screenful of possible completions at a time.
19359 This variable is `on' by default.
19361 `print-completions-horizontally'
19362 If set to `on', Readline will display completions with matches
19363 sorted horizontally in alphabetical order, rather than down
19364 the screen. The default is `off'.
19366 `show-all-if-ambiguous'
19367 This alters the default behavior of the completion functions.
19368 If set to `on', words which have more than one possible
19369 completion cause the matches to be listed immediately instead
19370 of ringing the bell. The default value is `off'.
19372 `show-all-if-unmodified'
19373 This alters the default behavior of the completion functions
19374 in a fashion similar to SHOW-ALL-IF-AMBIGUOUS. If set to
19375 `on', words which have more than one possible completion
19376 without any possible partial completion (the possible
19377 completions don't share a common prefix) cause the matches to
19378 be listed immediately instead of ringing the bell. The
19379 default value is `off'.
19382 If set to `on', a character denoting a file's type is
19383 appended to the filename when listing possible completions.
19384 The default is `off'.
19388 The syntax for controlling key bindings in the init file is
19389 simple. First you need to find the name of the command that you
19390 want to change. The following sections contain tables of the
19391 command name, the default keybinding, if any, and a short
19392 description of what the command does.
19394 Once you know the name of the command, simply place on a line in
19395 the init file the name of the key you wish to bind the command to,
19396 a colon, and then the name of the command. The name of the key
19397 can be expressed in different ways, depending on what you find most
19400 In addition to command names, readline allows keys to be bound to
19401 a string that is inserted when the key is pressed (a MACRO).
19403 KEYNAME: FUNCTION-NAME or MACRO
19404 KEYNAME is the name of a key spelled out in English. For
19406 Control-u: universal-argument
19407 Meta-Rubout: backward-kill-word
19408 Control-o: "> output"
19410 In the above example, `C-u' is bound to the function
19411 `universal-argument', `M-DEL' is bound to the function
19412 `backward-kill-word', and `C-o' is bound to run the macro
19413 expressed on the right hand side (that is, to insert the text
19414 `> output' into the line).
19416 A number of symbolic character names are recognized while
19417 processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
19418 NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
19420 "KEYSEQ": FUNCTION-NAME or MACRO
19421 KEYSEQ differs from KEYNAME above in that strings denoting an
19422 entire key sequence can be specified, by placing the key
19423 sequence in double quotes. Some GNU Emacs style key escapes
19424 can be used, as in the following example, but the special
19425 character names are not recognized.
19427 "\C-u": universal-argument
19428 "\C-x\C-r": re-read-init-file
19429 "\e[11~": "Function Key 1"
19431 In the above example, `C-u' is again bound to the function
19432 `universal-argument' (just as it was in the first example),
19433 `C-x C-r' is bound to the function `re-read-init-file', and
19434 `<ESC> <[> <1> <1> <~>' is bound to insert the text `Function
19438 The following GNU Emacs style escape sequences are available when
19439 specifying key sequences:
19448 an escape character
19454 <">, a double quotation mark
19457 <'>, a single quote or apostrophe
19459 In addition to the GNU Emacs style escape sequences, a second set
19460 of backslash escapes is available:
19487 the eight-bit character whose value is the octal value NNN
19488 (one to three digits)
19491 the eight-bit character whose value is the hexadecimal value
19492 HH (one or two hex digits)
19494 When entering the text of a macro, single or double quotes must be
19495 used to indicate a macro definition. Unquoted text is assumed to
19496 be a function name. In the macro body, the backslash escapes
19497 described above are expanded. Backslash will quote any other
19498 character in the macro text, including `"' and `''. For example,
19499 the following binding will make `C-x \' insert a single `\' into
19505 File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
19507 27.3.2 Conditional Init Constructs
19508 ----------------------------------
19510 Readline implements a facility similar in spirit to the conditional
19511 compilation features of the C preprocessor which allows key bindings
19512 and variable settings to be performed as the result of tests. There
19513 are four parser directives used.
19516 The `$if' construct allows bindings to be made based on the
19517 editing mode, the terminal being used, or the application using
19518 Readline. The text of the test extends to the end of the line; no
19519 characters are required to isolate it.
19522 The `mode=' form of the `$if' directive is used to test
19523 whether Readline is in `emacs' or `vi' mode. This may be
19524 used in conjunction with the `set keymap' command, for
19525 instance, to set bindings in the `emacs-standard' and
19526 `emacs-ctlx' keymaps only if Readline is starting out in
19530 The `term=' form may be used to include terminal-specific key
19531 bindings, perhaps to bind the key sequences output by the
19532 terminal's function keys. The word on the right side of the
19533 `=' is tested against both the full name of the terminal and
19534 the portion of the terminal name before the first `-'. This
19535 allows `sun' to match both `sun' and `sun-cmd', for instance.
19538 The APPLICATION construct is used to include
19539 application-specific settings. Each program using the
19540 Readline library sets the APPLICATION NAME, and you can test
19541 for a particular value. This could be used to bind key
19542 sequences to functions useful for a specific program. For
19543 instance, the following command adds a key sequence that
19544 quotes the current or previous word in Bash:
19546 # Quote the current or previous word
19547 "\C-xq": "\eb\"\ef\""
19551 This command, as seen in the previous example, terminates an `$if'
19555 Commands in this branch of the `$if' directive are executed if the
19559 This directive takes a single filename as an argument and reads
19560 commands and bindings from that file. For example, the following
19561 directive reads from `/etc/inputrc':
19562 $include /etc/inputrc
19565 File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
19567 27.3.3 Sample Init File
19568 -----------------------
19570 Here is an example of an INPUTRC file. This illustrates key binding,
19571 variable assignment, and conditional syntax.
19574 # This file controls the behaviour of line input editing for
19575 # programs that use the GNU Readline library. Existing
19576 # programs include FTP, Bash, and GDB.
19578 # You can re-read the inputrc file with C-x C-r.
19579 # Lines beginning with '#' are comments.
19581 # First, include any systemwide bindings and variable
19582 # assignments from /etc/Inputrc
19583 $include /etc/Inputrc
19586 # Set various bindings for emacs mode.
19588 set editing-mode emacs
19592 Meta-Control-h: backward-kill-word Text after the function name is ignored
19595 # Arrow keys in keypad mode
19597 #"\M-OD": backward-char
19598 #"\M-OC": forward-char
19599 #"\M-OA": previous-history
19600 #"\M-OB": next-history
19602 # Arrow keys in ANSI mode
19604 "\M-[D": backward-char
19605 "\M-[C": forward-char
19606 "\M-[A": previous-history
19607 "\M-[B": next-history
19609 # Arrow keys in 8 bit keypad mode
19611 #"\M-\C-OD": backward-char
19612 #"\M-\C-OC": forward-char
19613 #"\M-\C-OA": previous-history
19614 #"\M-\C-OB": next-history
19616 # Arrow keys in 8 bit ANSI mode
19618 #"\M-\C-[D": backward-char
19619 #"\M-\C-[C": forward-char
19620 #"\M-\C-[A": previous-history
19621 #"\M-\C-[B": next-history
19627 # An old-style binding. This happens to be the default.
19630 # Macros that are convenient for shell interaction
19633 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
19634 # prepare to type a quoted word --
19635 # insert open and close double quotes
19636 # and move to just after the open quote
19637 "\C-x\"": "\"\"\C-b"
19638 # insert a backslash (testing backslash escapes
19639 # in sequences and macros)
19641 # Quote the current or previous word
19642 "\C-xq": "\eb\"\ef\""
19643 # Add a binding to refresh the line, which is unbound
19644 "\C-xr": redraw-current-line
19645 # Edit variable on current line.
19646 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
19649 # use a visible bell if one is available
19650 set bell-style visible
19652 # don't strip characters to 7 bits when reading
19655 # allow iso-latin1 characters to be inserted rather
19656 # than converted to prefix-meta sequences
19657 set convert-meta off
19659 # display characters with the eighth bit set directly
19660 # rather than as meta-prefixed characters
19663 # if there are more than 150 possible completions for
19664 # a word, ask the user if he wants to see all of them
19665 set completion-query-items 150
19669 "\C-xg": "get \M-?"
19670 "\C-xt": "put \M-?"
19671 "\M-.": yank-last-arg
19675 File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
19677 27.4 Bindable Readline Commands
19678 ===============================
19682 * Commands For Moving:: Moving about the line.
19683 * Commands For History:: Getting at previous lines.
19684 * Commands For Text:: Commands for changing text.
19685 * Commands For Killing:: Commands for killing and yanking.
19686 * Numeric Arguments:: Specifying numeric arguments, repeat counts.
19687 * Commands For Completion:: Getting Readline to do the typing for you.
19688 * Keyboard Macros:: Saving and re-executing typed characters
19689 * Miscellaneous Commands:: Other miscellaneous commands.
19691 This section describes Readline commands that may be bound to key
19692 sequences. Command names without an accompanying key sequence are
19693 unbound by default.
19695 In the following descriptions, "point" refers to the current cursor
19696 position, and "mark" refers to a cursor position saved by the
19697 `set-mark' command. The text between the point and mark is referred to
19701 File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
19703 27.4.1 Commands For Moving
19704 --------------------------
19706 `beginning-of-line (C-a)'
19707 Move to the start of the current line.
19709 `end-of-line (C-e)'
19710 Move to the end of the line.
19712 `forward-char (C-f)'
19713 Move forward a character.
19715 `backward-char (C-b)'
19716 Move back a character.
19718 `forward-word (M-f)'
19719 Move forward to the end of the next word. Words are composed of
19720 letters and digits.
19722 `backward-word (M-b)'
19723 Move back to the start of the current or previous word. Words are
19724 composed of letters and digits.
19726 `clear-screen (C-l)'
19727 Clear the screen and redraw the current line, leaving the current
19728 line at the top of the screen.
19730 `redraw-current-line ()'
19731 Refresh the current line. By default, this is unbound.
19735 File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
19737 27.4.2 Commands For Manipulating The History
19738 --------------------------------------------
19740 `accept-line (Newline or Return)'
19741 Accept the line regardless of where the cursor is. If this line is
19742 non-empty, it may be added to the history list for future recall
19743 with `add_history()'. If this line is a modified history line,
19744 the history line is restored to its original state.
19746 `previous-history (C-p)'
19747 Move `back' through the history list, fetching the previous
19750 `next-history (C-n)'
19751 Move `forward' through the history list, fetching the next command.
19753 `beginning-of-history (M-<)'
19754 Move to the first line in the history.
19756 `end-of-history (M->)'
19757 Move to the end of the input history, i.e., the line currently
19760 `reverse-search-history (C-r)'
19761 Search backward starting at the current line and moving `up'
19762 through the history as necessary. This is an incremental search.
19764 `forward-search-history (C-s)'
19765 Search forward starting at the current line and moving `down'
19766 through the the history as necessary. This is an incremental
19769 `non-incremental-reverse-search-history (M-p)'
19770 Search backward starting at the current line and moving `up'
19771 through the history as necessary using a non-incremental search
19772 for a string supplied by the user.
19774 `non-incremental-forward-search-history (M-n)'
19775 Search forward starting at the current line and moving `down'
19776 through the the history as necessary using a non-incremental search
19777 for a string supplied by the user.
19779 `history-search-forward ()'
19780 Search forward through the history for the string of characters
19781 between the start of the current line and the point. This is a
19782 non-incremental search. By default, this command is unbound.
19784 `history-search-backward ()'
19785 Search backward through the history for the string of characters
19786 between the start of the current line and the point. This is a
19787 non-incremental search. By default, this command is unbound.
19789 `yank-nth-arg (M-C-y)'
19790 Insert the first argument to the previous command (usually the
19791 second word on the previous line) at point. With an argument N,
19792 insert the Nth word from the previous command (the words in the
19793 previous command begin with word 0). A negative argument inserts
19794 the Nth word from the end of the previous command. Once the
19795 argument N is computed, the argument is extracted as if the `!N'
19796 history expansion had been specified.
19798 `yank-last-arg (M-. or M-_)'
19799 Insert last argument to the previous command (the last word of the
19800 previous history entry). With an argument, behave exactly like
19801 `yank-nth-arg'. Successive calls to `yank-last-arg' move back
19802 through the history list, inserting the last argument of each line
19803 in turn. The history expansion facilities are used to extract the
19804 last argument, as if the `!$' history expansion had been specified.
19808 File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
19810 27.4.3 Commands For Changing Text
19811 ---------------------------------
19813 `delete-char (C-d)'
19814 Delete the character at point. If point is at the beginning of
19815 the line, there are no characters in the line, and the last
19816 character typed was not bound to `delete-char', then return EOF.
19818 `backward-delete-char (Rubout)'
19819 Delete the character behind the cursor. A numeric argument means
19820 to kill the characters instead of deleting them.
19822 `forward-backward-delete-char ()'
19823 Delete the character under the cursor, unless the cursor is at the
19824 end of the line, in which case the character behind the cursor is
19825 deleted. By default, this is not bound to a key.
19827 `quoted-insert (C-q or C-v)'
19828 Add the next character typed to the line verbatim. This is how to
19829 insert key sequences like `C-q', for example.
19831 `tab-insert (M-<TAB>)'
19832 Insert a tab character.
19834 `self-insert (a, b, A, 1, !, ...)'
19837 `transpose-chars (C-t)'
19838 Drag the character before the cursor forward over the character at
19839 the cursor, moving the cursor forward as well. If the insertion
19840 point is at the end of the line, then this transposes the last two
19841 characters of the line. Negative arguments have no effect.
19843 `transpose-words (M-t)'
19844 Drag the word before point past the word after point, moving point
19845 past that word as well. If the insertion point is at the end of
19846 the line, this transposes the last two words on the line.
19848 `upcase-word (M-u)'
19849 Uppercase the current (or following) word. With a negative
19850 argument, uppercase the previous word, but do not move the cursor.
19852 `downcase-word (M-l)'
19853 Lowercase the current (or following) word. With a negative
19854 argument, lowercase the previous word, but do not move the cursor.
19856 `capitalize-word (M-c)'
19857 Capitalize the current (or following) word. With a negative
19858 argument, capitalize the previous word, but do not move the cursor.
19860 `overwrite-mode ()'
19861 Toggle overwrite mode. With an explicit positive numeric argument,
19862 switches to overwrite mode. With an explicit non-positive numeric
19863 argument, switches to insert mode. This command affects only
19864 `emacs' mode; `vi' mode does overwrite differently. Each call to
19865 `readline()' starts in insert mode.
19867 In overwrite mode, characters bound to `self-insert' replace the
19868 text at point rather than pushing the text to the right.
19869 Characters bound to `backward-delete-char' replace the character
19870 before point with a space.
19872 By default, this command is unbound.
19876 File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
19878 27.4.4 Killing And Yanking
19879 --------------------------
19882 Kill the text from point to the end of the line.
19884 `backward-kill-line (C-x Rubout)'
19885 Kill backward to the beginning of the line.
19887 `unix-line-discard (C-u)'
19888 Kill backward from the cursor to the beginning of the current line.
19890 `kill-whole-line ()'
19891 Kill all characters on the current line, no matter where point is.
19892 By default, this is unbound.
19895 Kill from point to the end of the current word, or if between
19896 words, to the end of the next word. Word boundaries are the same
19899 `backward-kill-word (M-<DEL>)'
19900 Kill the word behind point. Word boundaries are the same as
19903 `unix-word-rubout (C-w)'
19904 Kill the word behind point, using white space as a word boundary.
19905 The killed text is saved on the kill-ring.
19907 `unix-filename-rubout ()'
19908 Kill the word behind point, using white space and the slash
19909 character as the word boundaries. The killed text is saved on the
19912 `delete-horizontal-space ()'
19913 Delete all spaces and tabs around point. By default, this is
19917 Kill the text in the current region. By default, this command is
19920 `copy-region-as-kill ()'
19921 Copy the text in the region to the kill buffer, so it can be yanked
19922 right away. By default, this command is unbound.
19924 `copy-backward-word ()'
19925 Copy the word before point to the kill buffer. The word
19926 boundaries are the same as `backward-word'. By default, this
19927 command is unbound.
19929 `copy-forward-word ()'
19930 Copy the word following point to the kill buffer. The word
19931 boundaries are the same as `forward-word'. By default, this
19932 command is unbound.
19935 Yank the top of the kill ring into the buffer at point.
19938 Rotate the kill-ring, and yank the new top. You can only do this
19939 if the prior command is `yank' or `yank-pop'.
19942 File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
19944 27.4.5 Specifying Numeric Arguments
19945 -----------------------------------
19947 `digit-argument (M-0, M-1, ... M--)'
19948 Add this digit to the argument already accumulating, or start a new
19949 argument. `M--' starts a negative argument.
19951 `universal-argument ()'
19952 This is another way to specify an argument. If this command is
19953 followed by one or more digits, optionally with a leading minus
19954 sign, those digits define the argument. If the command is
19955 followed by digits, executing `universal-argument' again ends the
19956 numeric argument, but is otherwise ignored. As a special case, if
19957 this command is immediately followed by a character that is
19958 neither a digit or minus sign, the argument count for the next
19959 command is multiplied by four. The argument count is initially
19960 one, so executing this function the first time makes the argument
19961 count four, a second time makes the argument count sixteen, and so
19962 on. By default, this is not bound to a key.
19965 File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
19967 27.4.6 Letting Readline Type For You
19968 ------------------------------------
19971 Attempt to perform completion on the text before point. The
19972 actual completion performed is application-specific. The default
19973 is filename completion.
19975 `possible-completions (M-?)'
19976 List the possible completions of the text before point.
19978 `insert-completions (M-*)'
19979 Insert all completions of the text before point that would have
19980 been generated by `possible-completions'.
19983 Similar to `complete', but replaces the word to be completed with
19984 a single match from the list of possible completions. Repeated
19985 execution of `menu-complete' steps through the list of possible
19986 completions, inserting each match in turn. At the end of the list
19987 of completions, the bell is rung (subject to the setting of
19988 `bell-style') and the original text is restored. An argument of N
19989 moves N positions forward in the list of matches; a negative
19990 argument may be used to move backward through the list. This
19991 command is intended to be bound to <TAB>, but is unbound by
19994 `delete-char-or-list ()'
19995 Deletes the character under the cursor if not at the beginning or
19996 end of the line (like `delete-char'). If at the end of the line,
19997 behaves identically to `possible-completions'. This command is
19998 unbound by default.
20002 File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
20004 27.4.7 Keyboard Macros
20005 ----------------------
20007 `start-kbd-macro (C-x ()'
20008 Begin saving the characters typed into the current keyboard macro.
20010 `end-kbd-macro (C-x ))'
20011 Stop saving the characters typed into the current keyboard macro
20012 and save the definition.
20014 `call-last-kbd-macro (C-x e)'
20015 Re-execute the last keyboard macro defined, by making the
20016 characters in the macro appear as if typed at the keyboard.
20020 File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
20022 27.4.8 Some Miscellaneous Commands
20023 ----------------------------------
20025 `re-read-init-file (C-x C-r)'
20026 Read in the contents of the INPUTRC file, and incorporate any
20027 bindings or variable assignments found there.
20030 Abort the current editing command and ring the terminal's bell
20031 (subject to the setting of `bell-style').
20033 `do-uppercase-version (M-a, M-b, M-X, ...)'
20034 If the metafied character X is lowercase, run the command that is
20035 bound to the corresponding uppercase character.
20037 `prefix-meta (<ESC>)'
20038 Metafy the next character typed. This is for keyboards without a
20039 meta key. Typing `<ESC> f' is equivalent to typing `M-f'.
20041 `undo (C-_ or C-x C-u)'
20042 Incremental undo, separately remembered for each line.
20044 `revert-line (M-r)'
20045 Undo all changes made to this line. This is like executing the
20046 `undo' command enough times to get back to the beginning.
20048 `tilde-expand (M-~)'
20049 Perform tilde expansion on the current word.
20052 Set the mark to the point. If a numeric argument is supplied, the
20053 mark is set to that position.
20055 `exchange-point-and-mark (C-x C-x)'
20056 Swap the point with the mark. The current cursor position is set
20057 to the saved position, and the old cursor position is saved as the
20060 `character-search (C-])'
20061 A character is read and point is moved to the next occurrence of
20062 that character. A negative count searches for previous
20065 `character-search-backward (M-C-])'
20066 A character is read and point is moved to the previous occurrence
20067 of that character. A negative count searches for subsequent
20070 `insert-comment (M-#)'
20071 Without a numeric argument, the value of the `comment-begin'
20072 variable is inserted at the beginning of the current line. If a
20073 numeric argument is supplied, this command acts as a toggle: if
20074 the characters at the beginning of the line do not match the value
20075 of `comment-begin', the value is inserted, otherwise the
20076 characters in `comment-begin' are deleted from the beginning of
20077 the line. In either case, the line is accepted as if a newline
20080 `dump-functions ()'
20081 Print all of the functions and their key bindings to the Readline
20082 output stream. If a numeric argument is supplied, the output is
20083 formatted in such a way that it can be made part of an INPUTRC
20084 file. This command is unbound by default.
20086 `dump-variables ()'
20087 Print all of the settable variables and their values to the
20088 Readline output stream. If a numeric argument is supplied, the
20089 output is formatted in such a way that it can be made part of an
20090 INPUTRC file. This command is unbound by default.
20093 Print all of the Readline key sequences bound to macros and the
20094 strings they output. If a numeric argument is supplied, the
20095 output is formatted in such a way that it can be made part of an
20096 INPUTRC file. This command is unbound by default.
20098 `emacs-editing-mode (C-e)'
20099 When in `vi' command mode, this causes a switch to `emacs' editing
20102 `vi-editing-mode (M-C-j)'
20103 When in `emacs' editing mode, this causes a switch to `vi' editing
20108 File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
20110 27.5 Readline vi Mode
20111 =====================
20113 While the Readline library does not have a full set of `vi' editing
20114 functions, it does contain enough to allow simple editing of the line.
20115 The Readline `vi' mode behaves as specified in the POSIX 1003.2
20118 In order to switch interactively between `emacs' and `vi' editing
20119 modes, use the command `M-C-j' (bound to emacs-editing-mode when in
20120 `vi' mode and to vi-editing-mode in `emacs' mode). The Readline
20121 default is `emacs' mode.
20123 When you enter a line in `vi' mode, you are already placed in
20124 `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches
20125 you into `command' mode, where you can edit the text of the line with
20126 the standard `vi' movement keys, move to previous history lines with
20127 `k' and subsequent lines with `j', and so forth.
20130 File: gdb.info, Node: Using History Interactively, Next: Installing GDB, Prev: Command Line Editing, Up: Top
20132 28 Using History Interactively
20133 ******************************
20135 This chapter describes how to use the GNU History Library interactively,
20136 from a user's standpoint. It should be considered a user's guide. For
20137 information on using the GNU History Library in other programs, see the
20138 GNU Readline Library Manual.
20142 * History Interaction:: What it feels like using History as a user.
20145 File: gdb.info, Node: History Interaction, Up: Using History Interactively
20147 28.1 History Expansion
20148 ======================
20150 The History library provides a history expansion feature that is similar
20151 to the history expansion provided by `csh'. This section describes the
20152 syntax used to manipulate the history information.
20154 History expansions introduce words from the history list into the
20155 input stream, making it easy to repeat commands, insert the arguments
20156 to a previous command into the current input line, or fix errors in
20157 previous commands quickly.
20159 History expansion takes place in two parts. The first is to
20160 determine which line from the history list should be used during
20161 substitution. The second is to select portions of that line for
20162 inclusion into the current one. The line selected from the history is
20163 called the "event", and the portions of that line that are acted upon
20164 are called "words". Various "modifiers" are available to manipulate
20165 the selected words. The line is broken into words in the same fashion
20166 that Bash does, so that several words surrounded by quotes are
20167 considered one word. History expansions are introduced by the
20168 appearance of the history expansion character, which is `!' by default.
20172 * Event Designators:: How to specify which history line to use.
20173 * Word Designators:: Specifying which words are of interest.
20174 * Modifiers:: Modifying the results of substitution.
20177 File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
20179 28.1.1 Event Designators
20180 ------------------------
20182 An event designator is a reference to a command line entry in the
20186 Start a history substitution, except when followed by a space, tab,
20187 the end of the line, or `='.
20190 Refer to command line N.
20193 Refer to the command N lines back.
20196 Refer to the previous command. This is a synonym for `!-1'.
20199 Refer to the most recent command starting with STRING.
20202 Refer to the most recent command containing STRING. The trailing
20203 `?' may be omitted if the STRING is followed immediately by a
20206 `^STRING1^STRING2^'
20207 Quick Substitution. Repeat the last command, replacing STRING1
20208 with STRING2. Equivalent to `!!:s/STRING1/STRING2/'.
20211 The entire command line typed so far.
20215 File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
20217 28.1.2 Word Designators
20218 -----------------------
20220 Word designators are used to select desired words from the event. A
20221 `:' separates the event specification from the word designator. It may
20222 be omitted if the word designator begins with a `^', `$', `*', `-', or
20223 `%'. Words are numbered from the beginning of the line, with the first
20224 word being denoted by 0 (zero). Words are inserted into the current
20225 line separated by single spaces.
20230 designates the preceding command. When you type this, the
20231 preceding command is repeated in toto.
20234 designates the last argument of the preceding command. This may be
20238 designates the second argument of the most recent command starting
20239 with the letters `fi'.
20241 Here are the word designators:
20244 The `0'th word. For many applications, this is the command word.
20250 The first argument; that is, word 1.
20256 The word matched by the most recent `?STRING?' search.
20259 A range of words; `-Y' abbreviates `0-Y'.
20262 All of the words, except the `0'th. This is a synonym for `1-$'.
20263 It is not an error to use `*' if there is just one word in the
20264 event; the empty string is returned in that case.
20270 Abbreviates `X-$' like `X*', but omits the last word.
20273 If a word designator is supplied without an event specification, the
20274 previous command is used as the event.
20277 File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
20282 After the optional word designator, you can add a sequence of one or
20283 more of the following modifiers, each preceded by a `:'.
20286 Remove a trailing pathname component, leaving only the head.
20289 Remove all leading pathname components, leaving the tail.
20292 Remove a trailing suffix of the form `.SUFFIX', leaving the
20296 Remove all but the trailing suffix.
20299 Print the new command but do not execute it.
20302 Substitute NEW for the first occurrence of OLD in the event line.
20303 Any delimiter may be used in place of `/'. The delimiter may be
20304 quoted in OLD and NEW with a single backslash. If `&' appears in
20305 NEW, it is replaced by OLD. A single backslash will quote the
20306 `&'. The final delimiter is optional if it is the last character
20310 Repeat the previous substitution.
20314 Cause changes to be applied over the entire event line. Used in
20315 conjunction with `s', as in `gs/OLD/NEW/', or with `&'.
20318 Apply the following `s' modifier once to each word in the event.
20322 File: gdb.info, Node: Formatting Documentation, Next: Command Line Editing, Prev: GDB Bugs, Up: Top
20324 Appendix A Formatting Documentation
20325 ***********************************
20327 The GDB 4 release includes an already-formatted reference card, ready
20328 for printing with PostScript or Ghostscript, in the `gdb' subdirectory
20329 of the main source directory(1). If you can use PostScript or
20330 Ghostscript with your printer, you can print the reference card
20331 immediately with `refcard.ps'.
20333 The release also includes the source for the reference card. You
20334 can format it, using TeX, by typing:
20338 The GDB reference card is designed to print in "landscape" mode on
20339 US "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
20340 high. You will need to specify this form of printing as an option to
20341 your DVI output program.
20343 All the documentation for GDB comes as part of the machine-readable
20344 distribution. The documentation is written in Texinfo format, which is
20345 a documentation system that uses a single source file to produce both
20346 on-line information and a printed manual. You can use one of the Info
20347 formatting commands to create the on-line version of the documentation
20348 and TeX (or `texi2roff') to typeset the printed version.
20350 GDB includes an already formatted copy of the on-line Info version
20351 of this manual in the `gdb' subdirectory. The main Info file is
20352 `gdb-6.6/gdb/gdb.info', and it refers to subordinate files matching
20353 `gdb.info*' in the same directory. If necessary, you can print out
20354 these files, or read them with any editor; but they are easier to read
20355 using the `info' subsystem in GNU Emacs or the standalone `info'
20356 program, available as part of the GNU Texinfo distribution.
20358 If you want to format these Info files yourself, you need one of the
20359 Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
20361 If you have `makeinfo' installed, and are in the top level GDB
20362 source directory (`gdb-6.6', in the case of version 6.6), you can make
20363 the Info file by typing:
20368 If you want to typeset and print copies of this manual, you need TeX,
20369 a program to print its DVI output files, and `texinfo.tex', the Texinfo
20372 TeX is a typesetting program; it does not print files directly, but
20373 produces output files called DVI files. To print a typeset document,
20374 you need a program to print DVI files. If your system has TeX
20375 installed, chances are it has such a program. The precise command to
20376 use depends on your system; `lpr -d' is common; another (for PostScript
20377 devices) is `dvips'. The DVI print command may require a file name
20378 without any extension or a `.dvi' extension.
20380 TeX also requires a macro definitions file called `texinfo.tex'.
20381 This file tells TeX how to typeset a document written in Texinfo
20382 format. On its own, TeX cannot either read or typeset a Texinfo file.
20383 `texinfo.tex' is distributed with GDB and is located in the
20384 `gdb-VERSION-NUMBER/texinfo' directory.
20386 If you have TeX and a DVI printer program installed, you can typeset
20387 and print this manual. First switch to the the `gdb' subdirectory of
20388 the main source directory (for example, to `gdb-6.6/gdb') and type:
20392 Then give `gdb.dvi' to your DVI printing program.
20394 ---------- Footnotes ----------
20396 (1) In `gdb-6.6/gdb/refcard.ps' of the version 6.6 release.
20399 File: gdb.info, Node: Installing GDB, Next: Maintenance Commands, Prev: Using History Interactively, Up: Top
20401 Appendix B Installing GDB
20402 *************************
20406 * Requirements:: Requirements for building GDB
20407 * Running Configure:: Invoking the GDB `configure' script
20408 * Separate Objdir:: Compiling GDB in another directory
20409 * Config Names:: Specifying names for hosts and targets
20410 * Configure Options:: Summary of options for configure
20413 File: gdb.info, Node: Requirements, Next: Running Configure, Up: Installing GDB
20415 B.1 Requirements for building GDB
20416 =================================
20418 Building GDB requires various tools and packages to be available.
20419 Other packages will be used only if they are found.
20421 Tools/packages necessary for building GDB
20422 =========================================
20425 GDB is written in ISO C90. It should be buildable with any
20426 working C90 compiler, e.g. GCC.
20429 Tools/packages optional for building GDB
20430 ========================================
20433 GDB can use the Expat XML parsing library. This library may be
20434 included with your operating system distribution; if it is not, you
20435 can get the latest version from `http://expat.sourceforge.net'.
20436 The `configure' script will search for this library in several
20437 standard locations; if it is installed in an unusual path, you can
20438 use the `--with-libexpat-prefix' option to specify its location.
20440 Expat is used currently only used to implement some remote-specific
20445 File: gdb.info, Node: Running Configure, Next: Separate Objdir, Prev: Requirements, Up: Installing GDB
20447 B.2 Invoking the GDB `configure' script
20448 =======================================
20450 GDB comes with a `configure' script that automates the process of
20451 preparing GDB for installation; you can then use `make' to build the
20454 The GDB distribution includes all the source code you need for GDB
20455 in a single directory, whose name is usually composed by appending the
20456 version number to `gdb'.
20458 For example, the GDB version 6.6 distribution is in the `gdb-6.6'
20459 directory. That directory contains:
20461 `gdb-6.6/configure (and supporting files)'
20462 script for configuring GDB and all its supporting libraries
20465 the source specific to GDB itself
20468 source for the Binary File Descriptor library
20473 `gdb-6.6/libiberty'
20474 source for the `-liberty' free software library
20477 source for the library of opcode tables and disassemblers
20480 source for the GNU command-line interface
20483 source for the GNU filename pattern-matching subroutine
20486 source for the GNU memory-mapped malloc package
20488 The simplest way to configure and build GDB is to run `configure'
20489 from the `gdb-VERSION-NUMBER' source directory, which in this example
20490 is the `gdb-6.6' directory.
20492 First switch to the `gdb-VERSION-NUMBER' source directory if you are
20493 not already in it; then run `configure'. Pass the identifier for the
20494 platform on which GDB will run as an argument.
20502 where HOST is an identifier such as `sun4' or `decstation', that
20503 identifies the platform where GDB will run. (You can often leave off
20504 HOST; `configure' tries to guess the correct value by examining your
20507 Running `configure HOST' and then running `make' builds the `bfd',
20508 `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
20509 The configured source files, and the binaries, are left in the
20510 corresponding source directories.
20512 `configure' is a Bourne-shell (`/bin/sh') script; if your system
20513 does not recognize this automatically when you run a different shell,
20514 you may need to run `sh' on it explicitly:
20518 If you run `configure' from a directory that contains source
20519 directories for multiple libraries or programs, such as the `gdb-6.6'
20520 source directory for version 6.6, `configure' creates configuration
20521 files for every directory level underneath (unless you tell it not to,
20522 with the `--norecursion' option).
20524 You should run the `configure' script from the top directory in the
20525 source tree, the `gdb-VERSION-NUMBER' directory. If you run
20526 `configure' from one of the subdirectories, you will configure only
20527 that subdirectory. That is usually not what you want. In particular,
20528 if you run the first `configure' from the `gdb' subdirectory of the
20529 `gdb-VERSION-NUMBER' directory, you will omit the configuration of
20530 `bfd', `readline', and other sibling directories of the `gdb'
20531 subdirectory. This leads to build errors about missing include files
20532 such as `bfd/bfd.h'.
20534 You can install `gdb' anywhere; it has no hardwired paths. However,
20535 you should make sure that the shell on your path (named by the `SHELL'
20536 environment variable) is publicly readable. Remember that GDB uses the
20537 shell to start your program--some systems refuse to let GDB debug child
20538 processes whose programs are not readable.
20541 File: gdb.info, Node: Separate Objdir, Next: Config Names, Prev: Running Configure, Up: Installing GDB
20543 B.3 Compiling GDB in another directory
20544 ======================================
20546 If you want to run GDB versions for several host or target machines,
20547 you need a different `gdb' compiled for each combination of host and
20548 target. `configure' is designed to make this easy by allowing you to
20549 generate each configuration in a separate subdirectory, rather than in
20550 the source directory. If your `make' program handles the `VPATH'
20551 feature (GNU `make' does), running `make' in each of these directories
20552 builds the `gdb' program specified there.
20554 To build `gdb' in a separate directory, run `configure' with the
20555 `--srcdir' option to specify where to find the source. (You also need
20556 to specify a path to find `configure' itself from your working
20557 directory. If the path to `configure' would be the same as the
20558 argument to `--srcdir', you can leave out the `--srcdir' option; it is
20561 For example, with version 6.6, you can build GDB in a separate
20562 directory for a Sun 4 like this:
20567 ../gdb-6.6/configure sun4
20570 When `configure' builds a configuration using a remote source
20571 directory, it creates a tree for the binaries with the same structure
20572 (and using the same names) as the tree under the source directory. In
20573 the example, you'd find the Sun 4 library `libiberty.a' in the
20574 directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
20576 Make sure that your path to the `configure' script has just one
20577 instance of `gdb' in it. If your path to `configure' looks like
20578 `../gdb-6.6/gdb/configure', you are configuring only one subdirectory
20579 of GDB, not the whole package. This leads to build errors about
20580 missing include files such as `bfd/bfd.h'.
20582 One popular reason to build several GDB configurations in separate
20583 directories is to configure GDB for cross-compiling (where GDB runs on
20584 one machine--the "host"--while debugging programs that run on another
20585 machine--the "target"). You specify a cross-debugging target by giving
20586 the `--target=TARGET' option to `configure'.
20588 When you run `make' to build a program or library, you must run it
20589 in a configured directory--whatever directory you were in when you
20590 called `configure' (or one of its subdirectories).
20592 The `Makefile' that `configure' generates in each source directory
20593 also runs recursively. If you type `make' in a source directory such
20594 as `gdb-6.6' (or in a separate configured directory configured with
20595 `--srcdir=DIRNAME/gdb-6.6'), you will build all the required libraries,
20596 and then build GDB.
20598 When you have multiple hosts or targets configured in separate
20599 directories, you can run `make' on them in parallel (for example, if
20600 they are NFS-mounted on each of the hosts); they will not interfere
20604 File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
20606 B.4 Specifying names for hosts and targets
20607 ==========================================
20609 The specifications used for hosts and targets in the `configure' script
20610 are based on a three-part naming scheme, but some short predefined
20611 aliases are also supported. The full naming scheme encodes three pieces
20612 of information in the following pattern:
20614 ARCHITECTURE-VENDOR-OS
20616 For example, you can use the alias `sun4' as a HOST argument, or as
20617 the value for TARGET in a `--target=TARGET' option. The equivalent
20618 full name is `sparc-sun-sunos4'.
20620 The `configure' script accompanying GDB does not provide any query
20621 facility to list all supported host and target names or aliases.
20622 `configure' calls the Bourne shell script `config.sub' to map
20623 abbreviations to full names; you can read the script, if you wish, or
20624 you can use it to test your guesses on abbreviations--for example:
20626 % sh config.sub i386-linux
20628 % sh config.sub alpha-linux
20629 alpha-unknown-linux-gnu
20630 % sh config.sub hp9k700
20632 % sh config.sub sun4
20633 sparc-sun-sunos4.1.1
20634 % sh config.sub sun3
20635 m68k-sun-sunos4.1.1
20636 % sh config.sub i986v
20637 Invalid configuration `i986v': machine `i986v' not recognized
20639 `config.sub' is also distributed in the GDB source directory
20640 (`gdb-6.6', for version 6.6).
20643 File: gdb.info, Node: Configure Options, Prev: Config Names, Up: Installing GDB
20645 B.5 `configure' options
20646 =======================
20648 Here is a summary of the `configure' options and arguments that are
20649 most often useful for building GDB. `configure' also has several other
20650 options not listed here. *note (configure.info)What Configure Does::,
20651 for a full explanation of `configure'.
20655 [--exec-prefix=DIR]
20657 [--norecursion] [--rm]
20661 You may introduce options with a single `-' rather than `--' if you
20662 prefer; but you may abbreviate option names if you use `--'.
20665 Display a quick summary of how to invoke `configure'.
20668 Configure the source to install programs and files under directory
20671 `--exec-prefix=DIR'
20672 Configure the source to install programs under directory `DIR'.
20675 *Warning: using this option requires GNU `make', or another `make'
20676 that implements the `VPATH' feature.*
20677 Use this option to make configurations in directories separate
20678 from the GDB source directories. Among other things, you can use
20679 this to build (or maintain) several configurations simultaneously,
20680 in separate directories. `configure' writes configuration
20681 specific files in the current directory, but arranges for them to
20682 use the source in the directory DIRNAME. `configure' creates
20683 directories under the working directory in parallel to the source
20684 directories below DIRNAME.
20687 Configure only the directory level where `configure' is executed;
20688 do not propagate configuration to subdirectories.
20691 Configure GDB for cross-debugging programs running on the specified
20692 TARGET. Without this option, GDB is configured to debug programs
20693 that run on the same machine (HOST) as GDB itself.
20695 There is no convenient way to generate a list of all available
20699 Configure GDB to run on the specified HOST.
20701 There is no convenient way to generate a list of all available
20704 There are many other options available as well, but they are
20705 generally needed for special purposes only.
20708 File: gdb.info, Node: Maintenance Commands, Next: Remote Protocol, Prev: Installing GDB, Up: Top
20710 Appendix C Maintenance Commands
20711 *******************************
20713 In addition to commands intended for GDB users, GDB includes a number
20714 of commands intended for GDB developers, that are not documented
20715 elsewhere in this manual. These commands are provided here for
20716 reference. (For commands that turn on debugging messages, see *Note
20717 Debugging Output::.)
20719 `maint agent EXPRESSION'
20720 Translate the given EXPRESSION into remote agent bytecodes. This
20721 command is useful for debugging the Agent Expression mechanism
20722 (*note Agent Expressions::).
20724 `maint info breakpoints'
20725 Using the same format as `info breakpoints', display both the
20726 breakpoints you've set explicitly, and those GDB is using for
20727 internal purposes. Internal breakpoints are shown with negative
20728 breakpoint numbers. The type column identifies what kind of
20729 breakpoint is shown:
20732 Normal, explicitly set breakpoint.
20735 Normal, explicitly set watchpoint.
20738 Internal breakpoint, used to handle correctly stepping through
20742 Internal breakpoint at the target of a `longjmp'.
20745 Temporary internal breakpoint used by the GDB `until' command.
20748 Temporary internal breakpoint used by the GDB `finish'
20752 Shared library events.
20755 `maint check-symtabs'
20756 Check the consistency of psymtabs and symtabs.
20758 `maint cplus first_component NAME'
20759 Print the first C++ class/namespace component of NAME.
20761 `maint cplus namespace'
20762 Print the list of possible C++ namespaces.
20764 `maint demangle NAME'
20765 Demangle a C++ or Objective-C manled NAME.
20767 `maint deprecate COMMAND [REPLACEMENT]'
20768 `maint undeprecate COMMAND'
20769 Deprecate or undeprecate the named COMMAND. Deprecated commands
20770 cause GDB to issue a warning when you use them. The optional
20771 argument REPLACEMENT says which newer command should be used in
20772 favor of the deprecated one; if it is given, GDB will mention the
20773 replacement as part of the warning.
20776 Cause a fatal signal in the debugger and force it to dump its core.
20777 This is supported only on systems which support aborting a program
20778 with the `SIGQUIT' signal.
20780 `maint internal-error [MESSAGE-TEXT]'
20781 `maint internal-warning [MESSAGE-TEXT]'
20782 Cause GDB to call the internal function `internal_error' or
20783 `internal_warning' and hence behave as though an internal error or
20784 internal warning has been detected. In addition to reporting the
20785 internal problem, these functions give the user the opportunity to
20786 either quit GDB or create a core file of the current GDB session.
20788 These commands take an optional parameter MESSAGE-TEXT that is
20789 used as the text of the error or warning message.
20791 Here's an example of using `indernal-error':
20793 (gdb) maint internal-error testing, 1, 2
20794 .../maint.c:121: internal-error: testing, 1, 2
20795 A problem internal to GDB has been detected. Further
20796 debugging may prove unreliable.
20797 Quit this debugging session? (y or n) n
20798 Create a core file? (y or n) n
20801 `maint packet TEXT'
20802 If GDB is talking to an inferior via the serial protocol, then
20803 this command sends the string TEXT to the inferior, and displays
20804 the response packet. GDB supplies the initial `$' character, the
20805 terminating `#' character, and the checksum.
20807 `maint print architecture [FILE]'
20808 Print the entire architecture configuration. The optional argument
20809 FILE names the file where the output goes.
20811 `maint print dummy-frames'
20812 Prints the contents of GDB's internal dummy-frame stack.
20816 (gdb) print add(2,3)
20817 Breakpoint 2, add (a=2, b=3) at ...
20819 The program being debugged stopped while in a function called from GDB.
20821 (gdb) maint print dummy-frames
20822 0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6
20823 top=0x0200bdd4 id={stack=0x200bddc,code=0x101405c}
20824 call_lo=0x01014000 call_hi=0x01014001
20827 Takes an optional file parameter.
20829 `maint print registers [FILE]'
20830 `maint print raw-registers [FILE]'
20831 `maint print cooked-registers [FILE]'
20832 `maint print register-groups [FILE]'
20833 Print GDB's internal register data structures.
20835 The command `maint print raw-registers' includes the contents of
20836 the raw register cache; the command `maint print cooked-registers'
20837 includes the (cooked) value of all registers; and the command
20838 `maint print register-groups' includes the groups that each
20839 register is a member of. *Note Registers: (gdbint)Registers.
20841 These commands take an optional parameter, a file name to which to
20842 write the information.
20844 `maint print reggroups [FILE]'
20845 Print GDB's internal register group data structures. The optional
20846 argument FILE tells to what file to write the information.
20848 The register groups info looks like this:
20850 (gdb) maint print reggroups
20861 This command forces GDB to flush its internal register cache.
20863 `maint print objfiles'
20864 Print a dump of all known object files. For each object file, this
20865 command prints its name, address in memory, and all of its psymtabs
20868 `maint print statistics'
20869 This command prints, for each object file in the program, various
20870 data about that object file followed by the byte cache ("bcache")
20871 statistics for the object file. The objfile data includes the
20872 number of minimal, partical, full, and stabs symbols, the number
20873 of types defined by the objfile, the number of as yet unexpanded
20874 psym tables, the number of line tables and string tables, and the
20875 amount of memory used by the various tables. The bcache
20876 statistics include the counts, sizes, and counts of duplicates of
20877 all and unique objects, max, average, and median entry size, total
20878 memory used and its overhead and savings, and various measures of
20879 the hash table size and chain lengths.
20881 `maint print type EXPR'
20882 Print the type chain for a type specified by EXPR. The argument
20883 can be either a type name or a symbol. If it is a symbol, the
20884 type of that symbol is described. The type chain produced by this
20885 command is a recursive definition of the data type as stored in
20886 GDB's data structures, including its flags and contained types.
20888 `maint set dwarf2 max-cache-age'
20889 `maint show dwarf2 max-cache-age'
20890 Control the DWARF 2 compilation unit cache.
20892 In object files with inter-compilation-unit references, such as
20893 those produced by the GCC option `-feliminate-dwarf2-dups', the
20894 DWARF 2 reader needs to frequently refer to previously read
20895 compilation units. This setting controls how long a compilation
20896 unit will remain in the cache if it is not referenced. A higher
20897 limit means that cached compilation units will be stored in memory
20898 longer, and more total memory will be used. Setting it to zero
20899 disables caching, which will slow down GDB startup, but reduce
20900 memory consumption.
20902 `maint set profile'
20903 `maint show profile'
20904 Control profiling of GDB.
20906 Profiling will be disabled until you use the `maint set profile'
20907 command to enable it. When you enable profiling, the system will
20908 begin collecting timing and execution count data; when you disable
20909 profiling or exit GDB, the results will be written to a log file.
20910 Remember that if you use profiling, GDB will overwrite the
20911 profiling log file (often called `gmon.out'). If you have a
20912 record of important profiling data in a `gmon.out' file, be sure
20913 to move it to a safe location.
20915 Configuring with `--enable-profiling' arranges for GDB to be
20916 compiled with the `-pg' compiler option.
20918 `maint show-debug-regs'
20919 Control whether to show variables that mirror the x86 hardware
20920 debug registers. Use `ON' to enable, `OFF' to disable. If
20921 enabled, the debug registers values are shown when GDB inserts or
20922 removes a hardware breakpoint or watchpoint, and when the inferior
20923 triggers a hardware-assisted breakpoint or watchpoint.
20926 Control whether to display memory usage for each command. If set
20927 to a nonzero value, GDB will display how much memory each command
20928 took, following the command's own output. This can also be
20929 requested by invoking GDB with the `--statistics' command-line
20930 switch (*note Mode Options::).
20933 Control whether to display the execution time for each command. If
20934 set to a nonzero value, GDB will display how much time it took to
20935 execute each command, following the command's own output. This
20936 can also be requested by invoking GDB with the `--statistics'
20937 command-line switch (*note Mode Options::).
20939 `maint translate-address [SECTION] ADDR'
20940 Find the symbol stored at the location specified by the address
20941 ADDR and an optional section name SECTION. If found, GDB prints
20942 the name of the closest symbol and an offset from the symbol's
20943 location to the specified address. This is similar to the `info
20944 address' command (*note Symbols::), except that this command also
20945 allows to find symbols in other sections.
20948 The following command is useful for non-interactive invocations of
20949 GDB, such as in the test suite.
20951 `set watchdog NSEC'
20952 Set the maximum number of seconds GDB will wait for the target
20953 operation to finish. If this time expires, GDB reports and error
20954 and the command is aborted.
20957 Show the current setting of the target wait timeout.
20960 File: gdb.info, Node: Remote Protocol, Next: Agent Expressions, Prev: Maintenance Commands, Up: Top
20962 Appendix D GDB Remote Serial Protocol
20963 *************************************
20969 * Stop Reply Packets::
20970 * General Query Packets::
20971 * Register Packet Format::
20972 * Tracepoint Packets::
20975 * File-I/O remote protocol extension::
20976 * Memory map format::
20979 File: gdb.info, Node: Overview, Next: Packets, Up: Remote Protocol
20984 There may be occasions when you need to know something about the
20985 protocol--for example, if there is only one serial port to your target
20986 machine, you might want your program to do something special if it
20987 recognizes a packet meant for GDB.
20989 In the examples below, `->' and `<-' are used to indicate
20990 transmitted and received data respectfully.
20992 All GDB commands and responses (other than acknowledgments) are sent
20993 as a PACKET. A PACKET is introduced with the character `$', the actual
20994 PACKET-DATA, and the terminating character `#' followed by a two-digit
20997 `$'PACKET-DATA`#'CHECKSUM
20998 The two-digit CHECKSUM is computed as the modulo 256 sum of all
20999 characters between the leading `$' and the trailing `#' (an eight bit
21000 unsigned checksum).
21002 Implementors should note that prior to GDB 5.0 the protocol
21003 specification also included an optional two-digit SEQUENCE-ID:
21005 `$'SEQUENCE-ID`:'PACKET-DATA`#'CHECKSUM
21007 That SEQUENCE-ID was appended to the acknowledgment. GDB has never
21008 output SEQUENCE-IDs. Stubs that handle packets added since GDB 5.0
21009 must not accept SEQUENCE-ID.
21011 When either the host or the target machine receives a packet, the
21012 first response expected is an acknowledgment: either `+' (to indicate
21013 the package was received correctly) or `-' (to request retransmission):
21015 -> `$'PACKET-DATA`#'CHECKSUM
21017 The host (GDB) sends COMMANDs, and the target (the debugging stub
21018 incorporated in your program) sends a RESPONSE. In the case of step
21019 and continue COMMANDs, the response is only sent when the operation has
21020 completed (the target has again stopped).
21022 PACKET-DATA consists of a sequence of characters with the exception
21023 of `#' and `$' (see `X' packet for additional exceptions).
21025 Fields within the packet should be separated using `,' `;' or `:'.
21026 Except where otherwise noted all numbers are represented in HEX with
21027 leading zeros suppressed.
21029 Implementors should note that prior to GDB 5.0, the character `:'
21030 could not appear as the third character in a packet (as it would
21031 potentially conflict with the SEQUENCE-ID).
21033 Binary data in most packets is encoded either as two hexadecimal
21034 digits per byte of binary data. This allowed the traditional remote
21035 protocol to work over connections which were only seven-bit clean.
21036 Some packets designed more recently assume an eight-bit clean
21037 connection, and use a more efficient encoding to send and receive
21040 The binary data representation uses `7d' (ASCII `}') as an escape
21041 character. Any escaped byte is transmitted as the escape character
21042 followed by the original character XORed with `0x20'. For example, the
21043 byte `0x7d' would be transmitted as the two bytes `0x7d 0x5d'. The
21044 bytes `0x23' (ASCII `#'), `0x24' (ASCII `$'), and `0x7d' (ASCII `}')
21045 must always be escaped. Responses sent by the stub must also escape
21046 `0x2a' (ASCII `*'), so that it is not interpreted as the start of a
21047 run-length encoded sequence (described next).
21049 Response DATA can be run-length encoded to save space. A `*' means
21050 that the next character is an ASCII encoding giving a repeat count
21051 which stands for that many repetitions of the character preceding the
21052 `*'. The encoding is `n+29', yielding a printable character where `n
21053 >=3' (which is where rle starts to win). The printable characters `$',
21054 `#', `+' and `-' or with a numeric value greater than 126 should not be
21059 means the same as "0000".
21061 The error response returned for some packets includes a two character
21062 error number. That number is not well defined.
21064 For any COMMAND not supported by the stub, an empty response
21065 (`$#00') should be returned. That way it is possible to extend the
21066 protocol. A newer GDB can tell if a packet is supported based on that
21069 A stub is required to support the `g', `G', `m', `M', `c', and `s'
21070 COMMANDs. All other COMMANDs are optional.
21073 File: gdb.info, Node: Packets, Next: Stop Reply Packets, Prev: Overview, Up: Remote Protocol
21078 The following table provides a complete list of all currently defined
21079 COMMANDs and their corresponding response DATA. *Note File-I/O remote
21080 protocol extension::, for details about the File I/O extension of the
21083 Each packet's description has a template showing the packet's overall
21084 syntax, followed by an explanation of the packet's meaning. We include
21085 spaces in some of the templates for clarity; these are not part of the
21086 packet's syntax. No GDB packet uses spaces to separate its components.
21087 For example, a template like `foo BAR BAZ' describes a packet
21088 beginning with the three ASCII bytes `foo', followed by a BAR, followed
21089 directly by a BAZ. GDB does not transmit a space character between the
21090 `foo' and the BAR, or between the BAR and the BAZ.
21092 Note that all packet forms beginning with an upper- or lower-case
21093 letter, other than those described here, are reserved for future use.
21095 Here are the packet descriptions.
21098 Enable extended mode. In extended mode, the remote server is made
21099 persistent. The `R' packet is used to restart the program being
21104 The remote target both supports and has enabled extended mode.
21107 Indicate the reason the target halted. The reply is the same as
21108 for step and continue.
21110 Reply: *Note Stop Reply Packets::, for the reply specifications.
21112 `A ARGLEN,ARGNUM,ARG,...'
21113 Initialized `argv[]' array passed into program. ARGLEN specifies
21114 the number of bytes in the hex encoded byte stream ARG. See
21115 `gdbserver' for more details.
21119 The arguments were set.
21125 (Don't use this packet; its behavior is not well-defined.) Change
21126 the serial line speed to BAUD.
21128 JTC: _When does the transport layer state change? When it's
21129 received, or after the ACK is transmitted. In either case, there
21130 are problems if the command or the acknowledgment packet is
21133 Stan: _If people really wanted to add something like this, and get
21134 it working for the first time, they ought to modify ser-unix.c to
21135 send some kind of out-of-band message to a specially-setup stub
21136 and have the switch happen "in between" packets, so that from
21137 remote protocol's point of view, nothing actually happened._
21140 Set (MODE is `S') or clear (MODE is `C') a breakpoint at ADDR.
21142 Don't use this packet. Use the `Z' and `z' packets instead (*note
21143 insert breakpoint or watchpoint packet::).
21146 Continue. ADDR is address to resume. If ADDR is omitted, resume
21147 at current address.
21149 Reply: *Note Stop Reply Packets::, for the reply specifications.
21152 Continue with signal SIG (hex signal number). If `;ADDR' is
21153 omitted, resume at same address.
21155 Reply: *Note Stop Reply Packets::, for the reply specifications.
21160 Don't use this packet; instead, define a general set packet (*note
21161 General Query Packets::).
21164 Detach GDB from the remote system. Sent to the remote target
21165 before GDB disconnects via the `detach' command.
21175 A reply from GDB to an `F' packet sent by the target. This is
21176 part of the File-I/O protocol extension. *Note File-I/O remote
21177 protocol extension::, for the specification.
21180 Read general registers.
21184 Each byte of register data is described by two hex digits.
21185 The bytes with the register are transmitted in target byte
21186 order. The size of each register and their position within
21187 the `g' packet are determined by the GDB internal macros
21188 `DEPRECATED_REGISTER_RAW_SIZE' and `REGISTER_NAME' macros.
21189 The specification of several standard `g' packets is
21196 Write general registers. *Note read registers packet::, for a
21197 description of the XX... data.
21207 Set thread for subsequent operations (`m', `M', `g', `G', et.al.).
21208 C depends on the operation to be performed: it should be `c' for
21209 step and continue operations, `g' for other operations. The
21210 thread designator T may be `-1', meaning all the threads, a thread
21211 number, or `0' which means pick any thread.
21221 Step the remote target by a single clock cycle. If `,NNN' is
21222 present, cycle step NNN cycles. If ADDR is present, cycle step
21223 starting at that address.
21226 Signal, then cycle step. *Note step with signal packet::. *Note
21227 cycle step packet::.
21232 FIXME: _There is no description of how to operate when a specific
21233 thread context has been selected (i.e. does 'k' kill only that
21237 Read LENGTH bytes of memory starting at address ADDR. Note that
21238 ADDR may not be aligned to any particular boundary.
21240 The stub need not use any particular size or alignment when
21241 gathering data from memory for the response; even if ADDR is
21242 word-aligned and LENGTH is a multiple of the word size, the stub
21243 is free to use byte accesses, or not. For this reason, this
21244 packet may not be suitable for accessing memory-mapped I/O devices.
21248 Memory contents; each byte is transmitted as a two-digit
21249 hexadecimal number. The reply may contain fewer bytes than
21250 requested if the server was able to read only part of the
21256 `M ADDR,LENGTH:XX...'
21257 Write LENGTH bytes of memory starting at address ADDR. XX... is
21258 the data; each byte is transmitted as a two-digit hexadecimal
21266 for an error (this includes the case where only part of the
21270 Read the value of register N; N is in hex. *Note read registers
21271 packet::, for a description of how the returned register value is
21276 the register's value
21282 Indicating an unrecognized QUERY.
21285 Write register N... with value R.... The register number N is in
21286 hexadecimal, and R... contains two hex digits for each byte in the
21287 register (target byte order).
21298 General query (`q') and set (`Q'). These packets are described
21299 fully in *Note General Query Packets::.
21302 Reset the entire system.
21304 Don't use this packet; use the `R' packet instead.
21307 Restart the program being debugged. XX, while needed, is ignored.
21308 This packet is only available in extended mode.
21310 The `R' packet has no reply.
21313 Single step. ADDR is the address at which to resume. If ADDR is
21314 omitted, resume at same address.
21316 Reply: *Note Stop Reply Packets::, for the reply specifications.
21319 Step with signal. This is analogous to the `C' packet, but
21320 requests a single-step, rather than a normal resumption of
21323 Reply: *Note Stop Reply Packets::, for the reply specifications.
21326 Search backwards starting at address ADDR for a match with pattern
21327 PP and mask MM. PP and MM are 4 bytes. ADDR must be at least 3
21331 Find out if the thread XX is alive.
21335 thread is still alive
21341 Packets starting with `v' are identified by a multi-letter name,
21342 up to the first `;' or `?' (or the end of the packet).
21344 `vCont[;ACTION[:TID]]...'
21345 Resume the inferior, specifying different actions for each thread.
21346 If an action is specified with no TID, then it is applied to any
21347 threads that don't have a specific action specified; if no default
21348 action is specified then other threads should remain stopped.
21349 Specifying multiple default actions is an error; specifying no
21350 actions is also an error. Thread IDs are specified in
21351 hexadecimal. Currently supported actions are:
21357 Continue with signal SIG. SIG should be two hex digits.
21363 Step with signal SIG. SIG should be two hex digits.
21365 The optional ADDR argument normally associated with these packets
21366 is not supported in `vCont'.
21368 Reply: *Note Stop Reply Packets::, for the reply specifications.
21371 Request a list of actions supporetd by the `vCont' packet.
21374 `vCont[;ACTION...]'
21375 The `vCont' packet is supported. Each ACTION is a supported
21376 command in the `vCont' packet.
21379 The `vCont' packet is not supported.
21381 `vFlashErase:ADDR,LENGTH'
21382 Direct the stub to erase LENGTH bytes of flash starting at ADDR.
21383 The region may enclose any number of flash blocks, but its start
21384 and end must fall on block boundaries, as indicated by the flash
21385 block size appearing in the memory map (*note Memory map
21386 format::). GDB groups flash memory programming operations
21387 together, and sends a `vFlashDone' request after each group; the
21388 stub is allowed to delay erase operation until the `vFlashDone'
21389 packet is received.
21398 `vFlashWrite:ADDR:XX...'
21399 Direct the stub to write data to flash address ADDR. The data is
21400 passed in binary form using the same encoding as for the `X'
21401 packet (*note Binary Data::). The memory ranges specified by
21402 `vFlashWrite' packets preceding a `vFlashDone' packet must not
21403 overlap, and must appear in order of increasing addresses
21404 (although `vFlashErase' packets for higher addresses may already
21405 have been received; the ordering is guaranteed only between
21406 `vFlashWrite' packets). If a packet writes to an address that was
21407 neither erased by a preceding `vFlashErase' packet nor by some
21408 other target-specific method, the results are unpredictable.
21415 for vFlashWrite addressing non-flash memory
21421 Indicate to the stub that flash programming operation is finished.
21422 The stub is permitted to delay or batch the effects of a group of
21423 `vFlashErase' and `vFlashWrite' packets until a `vFlashDone'
21424 packet is received. The contents of the affected regions of flash
21425 memory are unpredictable until the `vFlashDone' request is
21428 `X ADDR,LENGTH:XX...'
21429 Write data to memory, where the data is transmitted in binary.
21430 ADDR is address, LENGTH is number of bytes, `XX...' is binary data
21431 (*note Binary Data::).
21440 `z TYPE,ADDR,LENGTH'
21441 `Z TYPE,ADDR,LENGTH'
21442 Insert (`Z') or remove (`z') a TYPE breakpoint or watchpoint
21443 starting at address ADDRESS and covering the next LENGTH bytes.
21445 Each breakpoint and watchpoint packet TYPE is documented
21448 _Implementation notes: A remote target shall return an empty string
21449 for an unrecognized breakpoint or watchpoint packet TYPE. A
21450 remote target shall support either both or neither of a given
21451 `ZTYPE...' and `zTYPE...' packet pair. To avoid potential
21452 problems with duplicate packets, the operations should be
21453 implemented in an idempotent way._
21457 Insert (`Z0') or remove (`z0') a memory breakpoint at address ADDR
21460 A memory breakpoint is implemented by replacing the instruction at
21461 ADDR with a software breakpoint or trap instruction. The LENGTH
21462 is used by targets that indicates the size of the breakpoint (in
21463 bytes) that should be inserted (e.g., the ARM and MIPS can insert
21464 either a 2 or 4 byte breakpoint).
21466 _Implementation note: It is possible for a target to copy or move
21467 code that contains memory breakpoints (e.g., when implementing
21468 overlays). The behavior of this packet, in the presence of such a
21469 target, is not defined._
21483 Insert (`Z1') or remove (`z1') a hardware breakpoint at address
21484 ADDR of size LENGTH.
21486 A hardware breakpoint is implemented using a mechanism that is not
21487 dependant on being able to modify the target's memory.
21489 _Implementation note: A hardware breakpoint is not affected by code
21504 Insert (`Z2') or remove (`z2') a write watchpoint.
21518 Insert (`Z3') or remove (`z3') a read watchpoint.
21532 Insert (`Z4') or remove (`z4') an access watchpoint.
21546 File: gdb.info, Node: Stop Reply Packets, Next: General Query Packets, Prev: Packets, Up: Remote Protocol
21548 D.3 Stop Reply Packets
21549 ======================
21551 The `C', `c', `S', `s' and `?' packets can receive any of the below as
21552 a reply. In the case of the `C', `c', `S' and `s' packets, that reply
21553 is only returned when the target halts. In the below the exact meaning
21554 of "signal number" is poorly defined. In general one of the UNIX signal
21555 numbering conventions is used.
21557 As in the description of request packets, we include spaces in the
21558 reply templates for clarity; these are not part of the reply packet's
21559 syntax. No GDB stop reply packet uses spaces to separate its
21563 The program received signal number AA (a two-digit hexadecimal
21564 number). This is equivalent to a `T' response with no N:R pairs.
21566 `T AA N1:R1;N2:R2;...'
21567 The program received signal number AA (a two-digit hexadecimal
21568 number). This is equivalent to an `S' response, except that the
21569 `N:R' pairs can carry values of important registers and other
21570 information directly in the stop reply packet, reducing round-trip
21571 latency. Single-step and breakpoint traps are reported this way.
21572 Each `N:R' pair is interpreted as follows:
21573 1. If N is a hexadecimal number, it is a register number, and the
21574 corresponding R gives that register's value. R is a series
21575 of bytes in target byte order, with each byte given by a
21576 two-digit hex number.
21578 2. If N is `thread', then R is the thread process ID, in hex.
21580 3. If N is `watch', `rwatch', or `awatch', then the packet
21581 indicates a watchpoint hit, and R is the data address, in hex.
21583 4. Otherwise, GDB should ignore this `N:R' pair and go on to the
21584 next; this allows us to extend the protocol in the future.
21587 The process exited, and AA is the exit status. This is only
21588 applicable to certain targets.
21591 The process terminated with signal AA.
21594 `XX...' is hex encoding of ASCII data, to be written as the
21595 program's console output. This can happen at any time while the
21596 program is running and the debugger should continue to wait for
21599 `F CALL-ID,PARAMETER...'
21600 CALL-ID is the identifier which says which host system call should
21601 be called. This is just the name of the function. Translation
21602 into the correct system call is only applicable as it's defined in
21603 GDB. *Note File-I/O remote protocol extension::, for a list of
21604 implemented system calls.
21606 `PARAMETER...' is a list of parameters as defined for this very
21609 The target replies with this packet when it expects GDB to call a
21610 host system call on behalf of the target. GDB replies with an
21611 appropriate `F' packet and keeps up waiting for the next reply
21612 packet from the target. The latest `C', `c', `S' or `s' action is
21613 expected to be continued. *Note File-I/O remote protocol
21614 extension::, for more details.
21618 File: gdb.info, Node: General Query Packets, Next: Register Packet Format, Prev: Stop Reply Packets, Up: Remote Protocol
21620 D.4 General Query Packets
21621 =========================
21623 Packets starting with `q' are "general query packets"; packets starting
21624 with `Q' are "general set packets". General query and set packets are
21625 a semi-unified form for retrieving and sending information to and from
21628 The initial letter of a query or set packet is followed by a name
21629 indicating what sort of thing the packet applies to. For example, GDB
21630 may use a `qSymbol' packet to exchange symbol definitions with the
21631 stub. These packet names follow some conventions:
21633 * The name must not contain commas, colons or semicolons.
21635 * Most GDB query and set packets have a leading upper case letter.
21637 * The names of custom vendor packets should use a company prefix, in
21638 lower case, followed by a period. For example, packets designed at
21639 the Acme Corporation might begin with `qacme.foo' (for querying
21640 foos) or `Qacme.bar' (for setting bars).
21642 The name of a query or set packet should be separated from any
21643 parameters by a `:'; the parameters themselves should be separated by
21644 `,' or `;'. Stubs must be careful to match the full packet name, and
21645 check for a separator or the end of the packet, in case two packet
21646 names share a common prefix. New packets should not begin with `qC',
21649 Like the descriptions of the other packets, each description here
21650 has a template showing the packet's overall syntax, followed by an
21651 explanation of the packet's meaning. We include spaces in some of the
21652 templates for clarity; these are not part of the packet's syntax. No
21653 GDB packet uses spaces to separate its components.
21655 Here are the currently defined query and set packets:
21658 Return the current thread id.
21662 Where PID is an unsigned hexadecimal process id.
21665 Any other reply implies the old pid.
21668 Compute the CRC checksum of a block of memory. Reply:
21670 An error (such as memory fault)
21673 The specified memory region's checksum is CRC32.
21677 Obtain a list of all active thread ids from the target (OS).
21678 Since there may be too many active threads to fit into one reply
21679 packet, this query works iteratively: it may require more than one
21680 query/reply sequence to obtain the entire list of threads. The
21681 first query of the sequence will be the `qfThreadInfo' query;
21682 subsequent queries in the sequence will be the `qsThreadInfo'
21685 NOTE: This packet replaces the `qL' query (see below).
21692 a comma-separated list of thread ids
21695 (lower case letter `L') denotes end of list.
21697 In response to each query, the target will reply with a list of
21698 one or more thread ids, in big-endian unsigned hex, separated by
21699 commas. GDB will respond to each reply with a request for more
21700 thread ids (using the `qs' form of the query), until the target
21701 responds with `l' (lower-case el, for "last").
21703 `qGetTLSAddr:THREAD-ID,OFFSET,LM'
21704 Fetch the address associated with thread local storage specified
21705 by THREAD-ID, OFFSET, and LM.
21707 THREAD-ID is the (big endian, hex encoded) thread id associated
21708 with the thread for which to fetch the TLS address.
21710 OFFSET is the (big endian, hex encoded) offset associated with the
21711 thread local variable. (This offset is obtained from the debug
21712 information associated with the variable.)
21714 LM is the (big endian, hex encoded) OS/ABI specific encoding of the
21715 the load module associated with the thread local storage. For
21716 example, a GNU/Linux system will pass the link map address of the
21717 shared object associated with the thread local storage under
21718 consideration. Other operating environments may choose to
21719 represent the load module differently, so the precise meaning of
21720 this parameter will vary.
21724 Hex encoded (big endian) bytes representing the address of
21725 the thread local storage requested.
21728 An error occurred. NN are hex digits.
21731 An empty reply indicates that `qGetTLSAddr' is not supported
21734 `qL STARTFLAG THREADCOUNT NEXTTHREAD'
21735 Obtain thread information from RTOS. Where: STARTFLAG (one hex
21736 digit) is one to indicate the first query and zero to indicate a
21737 subsequent query; THREADCOUNT (two hex digits) is the maximum
21738 number of threads the response packet can contain; and NEXTTHREAD
21739 (eight hex digits), for subsequent queries (STARTFLAG is zero), is
21740 returned in the response as ARGTHREAD.
21742 Don't use this packet; use the `qfThreadInfo' query instead (see
21746 `qM COUNT DONE ARGTHREAD THREAD...'
21747 Where: COUNT (two hex digits) is the number of threads being
21748 returned; DONE (one hex digit) is zero to indicate more
21749 threads and one indicates no further threads; ARGTHREADID
21750 (eight hex digits) is NEXTTHREAD from the request packet;
21751 THREAD... is a sequence of thread IDs from the target.
21752 THREADID (eight hex digits). See
21753 `remote.c:parse_threadlist_response()'.
21756 Get section offsets that the target used when re-locating the
21757 downloaded image. _Note: while a `Bss' offset is included in the
21758 response, GDB ignores this and instead applies the `Data' offset
21759 to the `Bss' section._
21762 `Text=XXX;Data=YYY;Bss=ZZZ'
21765 Returns information on THREADID. Where: MODE is a hex encoded 32
21766 bit mode; THREADID is a hex encoded 64 bit thread ID.
21768 Don't use this packet; use the `qThreadExtraInfo' query instead
21771 Reply: see `remote.c:remote_unpack_thread_info_response()'.
21774 COMMAND (hex encoded) is passed to the local interpreter for
21775 execution. Invalid commands should be reported using the output
21776 string. Before the final result packet, the target may also
21777 respond with a number of intermediate `OOUTPUT' console output
21778 packets. _Implementors should note that providing access to a
21779 stubs's interpreter may have security implications_.
21783 A command response with no output.
21786 A command response with the hex encoded output string OUTPUT.
21789 Indicate a badly formed request.
21792 An empty reply indicates that `qRcmd' is not recognized.
21794 (Note that the `qRcmd' packet's name is separated from the command
21795 by a `,', not a `:', contrary to the naming conventions above.
21796 Please don't use this packet as a model for new packets.)
21798 `qSupported [:GDBFEATURE [;GDBFEATURE]... ]'
21799 Tell the remote stub about features supported by GDB, and query
21800 the stub for features it supports. This packet allows GDB and the
21801 remote stub to take advantage of each others' features.
21802 `qSupported' also consolidates multiple feature probes at startup,
21803 to improve GDB performance--a single larger packet performs better
21804 than multiple smaller probe packets on high-latency links. Some
21805 features may enable behavior which must not be on by default, e.g.
21806 because it would confuse older clients or stubs. Other features
21807 may describe packets which could be automatically probed for, but
21808 are not. These features must be reported before GDB will use
21809 them. This "default unsupported" behavior is not appropriate for
21810 all packets, but it helps to keep the initial connection time
21811 under control with new versions of GDB which support increasing
21812 numbers of packets.
21815 `STUBFEATURE [;STUBFEATURE]...'
21816 The stub supports or does not support each returned
21817 STUBFEATURE, depending on the form of each STUBFEATURE (see
21818 below for the possible forms).
21821 An empty reply indicates that `qSupported' is not recognized,
21822 or that no features needed to be reported to GDB.
21824 The allowed forms for each feature (either a GDBFEATURE in the
21825 `qSupported' packet, or a STUBFEATURE in the response) are:
21828 The remote protocol feature NAME is supported, and associated
21829 with the specified VALUE. The format of VALUE depends on the
21830 feature, but it must not include a semicolon.
21833 The remote protocol feature NAME is supported, and does not
21834 need an associated value.
21837 The remote protocol feature NAME is not supported.
21840 The remote protocol feature NAME may be supported, and GDB
21841 should auto-detect support in some other way when it is
21842 needed. This form will not be used for GDBFEATURE
21843 notifications, but may be used for STUBFEATURE responses.
21845 Whenever the stub receives a `qSupported' request, the supplied
21846 set of GDB features should override any previous request. This
21847 allows GDB to put the stub in a known state, even if the stub had
21848 previously been communicating with a different version of GDB.
21850 No values of GDBFEATURE (for the packet sent by GDB) are defined
21851 yet. Stubs should ignore any unknown values for GDBFEATURE. Any
21852 GDB which sends a `qSupported' packet supports receiving packets
21853 of unlimited length (earlier versions of GDB may reject overly
21854 long responses). Values for GDBFEATURE may be defined in the
21855 future to let the stub take advantage of new features in GDB, e.g.
21856 incompatible improvements in the remote protocol--support for
21857 unlimited length responses would be a GDBFEATURE example, if it
21858 were not implied by the `qSupported' query. The stub's reply
21859 should be independent of the GDBFEATURE entries sent by GDB; first
21860 GDB describes all the features it supports, and then the stub
21861 replies with all the features it supports.
21863 Similarly, GDB will silently ignore unrecognized stub feature
21864 responses, as long as each response uses one of the standard forms.
21866 Some features are flags. A stub which supports a flag feature
21867 should respond with a `+' form response. Other features require
21868 values, and the stub should respond with an `=' form response.
21870 Each feature has a default value, which GDB will use if
21871 `qSupported' is not available or if the feature is not mentioned
21872 in the `qSupported' response. The default values are fixed; a
21873 stub is free to omit any feature responses that match the defaults.
21875 Not all features can be probed, but for those which can, the
21876 probing mechanism is useful: in some cases, a stub's internal
21877 architecture may not allow the protocol layer to know some
21878 information about the underlying target in advance. This is
21879 especially common in stubs which may be configured for multiple
21882 These are the currently defined stub features and their properties:
21884 Feature Name Value Default Probe Allowed
21886 `PacketSize' Yes `-' No
21887 `qXfer:auxv:read' No `-' Yes
21888 `qXfer:memory-map:read'No `-' Yes
21890 These are the currently defined stub features, in more detail:
21893 The remote stub can accept packets up to at least BYTES in
21894 length. GDB will send packets up to this size for bulk
21895 transfers, and will never send larger packets. This is a
21896 limit on the data characters in the packet, including the
21897 frame and checksum. There is no trailing NUL byte in a
21898 remote protocol packet; if the stub stores packets in a
21899 NUL-terminated format, it should allow an extra byte in its
21900 buffer for the NUL. If this stub feature is not supported,
21901 GDB guesses based on the size of the `g' packet response.
21904 The remote stub understands the `qXfer:auxv:read' packet
21905 (*note qXfer auxiliary vector read::).
21909 Notify the target that GDB is prepared to serve symbol lookup
21910 requests. Accept requests from the target for the values of
21915 The target does not need to look up any (more) symbols.
21918 The target requests the value of symbol SYM_NAME (hex
21919 encoded). GDB may provide the value by using the
21920 `qSymbol:SYM_VALUE:SYM_NAME' message, described below.
21922 `qSymbol:SYM_VALUE:SYM_NAME'
21923 Set the value of SYM_NAME to SYM_VALUE.
21925 SYM_NAME (hex encoded) is the name of a symbol whose value the
21926 target has previously requested.
21928 SYM_VALUE (hex) is the value for symbol SYM_NAME. If GDB cannot
21929 supply a value for SYM_NAME, then this field will be empty.
21933 The target does not need to look up any (more) symbols.
21936 The target requests the value of a new symbol SYM_NAME (hex
21937 encoded). GDB will continue to supply the values of symbols
21938 (if available), until the target ceases to request them.
21942 *Note Tracepoint Packets::.
21944 `qThreadExtraInfo,ID'
21945 Obtain a printable string description of a thread's attributes from
21946 the target OS. ID is a thread-id in big-endian hex. This string
21947 may contain anything that the target OS thinks is interesting for
21948 GDB to tell the user about the thread. The string is displayed in
21949 GDB's `info threads' display. Some examples of possible thread
21950 extra info strings are `Runnable', or `Blocked on Mutex'.
21954 Where `XX...' is a hex encoding of ASCII data, comprising the
21955 printable string containing the extra information about the
21956 thread's attributes.
21958 (Note that the `qThreadExtraInfo' packet's name is separated from
21959 the command by a `,', not a `:', contrary to the naming
21960 conventions above. Please don't use this packet as a model for new
21968 *Note Tracepoint Packets::.
21970 `qXfer:OBJECT:read:ANNEX:OFFSET,LENGTH'
21971 Read uninterpreted bytes from the target's special data area
21972 identified by the keyword OBJECT. Request LENGTH bytes starting
21973 at OFFSET bytes into the data. The content and encoding of ANNEX
21974 is specific to the object; it can supply additional details about
21975 what data to access.
21977 Here are the specific requests of this form defined so far. All
21978 `qXfer:OBJECT:read:...' requests use the same reply formats,
21981 `qXfer:auxv:read::OFFSET,LENGTH'
21982 Access the target's "auxiliary vector". *Note auxiliary
21983 vector: OS Information. Note ANNEX must be empty.
21985 This packet is not probed by default; the remote stub must
21986 request it, by suppling an appropriate `qSupported' response
21987 (*note qSupported::).
21989 `qXfer:memory-map:read::OFFSET,LENGTH'
21990 Access the target's "memory-map". *Note Memory map format::.
21991 The annex part of the generic `qXfer' packet must be empty
21992 (*note qXfer read::).
21994 This packet is not probed by default; the remote stub must
21995 request it, by supplying an appropriate `qSupported' response
21996 (*note qSupported::).
22000 Data DATA (*note Binary Data::) has been read from the
22001 target. There may be more data at a higher address (although
22002 it is permitted to return `m' even for the last valid block
22003 of data, as long as at least one byte of data was read).
22004 DATA may have fewer bytes than the LENGTH in the request.
22007 Data DATA (*note Binary Data::) has been read from the target.
22008 There is no more data to be read. DATA may have fewer bytes
22009 than the LENGTH in the request.
22012 The OFFSET in the request is at the end of the data. There
22013 is no more data to be read.
22016 The request was malformed, or ANNEX was invalid.
22019 The offset was invalid, or there was an error encountered
22020 reading the data. NN is a hex-encoded `errno' value.
22023 An empty reply indicates the OBJECT string was not recognized
22024 by the stub, or that the object does not support reading.
22026 `qXfer:OBJECT:write:ANNEX:OFFSET:DATA...'
22027 Write uninterpreted bytes into the target's special data area
22028 identified by the keyword OBJECT, starting at OFFSET bytes into
22029 the data. `DATA...' is the binary-encoded data (*note Binary
22030 Data::) to be written. The content and encoding of ANNEX is
22031 specific to the object; it can supply additional details about
22032 what data to access.
22034 No requests of this form are presently in use. This specification
22035 serves as a placeholder to document the common format that new
22036 specific request specifications ought to use.
22040 NN (hex encoded) is the number of bytes written. This may be
22041 fewer bytes than supplied in the request.
22044 The request was malformed, or ANNEX was invalid.
22047 The offset was invalid, or there was an error encountered
22048 writing the data. NN is a hex-encoded `errno' value.
22051 An empty reply indicates the OBJECT string was not recognized
22052 by the stub, or that the object does not support writing.
22054 `qXfer:OBJECT:OPERATION:...'
22055 Requests of this form may be added in the future. When a stub does
22056 not recognize the OBJECT keyword, or its support for OBJECT does
22057 not recognize the OPERATION keyword, the stub must respond with an
22061 ---------- Footnotes ----------
22063 (1) The `qP' and `qL' packets predate these conventions, and have
22064 arguments without any terminator for the packet name; we suspect they
22065 are in widespread use in places that are difficult to upgrade. The
22066 `qC' packet has no arguments, but some existing stubs (e.g. RedBoot)
22067 are known to not check for the end of the packet.
22070 File: gdb.info, Node: Register Packet Format, Next: Tracepoint Packets, Prev: General Query Packets, Up: Remote Protocol
22072 D.5 Register Packet Format
22073 ==========================
22075 The following `g'/`G' packets have previously been defined. In the
22076 below, some thirty-two bit registers are transferred as sixty-four
22077 bits. Those registers should be zero/sign extended (which?) to fill
22078 the space allocated. Register bytes are transferred in target byte
22079 order. The two nibbles within a register byte are transferred
22080 most-significant - least-significant.
22083 All registers are transferred as thirty-two bit quantities in the
22084 order: 32 general-purpose; sr; lo; hi; bad; cause; pc; 32
22085 floating-point registers; fsr; fir; fp.
22088 All registers are transferred as sixty-four bit quantities
22089 (including thirty-two bit registers such as `sr'). The ordering
22090 is the same as `MIPS32'.
22094 File: gdb.info, Node: Tracepoint Packets, Next: Interrupts, Prev: Register Packet Format, Up: Remote Protocol
22096 D.6 Tracepoint Packets
22097 ======================
22099 Here we describe the packets GDB uses to implement tracepoints (*note
22102 `QTDP:N:ADDR:ENA:STEP:PASS[-]'
22103 Create a new tracepoint, number N, at ADDR. If ENA is `E', then
22104 the tracepoint is enabled; if it is `D', then the tracepoint is
22105 disabled. STEP is the tracepoint's step count, and PASS is its
22106 pass count. If the trailing `-' is present, further `QTDP'
22107 packets will follow to specify this tracepoint's actions.
22111 The packet was understood and carried out.
22114 The packet was not recognized.
22116 `QTDP:-N:ADDR:[S]ACTION...[-]'
22117 Define actions to be taken when a tracepoint is hit. N and ADDR
22118 must be the same as in the initial `QTDP' packet for this
22119 tracepoint. This packet may only be sent immediately after
22120 another `QTDP' packet that ended with a `-'. If the trailing `-'
22121 is present, further `QTDP' packets will follow, specifying more
22122 actions for this tracepoint.
22124 In the series of action packets for a given tracepoint, at most one
22125 can have an `S' before its first ACTION. If such a packet is
22126 sent, it and the following packets define "while-stepping"
22127 actions. Any prior packets define ordinary actions -- that is,
22128 those taken when the tracepoint is first hit. If no action packet
22129 has an `S', then all the packets in the series specify ordinary
22130 tracepoint actions.
22132 The `ACTION...' portion of the packet is a series of actions,
22133 concatenated without separators. Each action has one of the
22137 Collect the registers whose bits are set in MASK. MASK is a
22138 hexadecimal number whose I'th bit is set if register number I
22139 should be collected. (The least significant bit is numbered
22140 zero.) Note that MASK may be any number of digits long; it
22141 may not fit in a 32-bit word.
22143 `M BASEREG,OFFSET,LEN'
22144 Collect LEN bytes of memory starting at the address in
22145 register number BASEREG, plus OFFSET. If BASEREG is `-1',
22146 then the range has a fixed address: OFFSET is the address of
22147 the lowest byte to collect. The BASEREG, OFFSET, and LEN
22148 parameters are all unsigned hexadecimal values (the `-1'
22149 value for BASEREG is a special case).
22152 Evaluate EXPR, whose length is LEN, and collect memory as it
22153 directs. EXPR is an agent expression, as described in *Note
22154 Agent Expressions::. Each byte of the expression is encoded
22155 as a two-digit hex number in the packet; LEN is the number of
22156 bytes in the expression (and thus one-half the number of hex
22157 digits in the packet).
22160 Any number of actions may be packed together in a single `QTDP'
22161 packet, as long as the packet does not exceed the maximum packet
22162 length (400 bytes, for many stubs). There may be only one `R'
22163 action per tracepoint, and it must precede any `M' or `X' actions.
22164 Any registers referred to by `M' and `X' actions must be
22165 collected by a preceding `R' action. (The "while-stepping"
22166 actions are treated as if they were attached to a separate
22167 tracepoint, as far as these restrictions are concerned.)
22171 The packet was understood and carried out.
22174 The packet was not recognized.
22177 Select the N'th tracepoint frame from the buffer, and use the
22178 register and memory contents recorded there to answer subsequent
22179 request packets from GDB.
22181 A successful reply from the stub indicates that the stub has found
22182 the requested frame. The response is a series of parts,
22183 concatenated without separators, describing the frame we selected.
22184 Each part has one of the following forms:
22187 The selected frame is number N in the trace frame buffer; F
22188 is a hexadecimal number. If F is `-1', then there was no
22189 frame matching the criteria in the request packet.
22192 The selected trace frame records a hit of tracepoint number T;
22193 T is a hexadecimal number.
22197 Like `QTFrame:N', but select the first tracepoint frame after the
22198 currently selected frame whose PC is ADDR; ADDR is a hexadecimal
22202 Like `QTFrame:N', but select the first tracepoint frame after the
22203 currently selected frame that is a hit of tracepoint T; T is a
22204 hexadecimal number.
22206 `QTFrame:range:START:END'
22207 Like `QTFrame:N', but select the first tracepoint frame after the
22208 currently selected frame whose PC is between START (inclusive) and
22209 END (exclusive); START and END are hexadecimal numbers.
22211 `QTFrame:outside:START:END'
22212 Like `QTFrame:range:START:END', but select the first frame
22213 _outside_ the given range of addresses.
22216 Begin the tracepoint experiment. Begin collecting data from
22217 tracepoint hits in the trace frame buffer.
22220 End the tracepoint experiment. Stop collecting trace frames.
22223 Clear the table of tracepoints, and empty the trace frame buffer.
22225 `QTro:START1,END1:START2,END2:...'
22226 Establish the given ranges of memory as "transparent". The stub
22227 will answer requests for these ranges from memory's current
22228 contents, if they were not collected as part of the tracepoint hit.
22230 GDB uses this to mark read-only regions of memory, like those
22231 containing program code. Since these areas never change, they
22232 should still have the same contents they did when the tracepoint
22233 was hit, so there's no reason for the stub to refuse to provide
22237 Ask the stub if there is a trace experiment running right now.
22241 There is no trace experiment running.
22244 There is a trace experiment running.
22248 File: gdb.info, Node: Interrupts, Next: Examples, Prev: Tracepoint Packets, Up: Remote Protocol
22253 When a program on the remote target is running, GDB may attempt to
22254 interrupt it by sending a `Ctrl-C' or a `BREAK', control of which is
22255 specified via GDB's `remotebreak' setting (*note set remotebreak::).
22257 The precise meaning of `BREAK' is defined by the transport mechanism
22258 and may, in fact, be undefined. GDB does not currently define a
22259 `BREAK' mechanism for any of the network interfaces.
22261 `Ctrl-C', on the other hand, is defined and implemented for all
22262 transport mechanisms. It is represented by sending the single byte
22263 `0x03' without any of the usual packet overhead described in the
22264 Overview section (*note Overview::). When a `0x03' byte is transmitted
22265 as part of a packet, it is considered to be packet data and does _not_
22266 represent an interrupt. E.g., an `X' packet (*note X packet::), used
22267 for binary downloads, may include an unescaped `0x03' as part of its
22270 Stubs are not required to recognize these interrupt mechanisms and
22271 the precise meaning associated with receipt of the interrupt is
22272 implementation defined. If the stub is successful at interrupting the
22273 running program, it is expected that it will send one of the Stop Reply
22274 Packets (*note Stop Reply Packets::) to GDB as a result of successfully
22275 stopping the program. Interrupts received while the program is stopped
22279 File: gdb.info, Node: Examples, Next: File-I/O remote protocol extension, Prev: Interrupts, Up: Remote Protocol
22284 Example sequence of a target being re-started. Notice how the restart
22285 does not get any direct output:
22292 <- `T001:1234123412341234'
22295 Example sequence of a target being stepped by a single instruction:
22302 <- `T001:1234123412341234'
22310 File: gdb.info, Node: File-I/O remote protocol extension, Next: Memory map format, Prev: Examples, Up: Remote Protocol
22312 D.9 File-I/O remote protocol extension
22313 ======================================
22317 * File-I/O Overview::
22318 * Protocol basics::
22319 * The F request packet::
22320 * The F reply packet::
22321 * The Ctrl-C message::
22323 * List of supported calls::
22324 * Protocol specific representation of datatypes::
22326 * File-I/O Examples::
22329 File: gdb.info, Node: File-I/O Overview, Next: Protocol basics, Up: File-I/O remote protocol extension
22331 D.9.1 File-I/O Overview
22332 -----------------------
22334 The "File I/O remote protocol extension" (short: File-I/O) allows the
22335 target to use the host's file system and console I/O to perform various
22336 system calls. System calls on the target system are translated into a
22337 remote protocol packet to the host system, which then performs the
22338 needed actions and returns a response packet to the target system.
22339 This simulates file system operations even on targets that lack file
22342 The protocol is defined to be independent of both the host and
22343 target systems. It uses its own internal representation of datatypes
22344 and values. Both GDB and the target's GDB stub are responsible for
22345 translating the system-dependent value representations into the internal
22346 protocol representations when data is transmitted.
22348 The communication is synchronous. A system call is possible only
22349 when GDB is waiting for a response from the `C', `c', `S' or `s'
22350 packets. While GDB handles the request for a system call, the target
22351 is stopped to allow deterministic access to the target's memory.
22352 Therefore File-I/O is not interruptible by target signals. On the
22353 other hand, it is possible to interrupt File-I/O by a user interrupt
22354 (`Ctrl-C') within GDB.
22356 The target's request to perform a host system call does not finish
22357 the latest `C', `c', `S' or `s' action. That means, after finishing
22358 the system call, the target returns to continuing the previous activity
22359 (continue, step). No additional continue or step request from GDB is
22363 <- target requests 'system call X'
22364 target is stopped, GDB executes system call
22365 -> GDB returns result
22366 ... target continues, GDB returns to wait for the target
22367 <- target hits breakpoint and sends a Txx packet
22369 The protocol only supports I/O on the console and to regular files on
22370 the host file system. Character or block special devices, pipes, named
22371 pipes, sockets or any other communication method on the host system are
22372 not supported by this protocol.
22375 File: gdb.info, Node: Protocol basics, Next: The F request packet, Prev: File-I/O Overview, Up: File-I/O remote protocol extension
22377 D.9.2 Protocol basics
22378 ---------------------
22380 The File-I/O protocol uses the `F' packet as the request as well as
22381 reply packet. Since a File-I/O system call can only occur when GDB is
22382 waiting for a response from the continuing or stepping target, the
22383 File-I/O request is a reply that GDB has to expect as a result of a
22384 previous `C', `c', `S' or `s' packet. This `F' packet contains all
22385 information needed to allow GDB to call the appropriate host system
22388 * A unique identifier for the requested system call.
22390 * All parameters to the system call. Pointers are given as addresses
22391 in the target memory address space. Pointers to strings are given
22392 as pointer/length pair. Numerical values are given as they are.
22393 Numerical control flags are given in a protocol specific
22397 At this point, GDB has to perform the following actions.
22399 * If the parameters include pointer values to data needed as input
22400 to a system call, GDB requests this data from the target with a
22401 standard `m' packet request. This additional communication has to
22402 be expected by the target implementation and is handled as any
22405 * GDB translates all value from protocol representation to host
22406 representation as needed. Datatypes are coerced into the host
22409 * GDB calls the system call.
22411 * It then coerces datatypes back to protocol representation.
22413 * If the system call is expected to return data in buffer space
22414 specified by pointer parameters to the call, the data is
22415 transmitted to the target using a `M' or `X' packet. This packet
22416 has to be expected by the target implementation and is handled as
22417 any other `M' or `X' packet.
22420 Eventually GDB replies with another `F' packet which contains all
22421 necessary information for the target to continue. This at least
22426 * `errno', if has been changed by the system call.
22431 After having done the needed type and value coercion, the target
22432 continues the latest continue or step action.
22435 File: gdb.info, Node: The F request packet, Next: The F reply packet, Prev: Protocol basics, Up: File-I/O remote protocol extension
22437 D.9.3 The `F' request packet
22438 ----------------------------
22440 The `F' request packet has the following format:
22442 `FCALL-ID,PARAMETER...'
22443 CALL-ID is the identifier to indicate the host system call to be
22444 called. This is just the name of the function.
22446 PARAMETER... are the parameters to the system call. Parameters
22447 are hexadecimal integer values, either the actual values in case
22448 of scalar datatypes, pointers to target buffer space in case of
22449 compound datatypes and unspecified memory areas, or pointer/length
22450 pairs in case of string parameters. These are appended to the
22451 CALL-ID as a comma-delimited list. All values are transmitted in
22452 ASCII string representation, pointer/length pairs separated by a
22457 File: gdb.info, Node: The F reply packet, Next: The Ctrl-C message, Prev: The F request packet, Up: File-I/O remote protocol extension
22459 D.9.4 The `F' reply packet
22460 --------------------------
22462 The `F' reply packet has the following format:
22464 `FRETCODE,ERRNO,CTRL-C FLAG;CALL SPECIFIC ATTACHMENT'
22465 RETCODE is the return code of the system call as hexadecimal value.
22467 ERRNO is the `errno' set by the call, in protocol specific
22468 representation. This parameter can be omitted if the call was
22471 CTRL-C FLAG is only sent if the user requested a break. In this
22472 case, ERRNO must be sent as well, even if the call was successful.
22473 The CTRL-C FLAG itself consists of the character `C':
22477 or, if the call was interrupted before the host call has been
22482 assuming 4 is the protocol specific representation of `EINTR'.
22486 File: gdb.info, Node: The Ctrl-C message, Next: Console I/O, Prev: The F reply packet, Up: File-I/O remote protocol extension
22488 D.9.5 The `Ctrl-C' message
22489 --------------------------
22491 If the `Ctrl-C' flag is set in the GDB reply packet (*note The F reply
22492 packet::), the target should behave as if it had gotten a break
22493 message. The meaning for the target is "system call interrupted by
22494 `SIGINT'". Consequentially, the target should actually stop (as with a
22495 break message) and return to GDB with a `T02' packet.
22497 It's important for the target to know in which state the system call
22498 was interrupted. There are two possible cases:
22500 * The system call hasn't been performed on the host yet.
22502 * The system call on the host has been finished.
22505 These two states can be distinguished by the target by the value of
22506 the returned `errno'. If it's the protocol representation of `EINTR',
22507 the system call hasn't been performed. This is equivalent to the
22508 `EINTR' handling on POSIX systems. In any other case, the target may
22509 presume that the system call has been finished -- successfully or not
22510 -- and should behave as if the break message arrived right after the
22513 GDB must behave reliably. If the system call has not been called
22514 yet, GDB may send the `F' reply immediately, setting `EINTR' as `errno'
22515 in the packet. If the system call on the host has been finished before
22516 the user requests a break, the full action must be finished by GDB.
22517 This requires sending `M' or `X' packets as necessary. The `F' packet
22518 may only be sent when either nothing has happened or the full action
22519 has been completed.
22522 File: gdb.info, Node: Console I/O, Next: List of supported calls, Prev: The Ctrl-C message, Up: File-I/O remote protocol extension
22527 By default and if not explicitely closed by the target system, the file
22528 descriptors 0, 1 and 2 are connected to the GDB console. Output on the
22529 GDB console is handled as any other file output operation (`write(1,
22530 ...)' or `write(2, ...)'). Console input is handled by GDB so that
22531 after the target read request from file descriptor 0 all following
22532 typing is buffered until either one of the following conditions is met:
22534 * The user types `Ctrl-c'. The behaviour is as explained above, and
22535 the `read' system call is treated as finished.
22537 * The user presses <RET>. This is treated as end of input with a
22540 * The user types `Ctrl-d'. This is treated as end of input. No
22541 trailing character (neither newline nor `Ctrl-D') is appended to
22545 If the user has typed more characters than fit in the buffer given to
22546 the `read' call, the trailing characters are buffered in GDB until
22547 either another `read(0, ...)' is requested by the target, or debugging
22548 is stopped at the user's request.
22551 File: gdb.info, Node: List of supported calls, Next: Protocol specific representation of datatypes, Prev: Console I/O, Up: File-I/O remote protocol extension
22553 D.9.7 List of supported calls
22554 -----------------------------
22571 File: gdb.info, Node: open, Next: close, Up: List of supported calls
22577 int open(const char *pathname, int flags);
22578 int open(const char *pathname, int flags, mode_t mode);
22581 `Fopen,PATHPTR/LEN,FLAGS,MODE'
22583 FLAGS is the bitwise `OR' of the following values:
22586 If the file does not exist it will be created. The host
22587 rules apply as far as file ownership and time stamps are
22591 When used with `O_CREAT', if the file already exists it is an
22592 error and open() fails.
22595 If the file already exists and the open mode allows writing
22596 (`O_RDWR' or `O_WRONLY' is given) it will be truncated to
22600 The file is opened in append mode.
22603 The file is opened for reading only.
22606 The file is opened for writing only.
22609 The file is opened for reading and writing.
22611 Other bits are silently ignored.
22613 MODE is the bitwise `OR' of the following values:
22616 User has read permission.
22619 User has write permission.
22622 Group has read permission.
22625 Group has write permission.
22628 Others have read permission.
22631 Others have write permission.
22633 Other bits are silently ignored.
22636 `open' returns the new file descriptor or -1 if an error occurred.
22641 PATHNAME already exists and `O_CREAT' and `O_EXCL' were used.
22644 PATHNAME refers to a directory.
22647 The requested access is not allowed.
22650 PATHNAME was too long.
22653 A directory component in PATHNAME does not exist.
22656 PATHNAME refers to a device, pipe, named pipe or socket.
22659 PATHNAME refers to a file on a read-only filesystem and write
22660 access was requested.
22663 PATHNAME is an invalid pointer value.
22666 No space on device to create the file.
22669 The process already has the maximum number of files open.
22672 The limit on the total number of files open on the system has
22676 The call was interrupted by the user.
22680 File: gdb.info, Node: close, Next: read, Prev: open, Up: List of supported calls
22692 `close' returns zero on success, or -1 if an error occurred.
22697 FD isn't a valid open file descriptor.
22700 The call was interrupted by the user.
22704 File: gdb.info, Node: read, Next: write, Prev: close, Up: List of supported calls
22710 int read(int fd, void *buf, unsigned int count);
22713 `Fread,FD,BUFPTR,COUNT'
22716 On success, the number of bytes read is returned. Zero indicates
22717 end of file. If count is zero, read returns zero as well. On
22718 error, -1 is returned.
22723 FD is not a valid file descriptor or is not open for reading.
22726 BUFPTR is an invalid pointer value.
22729 The call was interrupted by the user.
22733 File: gdb.info, Node: write, Next: lseek, Prev: read, Up: List of supported calls
22739 int write(int fd, const void *buf, unsigned int count);
22742 `Fwrite,FD,BUFPTR,COUNT'
22745 On success, the number of bytes written are returned. Zero
22746 indicates nothing was written. On error, -1 is returned.
22751 FD is not a valid file descriptor or is not open for writing.
22754 BUFPTR is an invalid pointer value.
22757 An attempt was made to write a file that exceeds the host
22758 specific maximum file size allowed.
22761 No space on device to write the data.
22764 The call was interrupted by the user.
22768 File: gdb.info, Node: lseek, Next: rename, Prev: write, Up: List of supported calls
22774 long lseek (int fd, long offset, int flag);
22777 `Flseek,FD,OFFSET,FLAG'
22782 The offset is set to OFFSET bytes.
22785 The offset is set to its current location plus OFFSET bytes.
22788 The offset is set to the size of the file plus OFFSET bytes.
22791 On success, the resulting unsigned offset in bytes from the
22792 beginning of the file is returned. Otherwise, a value of -1 is
22798 FD is not a valid open file descriptor.
22801 FD is associated with the GDB console.
22804 FLAG is not a proper value.
22807 The call was interrupted by the user.
22811 File: gdb.info, Node: rename, Next: unlink, Prev: lseek, Up: List of supported calls
22817 int rename(const char *oldpath, const char *newpath);
22820 `Frename,OLDPATHPTR/LEN,NEWPATHPTR/LEN'
22823 On success, zero is returned. On error, -1 is returned.
22828 NEWPATH is an existing directory, but OLDPATH is not a
22832 NEWPATH is a non-empty directory.
22835 OLDPATH or NEWPATH is a directory that is in use by some
22839 An attempt was made to make a directory a subdirectory of
22843 A component used as a directory in OLDPATH or new path is
22844 not a directory. Or OLDPATH is a directory and NEWPATH
22845 exists but is not a directory.
22848 OLDPATHPTR or NEWPATHPTR are invalid pointer values.
22851 No access to the file or the path of the file.
22854 OLDPATH or NEWPATH was too long.
22857 A directory component in OLDPATH or NEWPATH does not exist.
22860 The file is on a read-only filesystem.
22863 The device containing the file has no room for the new
22867 The call was interrupted by the user.
22871 File: gdb.info, Node: unlink, Next: stat/fstat, Prev: rename, Up: List of supported calls
22877 int unlink(const char *pathname);
22880 `Funlink,PATHNAMEPTR/LEN'
22883 On success, zero is returned. On error, -1 is returned.
22888 No access to the file or the path of the file.
22891 The system does not allow unlinking of directories.
22894 The file PATHNAME cannot be unlinked because it's being used
22895 by another process.
22898 PATHNAMEPTR is an invalid pointer value.
22901 PATHNAME was too long.
22904 A directory component in PATHNAME does not exist.
22907 A component of the path is not a directory.
22910 The file is on a read-only filesystem.
22913 The call was interrupted by the user.
22917 File: gdb.info, Node: stat/fstat, Next: gettimeofday, Prev: unlink, Up: List of supported calls
22923 int stat(const char *pathname, struct stat *buf);
22924 int fstat(int fd, struct stat *buf);
22927 `Fstat,PATHNAMEPTR/LEN,BUFPTR'
22931 On success, zero is returned. On error, -1 is returned.
22936 FD is not a valid open file.
22939 A directory component in PATHNAME does not exist or the path
22940 is an empty string.
22943 A component of the path is not a directory.
22946 PATHNAMEPTR is an invalid pointer value.
22949 No access to the file or the path of the file.
22952 PATHNAME was too long.
22955 The call was interrupted by the user.
22959 File: gdb.info, Node: gettimeofday, Next: isatty, Prev: stat/fstat, Up: List of supported calls
22965 int gettimeofday(struct timeval *tv, void *tz);
22968 `Fgettimeofday,TVPTR,TZPTR'
22971 On success, 0 is returned, -1 otherwise.
22976 TZ is a non-NULL pointer.
22979 TVPTR and/or TZPTR is an invalid pointer value.
22983 File: gdb.info, Node: isatty, Next: system, Prev: gettimeofday, Up: List of supported calls
22989 int isatty(int fd);
22995 Returns 1 if FD refers to the GDB console, 0 otherwise.
23000 The call was interrupted by the user.
23003 Note that the `isatty' call is treated as a special case: it returns
23004 1 to the target if the file descriptor is attached to the GDB console,
23005 0 otherwise. Implementing through system calls would require
23006 implementing `ioctl' and would be more complex than needed.
23009 File: gdb.info, Node: system, Prev: isatty, Up: List of supported calls
23015 int system(const char *command);
23018 `Fsystem,COMMANDPTR/LEN'
23021 If LEN is zero, the return value indicates whether a shell is
23022 available. A zero return value indicates a shell is not available.
23023 For non-zero LEN, the value returned is -1 on error and the return
23024 status of the command otherwise. Only the exit status of the
23025 command is returned, which is extracted from the host's `system'
23026 return value by calling `WEXITSTATUS(retval)'. In case `/bin/sh'
23027 could not be executed, 127 is returned.
23032 The call was interrupted by the user.
23035 GDB takes over the full task of calling the necessary host calls to
23036 perform the `system' call. The return value of `system' on the host is
23037 simplified before it's returned to the target. Any termination signal
23038 information from the child process is discarded, and the return value
23039 consists entirely of the exit status of the called command.
23041 Due to security concerns, the `system' call is by default refused by
23042 GDB. The user has to allow this call explicitly with the `set remote
23043 system-call-allowed 1' command.
23045 `set remote system-call-allowed'
23046 Control whether to allow the `system' calls in the File I/O
23047 protocol for the remote target. The default is zero (disabled).
23049 `show remote system-call-allowed'
23050 Show whether the `system' calls are allowed in the File I/O
23054 File: gdb.info, Node: Protocol specific representation of datatypes, Next: Constants, Prev: List of supported calls, Up: File-I/O remote protocol extension
23056 D.9.8 Protocol specific representation of datatypes
23057 ---------------------------------------------------
23061 * Integral datatypes::
23063 * Memory transfer::
23068 File: gdb.info, Node: Integral datatypes, Next: Pointer values, Up: Protocol specific representation of datatypes
23073 The integral datatypes used in the system calls are `int', `unsigned
23074 int', `long', `unsigned long', `mode_t', and `time_t'.
23076 `int', `unsigned int', `mode_t' and `time_t' are implemented as 32
23077 bit values in this protocol.
23079 `long' and `unsigned long' are implemented as 64 bit types.
23081 *Note Limits::, for corresponding MIN and MAX values (similar to
23082 those in `limits.h') to allow range checking on host and target.
23084 `time_t' datatypes are defined as seconds since the Epoch.
23086 All integral datatypes transferred as part of a memory read or write
23087 of a structured datatype e.g. a `struct stat' have to be given in big
23091 File: gdb.info, Node: Pointer values, Next: Memory transfer, Prev: Integral datatypes, Up: Protocol specific representation of datatypes
23096 Pointers to target data are transmitted as they are. An exception is
23097 made for pointers to buffers for which the length isn't transmitted as
23098 part of the function call, namely strings. Strings are transmitted as
23099 a pointer/length pair, both as hex values, e.g.
23103 which is a pointer to data of length 18 bytes at position 0x1aaf. The
23104 length is defined as the full string length in bytes, including the
23105 trailing null byte. For example, the string `"hello world"' at address
23106 0x123456 is transmitted as
23111 File: gdb.info, Node: Memory transfer, Next: struct stat, Prev: Pointer values, Up: Protocol specific representation of datatypes
23116 Structured data which is transferred using a memory read or write (for
23117 example, a `struct stat') is expected to be in a protocol specific
23118 format with all scalar multibyte datatypes being big endian.
23119 Translation to this representation needs to be done both by the target
23120 before the `F' packet is sent, and by GDB before it transfers memory to
23121 the target. Transferred pointers to structured data should point to
23122 the already-coerced data at any time.
23125 File: gdb.info, Node: struct stat, Next: struct timeval, Prev: Memory transfer, Up: Protocol specific representation of datatypes
23130 The buffer of type `struct stat' used by the target and GDB is defined
23134 unsigned int st_dev; /* device */
23135 unsigned int st_ino; /* inode */
23136 mode_t st_mode; /* protection */
23137 unsigned int st_nlink; /* number of hard links */
23138 unsigned int st_uid; /* user ID of owner */
23139 unsigned int st_gid; /* group ID of owner */
23140 unsigned int st_rdev; /* device type (if inode device) */
23141 unsigned long st_size; /* total size, in bytes */
23142 unsigned long st_blksize; /* blocksize for filesystem I/O */
23143 unsigned long st_blocks; /* number of blocks allocated */
23144 time_t st_atime; /* time of last access */
23145 time_t st_mtime; /* time of last modification */
23146 time_t st_ctime; /* time of last change */
23149 The integral datatypes conform to the definitions given in the
23150 appropriate section (see *Note Integral datatypes::, for details) so
23151 this structure is of size 64 bytes.
23153 The values of several fields have a restricted meaning and/or range
23157 A value of 0 represents a file, 1 the console.
23160 No valid meaning for the target. Transmitted unchanged.
23163 Valid mode bits are described in *Note Constants::. Any other
23164 bits have currently no meaning for the target.
23169 No valid meaning for the target. Transmitted unchanged.
23174 These values have a host and file system dependent accuracy.
23175 Especially on Windows hosts, the file system may not support exact
23178 The target gets a `struct stat' of the above representation and is
23179 responsible for coercing it to the target representation before
23182 Note that due to size differences between the host, target, and
23183 protocol representations of `struct stat' members, these members could
23184 eventually get truncated on the target.
23187 File: gdb.info, Node: struct timeval, Prev: struct stat, Up: Protocol specific representation of datatypes
23192 The buffer of type `struct timeval' used by the File-I/O protocol is
23193 defined as follows:
23196 time_t tv_sec; /* second */
23197 long tv_usec; /* microsecond */
23200 The integral datatypes conform to the definitions given in the
23201 appropriate section (see *Note Integral datatypes::, for details) so
23202 this structure is of size 8 bytes.
23205 File: gdb.info, Node: Constants, Next: File-I/O Examples, Prev: Protocol specific representation of datatypes, Up: File-I/O remote protocol extension
23210 The following values are used for the constants inside of the protocol.
23211 GDB and target are responsible for translating these values before and
23212 after the call as needed.
23223 File: gdb.info, Node: Open flags, Next: mode_t values, Up: Constants
23228 All values are given in hexadecimal representation.
23239 File: gdb.info, Node: mode_t values, Next: Errno values, Prev: Open flags, Up: Constants
23244 All values are given in octal representation.
23259 File: gdb.info, Node: Errno values, Next: Lseek flags, Prev: mode_t values, Up: Constants
23264 All values are given in decimal representation.
23287 `EUNKNOWN' is used as a fallback error value if a host system returns
23288 any error value not in the list of supported error numbers.
23291 File: gdb.info, Node: Lseek flags, Next: Limits, Prev: Errno values, Up: Constants
23301 File: gdb.info, Node: Limits, Prev: Lseek flags, Up: Constants
23306 All values are given in decimal representation.
23308 INT_MIN -2147483648
23310 UINT_MAX 4294967295
23311 LONG_MIN -9223372036854775808
23312 LONG_MAX 9223372036854775807
23313 ULONG_MAX 18446744073709551615
23316 File: gdb.info, Node: File-I/O Examples, Prev: Constants, Up: File-I/O remote protocol extension
23318 D.9.10 File-I/O Examples
23319 ------------------------
23321 Example sequence of a write call, file descriptor 3, buffer is at target
23322 address 0x1234, 6 bytes should be written:
23324 <- `Fwrite,3,1234,6'
23325 _request memory read from target_
23328 _return "6 bytes written"_
23331 Example sequence of a read call, file descriptor 3, buffer is at
23332 target address 0x1234, 6 bytes should be read:
23334 <- `Fread,3,1234,6'
23335 _request memory write to target_
23336 -> `X1234,6:XXXXXX'
23337 _return "6 bytes read"_
23340 Example sequence of a read call, call fails on the host due to
23341 invalid file descriptor (`EBADF'):
23343 <- `Fread,3,1234,6'
23346 Example sequence of a read call, user presses `Ctrl-c' before
23347 syscall on host is called:
23349 <- `Fread,3,1234,6'
23353 Example sequence of a read call, user presses `Ctrl-c' after syscall
23356 <- `Fread,3,1234,6'
23357 -> `X1234,6:XXXXXX'
23361 File: gdb.info, Node: Memory map format, Prev: File-I/O remote protocol extension, Up: Remote Protocol
23363 D.10 Memory map format
23364 ======================
23366 To be able to write into flash memory, GDB needs to obtain a memory map
23367 from the target. This section describes the format of the memory map.
23369 The memory map is obtained using the `qXfer:memory-map:read' (*note
23370 qXfer memory map read::) packet and is an XML document that lists
23371 memory regions. The top-level structure of the document is shown below:
23373 <?xml version="1.0"?>
23374 <!DOCTYPE memory-map
23375 PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
23376 "http://sourceware.org/gdb/gdb-memory-map.dtd">
23381 Each region can be either:
23383 * A region of RAM starting at ADDR and extending for LENGTH bytes
23386 <memory type="ram" start="ADDR" length="LENGTH"/>
23388 * A region of read-only memory:
23390 <memory type="rom" start="ADDR" length="LENGTH"/>
23392 * A region of flash memory, with erasure blocks BLOCKSIZE bytes in
23395 <memory type="flash" start="ADDR" length="LENGTH">
23396 <property name="blocksize">BLOCKSIZE</property>
23400 Regions must not overlap. GDB assumes that areas of memory not
23401 covered by the memory map are RAM, and uses the ordinary `M' and `X'
23402 packets to write to addresses in such ranges.
23404 The formal DTD for memory map format is given below:
23406 <!-- ................................................... -->
23407 <!-- Memory Map XML DTD ................................ -->
23408 <!-- File: memory-map.dtd .............................. -->
23409 <!-- .................................... .............. -->
23410 <!-- memory-map.dtd -->
23411 <!-- memory-map: Root element with versioning -->
23412 <!ELEMENT memory-map (memory | property)>
23413 <!ATTLIST memory-map version CDATA #FIXED "1.0.0">
23414 <!ELEMENT memory (property)>
23415 <!-- memory: Specifies a memory region,
23416 and its type, or device. -->
23417 <!ATTLIST memory type CDATA #REQUIRED
23418 start CDATA #REQUIRED
23419 length CDATA #REQUIRED
23420 device CDATA #IMPLIED>
23421 <!-- property: Generic attribute tag -->
23422 <!ELEMENT property (#PCDATA | property)*>
23423 <!ATTLIST property name CDATA #REQUIRED>
23426 File: gdb.info, Node: Agent Expressions, Next: Copying, Prev: Remote Protocol, Up: Top
23428 Appendix E The GDB Agent Expression Mechanism
23429 *********************************************
23431 In some applications, it is not feasable for the debugger to interrupt
23432 the program's execution long enough for the developer to learn anything
23433 helpful about its behavior. If the program's correctness depends on its
23434 real-time behavior, delays introduced by a debugger might cause the
23435 program to fail, even when the code itself is correct. It is useful to
23436 be able to observe the program's behavior without interrupting it.
23438 Using GDB's `trace' and `collect' commands, the user can specify
23439 locations in the program, and arbitrary expressions to evaluate when
23440 those locations are reached. Later, using the `tfind' command, she can
23441 examine the values those expressions had when the program hit the trace
23442 points. The expressions may also denote objects in memory --
23443 structures or arrays, for example -- whose values GDB should record;
23444 while visiting a particular tracepoint, the user may inspect those
23445 objects as if they were in memory at that moment. However, because GDB
23446 records these values without interacting with the user, it can do so
23447 quickly and unobtrusively, hopefully not disturbing the program's
23450 When GDB is debugging a remote target, the GDB "agent" code running
23451 on the target computes the values of the expressions itself. To avoid
23452 having a full symbolic expression evaluator on the agent, GDB translates
23453 expressions in the source language into a simpler bytecode language, and
23454 then sends the bytecode to the agent; the agent then executes the
23455 bytecode, and records the values for GDB to retrieve later.
23457 The bytecode language is simple; there are forty-odd opcodes, the
23458 bulk of which are the usual vocabulary of C operands (addition,
23459 subtraction, shifts, and so on) and various sizes of literals and
23460 memory reference operations. The bytecode interpreter operates
23461 strictly on machine-level values -- various sizes of integers and
23462 floating point numbers -- and requires no information about types or
23463 symbols; thus, the interpreter's internal data structures are simple,
23464 and each bytecode requires only a few native machine instructions to
23465 implement it. The interpreter is small, and strict limits on the
23466 memory and time required to evaluate an expression are easy to
23467 determine, making it suitable for use by the debugging agent in
23468 real-time applications.
23472 * General Bytecode Design:: Overview of the interpreter.
23473 * Bytecode Descriptions:: What each one does.
23474 * Using Agent Expressions:: How agent expressions fit into the big picture.
23475 * Varying Target Capabilities:: How to discover what the target can do.
23476 * Tracing on Symmetrix:: Special info for implementation on EMC's
23478 * Rationale:: Why we did it this way.
23481 File: gdb.info, Node: General Bytecode Design, Next: Bytecode Descriptions, Up: Agent Expressions
23483 E.1 General Bytecode Design
23484 ===========================
23486 The agent represents bytecode expressions as an array of bytes. Each
23487 instruction is one byte long (thus the term "bytecode"). Some
23488 instructions are followed by operand bytes; for example, the `goto'
23489 instruction is followed by a destination for the jump.
23491 The bytecode interpreter is a stack-based machine; most instructions
23492 pop their operands off the stack, perform some operation, and push the
23493 result back on the stack for the next instruction to consume. Each
23494 element of the stack may contain either a integer or a floating point
23495 value; these values are as many bits wide as the largest integer that
23496 can be directly manipulated in the source language. Stack elements
23497 carry no record of their type; bytecode could push a value as an
23498 integer, then pop it as a floating point value. However, GDB will not
23499 generate code which does this. In C, one might define the type of a
23500 stack element as follows:
23505 where `LONGEST' and `DOUBLEST' are `typedef' names for the largest
23506 integer and floating point types on the machine.
23508 By the time the bytecode interpreter reaches the end of the
23509 expression, the value of the expression should be the only value left
23510 on the stack. For tracing applications, `trace' bytecodes in the
23511 expression will have recorded the necessary data, and the value on the
23512 stack may be discarded. For other applications, like conditional
23513 breakpoints, the value may be useful.
23515 Separate from the stack, the interpreter has two registers:
23517 The address of the next bytecode to execute.
23520 The address of the start of the bytecode expression, necessary for
23521 interpreting the `goto' and `if_goto' instructions.
23523 Neither of these registers is directly visible to the bytecode
23524 language itself, but they are useful for defining the meanings of the
23525 bytecode operations.
23527 There are no instructions to perform side effects on the running
23528 program, or call the program's functions; we assume that these
23529 expressions are only used for unobtrusive debugging, not for patching
23532 Most bytecode instructions do not distinguish between the various
23533 sizes of values, and operate on full-width values; the upper bits of the
23534 values are simply ignored, since they do not usually make a difference
23535 to the value computed. The exceptions to this rule are:
23536 memory reference instructions (`ref'N)
23537 There are distinct instructions to fetch different word sizes from
23538 memory. Once on the stack, however, the values are treated as
23539 full-size integers. They may need to be sign-extended; the `ext'
23540 instruction exists for this purpose.
23542 the sign-extension instruction (`ext' N)
23543 These clearly need to know which portion of their operand is to be
23544 extended to occupy the full length of the word.
23547 If the interpreter is unable to evaluate an expression completely for
23548 some reason (a memory location is inaccessible, or a divisor is zero,
23549 for example), we say that interpretation "terminates with an error".
23550 This means that the problem is reported back to the interpreter's caller
23551 in some helpful way. In general, code using agent expressions should
23552 assume that they may attempt to divide by zero, fetch arbitrary memory
23553 locations, and misbehave in other ways.
23555 Even complicated C expressions compile to a few bytecode
23556 instructions; for example, the expression `x + y * z' would typically
23557 produce code like the following, assuming that `x' and `y' live in
23558 registers, and `z' is a global variable holding a 32-bit `int':
23561 const32 address of z
23568 In detail, these mean:
23570 Push the value of register 1 (presumably holding `x') onto the
23574 Push the value of register 2 (holding `y').
23576 `const32 address of z'
23577 Push the address of `z' onto the stack.
23580 Fetch a 32-bit word from the address at the top of the stack;
23581 replace the address on the stack with the value. Thus, we replace
23582 the address of `z' with `z''s value.
23585 Sign-extend the value on the top of the stack from 32 bits to full
23586 length. This is necessary because `z' is a signed integer.
23589 Pop the top two numbers on the stack, multiply them, and push their
23590 product. Now the top of the stack contains the value of the
23591 expression `y * z'.
23594 Pop the top two numbers, add them, and push the sum. Now the top
23595 of the stack contains the value of `x + y * z'.
23598 Stop executing; the value left on the stack top is the value to be
23603 File: gdb.info, Node: Bytecode Descriptions, Next: Using Agent Expressions, Prev: General Bytecode Design, Up: Agent Expressions
23605 E.2 Bytecode Descriptions
23606 =========================
23608 Each bytecode description has the following form:
23610 `add' (0x02): A B => A+B
23611 Pop the top two stack items, A and B, as integers; push their sum,
23615 In this example, `add' is the name of the bytecode, and `(0x02)' is
23616 the one-byte value used to encode the bytecode, in hexidecimal. The
23617 phrase "A B => A+B" shows the stack before and after the bytecode
23618 executes. Beforehand, the stack must contain at least two values, A
23619 and B; since the top of the stack is to the right, B is on the top of
23620 the stack, and A is underneath it. After execution, the bytecode will
23621 have popped A and B from the stack, and replaced them with a single
23622 value, A+B. There may be other values on the stack below those shown,
23623 but the bytecode affects only those shown.
23625 Here is another example:
23627 `const8' (0x22) N: => N
23628 Push the 8-bit integer constant N on the stack, without sign
23632 In this example, the bytecode `const8' takes an operand N directly
23633 from the bytecode stream; the operand follows the `const8' bytecode
23634 itself. We write any such operands immediately after the name of the
23635 bytecode, before the colon, and describe the exact encoding of the
23636 operand in the bytecode stream in the body of the bytecode description.
23638 For the `const8' bytecode, there are no stack items given before the
23639 =>; this simply means that the bytecode consumes no values from the
23640 stack. If a bytecode consumes no values, or produces no values, the
23641 list on either side of the => may be empty.
23643 If a value is written as A, B, or N, then the bytecode treats it as
23644 an integer. If a value is written is ADDR, then the bytecode treats it
23647 We do not fully describe the floating point operations here; although
23648 this design can be extended in a clean way to handle floating point
23649 values, they are not of immediate interest to the customer, so we avoid
23650 describing them, to save time.
23653 Prefix for floating-point bytecodes. Not implemented yet.
23655 `add' (0x02): A B => A+B
23656 Pop two integers from the stack, and push their sum, as an integer.
23658 `sub' (0x03): A B => A-B
23659 Pop two integers from the stack, subtract the top value from the
23660 next-to-top value, and push the difference.
23662 `mul' (0x04): A B => A*B
23663 Pop two integers from the stack, multiply them, and push the
23664 product on the stack. Note that, when one multiplies two N-bit
23665 numbers yielding another N-bit number, it is irrelevant whether the
23666 numbers are signed or not; the results are the same.
23668 `div_signed' (0x05): A B => A/B
23669 Pop two signed integers from the stack; divide the next-to-top
23670 value by the top value, and push the quotient. If the divisor is
23671 zero, terminate with an error.
23673 `div_unsigned' (0x06): A B => A/B
23674 Pop two unsigned integers from the stack; divide the next-to-top
23675 value by the top value, and push the quotient. If the divisor is
23676 zero, terminate with an error.
23678 `rem_signed' (0x07): A B => A MODULO B
23679 Pop two signed integers from the stack; divide the next-to-top
23680 value by the top value, and push the remainder. If the divisor is
23681 zero, terminate with an error.
23683 `rem_unsigned' (0x08): A B => A MODULO B
23684 Pop two unsigned integers from the stack; divide the next-to-top
23685 value by the top value, and push the remainder. If the divisor is
23686 zero, terminate with an error.
23688 `lsh' (0x09): A B => A<<B
23689 Pop two integers from the stack; let A be the next-to-top value,
23690 and B be the top value. Shift A left by B bits, and push the
23693 `rsh_signed' (0x0a): A B => `(signed)'A>>B
23694 Pop two integers from the stack; let A be the next-to-top value,
23695 and B be the top value. Shift A right by B bits, inserting copies
23696 of the top bit at the high end, and push the result.
23698 `rsh_unsigned' (0x0b): A B => A>>B
23699 Pop two integers from the stack; let A be the next-to-top value,
23700 and B be the top value. Shift A right by B bits, inserting zero
23701 bits at the high end, and push the result.
23703 `log_not' (0x0e): A => !A
23704 Pop an integer from the stack; if it is zero, push the value one;
23705 otherwise, push the value zero.
23707 `bit_and' (0x0f): A B => A&B
23708 Pop two integers from the stack, and push their bitwise `and'.
23710 `bit_or' (0x10): A B => A|B
23711 Pop two integers from the stack, and push their bitwise `or'.
23713 `bit_xor' (0x11): A B => A^B
23714 Pop two integers from the stack, and push their bitwise
23717 `bit_not' (0x12): A => ~A
23718 Pop an integer from the stack, and push its bitwise complement.
23720 `equal' (0x13): A B => A=B
23721 Pop two integers from the stack; if they are equal, push the value
23722 one; otherwise, push the value zero.
23724 `less_signed' (0x14): A B => A<B
23725 Pop two signed integers from the stack; if the next-to-top value
23726 is less than the top value, push the value one; otherwise, push
23729 `less_unsigned' (0x15): A B => A<B
23730 Pop two unsigned integers from the stack; if the next-to-top value
23731 is less than the top value, push the value one; otherwise, push
23734 `ext' (0x16) N: A => A, sign-extended from N bits
23735 Pop an unsigned value from the stack; treating it as an N-bit
23736 twos-complement value, extend it to full length. This means that
23737 all bits to the left of bit N-1 (where the least significant bit
23738 is bit 0) are set to the value of bit N-1. Note that N may be
23739 larger than or equal to the width of the stack elements of the
23740 bytecode engine; in this case, the bytecode should have no effect.
23742 The number of source bits to preserve, N, is encoded as a single
23743 byte unsigned integer following the `ext' bytecode.
23745 `zero_ext' (0x2a) N: A => A, zero-extended from N bits
23746 Pop an unsigned value from the stack; zero all but the bottom N
23747 bits. This means that all bits to the left of bit N-1 (where the
23748 least significant bit is bit 0) are set to the value of bit N-1.
23750 The number of source bits to preserve, N, is encoded as a single
23751 byte unsigned integer following the `zero_ext' bytecode.
23753 `ref8' (0x17): ADDR => A
23754 `ref16' (0x18): ADDR => A
23755 `ref32' (0x19): ADDR => A
23756 `ref64' (0x1a): ADDR => A
23757 Pop an address ADDR from the stack. For bytecode `ref'N, fetch an
23758 N-bit value from ADDR, using the natural target endianness. Push
23759 the fetched value as an unsigned integer.
23761 Note that ADDR may not be aligned in any particular way; the
23762 `refN' bytecodes should operate correctly for any address.
23764 If attempting to access memory at ADDR would cause a processor
23765 exception of some sort, terminate with an error.
23767 `ref_float' (0x1b): ADDR => D
23768 `ref_double' (0x1c): ADDR => D
23769 `ref_long_double' (0x1d): ADDR => D
23770 `l_to_d' (0x1e): A => D
23771 `d_to_l' (0x1f): D => A
23772 Not implemented yet.
23774 `dup' (0x28): A => A A
23775 Push another copy of the stack's top element.
23777 `swap' (0x2b): A B => B A
23778 Exchange the top two items on the stack.
23781 Discard the top value on the stack.
23783 `if_goto' (0x20) OFFSET: A =>
23784 Pop an integer off the stack; if it is non-zero, branch to the
23785 given offset in the bytecode string. Otherwise, continue to the
23786 next instruction in the bytecode stream. In other words, if A is
23787 non-zero, set the `pc' register to `start' + OFFSET. Thus, an
23788 offset of zero denotes the beginning of the expression.
23790 The OFFSET is stored as a sixteen-bit unsigned value, stored
23791 immediately following the `if_goto' bytecode. It is always stored
23792 most significant byte first, regardless of the target's normal
23793 endianness. The offset is not guaranteed to fall at any particular
23794 alignment within the bytecode stream; thus, on machines where
23795 fetching a 16-bit on an unaligned address raises an exception, you
23796 should fetch the offset one byte at a time.
23798 `goto' (0x21) OFFSET: =>
23799 Branch unconditionally to OFFSET; in other words, set the `pc'
23800 register to `start' + OFFSET.
23802 The offset is stored in the same way as for the `if_goto' bytecode.
23804 `const8' (0x22) N: => N
23805 `const16' (0x23) N: => N
23806 `const32' (0x24) N: => N
23807 `const64' (0x25) N: => N
23808 Push the integer constant N on the stack, without sign extension.
23809 To produce a small negative value, push a small twos-complement
23810 value, and then sign-extend it using the `ext' bytecode.
23812 The constant N is stored in the appropriate number of bytes
23813 following the `const'B bytecode. The constant N is always stored
23814 most significant byte first, regardless of the target's normal
23815 endianness. The constant is not guaranteed to fall at any
23816 particular alignment within the bytecode stream; thus, on machines
23817 where fetching a 16-bit on an unaligned address raises an
23818 exception, you should fetch N one byte at a time.
23820 `reg' (0x26) N: => A
23821 Push the value of register number N, without sign extension. The
23822 registers are numbered following GDB's conventions.
23824 The register number N is encoded as a 16-bit unsigned integer
23825 immediately following the `reg' bytecode. It is always stored most
23826 significant byte first, regardless of the target's normal
23827 endianness. The register number is not guaranteed to fall at any
23828 particular alignment within the bytecode stream; thus, on machines
23829 where fetching a 16-bit on an unaligned address raises an
23830 exception, you should fetch the register number one byte at a time.
23832 `trace' (0x0c): ADDR SIZE =>
23833 Record the contents of the SIZE bytes at ADDR in a trace buffer,
23834 for later retrieval by GDB.
23836 `trace_quick' (0x0d) SIZE: ADDR => ADDR
23837 Record the contents of the SIZE bytes at ADDR in a trace buffer,
23838 for later retrieval by GDB. SIZE is a single byte unsigned
23839 integer following the `trace' opcode.
23841 This bytecode is equivalent to the sequence `dup const8 SIZE
23842 trace', but we provide it anyway to save space in bytecode strings.
23844 `trace16' (0x30) SIZE: ADDR => ADDR
23845 Identical to trace_quick, except that SIZE is a 16-bit big-endian
23846 unsigned integer, not a single byte. This should probably have
23847 been named `trace_quick16', for consistency.
23850 Stop executing bytecode; the result should be the top element of
23851 the stack. If the purpose of the expression was to compute an
23852 lvalue or a range of memory, then the next-to-top of the stack is
23853 the lvalue's address, and the top of the stack is the lvalue's
23858 File: gdb.info, Node: Using Agent Expressions, Next: Varying Target Capabilities, Prev: Bytecode Descriptions, Up: Agent Expressions
23860 E.3 Using Agent Expressions
23861 ===========================
23863 Here is a sketch of a full non-stop debugging cycle, showing how agent
23864 expressions fit into the process.
23866 * The user selects trace points in the program's code at which GDB
23867 should collect data.
23869 * The user specifies expressions to evaluate at each trace point.
23870 These expressions may denote objects in memory, in which case
23871 those objects' contents are recorded as the program runs, or
23872 computed values, in which case the values themselves are recorded.
23874 * GDB transmits the tracepoints and their associated expressions to
23875 the GDB agent, running on the debugging target.
23877 * The agent arranges to be notified when a trace point is hit. Note
23878 that, on some systems, the target operating system is completely
23879 responsible for collecting the data; see *Note Tracing on
23882 * When execution on the target reaches a trace point, the agent
23883 evaluates the expressions associated with that trace point, and
23884 records the resulting values and memory ranges.
23886 * Later, when the user selects a given trace event and inspects the
23887 objects and expression values recorded, GDB talks to the agent to
23888 retrieve recorded data as necessary to meet the user's requests.
23889 If the user asks to see an object whose contents have not been
23890 recorded, GDB reports an error.
23894 File: gdb.info, Node: Varying Target Capabilities, Next: Tracing on Symmetrix, Prev: Using Agent Expressions, Up: Agent Expressions
23896 E.4 Varying Target Capabilities
23897 ===============================
23899 Some targets don't support floating-point, and some would rather not
23900 have to deal with `long long' operations. Also, different targets will
23901 have different stack sizes, and different bytecode buffer lengths.
23903 Thus, GDB needs a way to ask the target about itself. We haven't
23904 worked out the details yet, but in general, GDB should be able to send
23905 the target a packet asking it to describe itself. The reply should be a
23906 packet whose length is explicit, so we can add new information to the
23907 packet in future revisions of the agent, without confusing old versions
23908 of GDB, and it should contain a version number. It should contain at
23909 least the following information:
23911 * whether floating point is supported
23913 * whether `long long' is supported
23915 * maximum acceptable size of bytecode stack
23917 * maximum acceptable length of bytecode expressions
23919 * which registers are actually available for collection
23921 * whether the target supports disabled tracepoints
23925 File: gdb.info, Node: Tracing on Symmetrix, Next: Rationale, Prev: Varying Target Capabilities, Up: Agent Expressions
23927 E.5 Tracing on Symmetrix
23928 ========================
23930 This section documents the API used by the GDB agent to collect data on
23933 Cygnus originally implemented these tracing features to help EMC
23934 Corporation debug their Symmetrix high-availability disk drives. The
23935 Symmetrix application code already includes substantial tracing
23936 facilities; the GDB agent for the Symmetrix system uses those facilities
23937 for its own data collection, via the API described here.
23939 -- Function: DTC_RESPONSE adbg_find_memory_in_frame (FRAME_DEF *FRAME,
23940 char *ADDRESS, char **BUFFER, unsigned int *SIZE)
23941 Search the trace frame FRAME for memory saved from ADDRESS. If
23942 the memory is available, provide the address of the buffer holding
23943 it; otherwise, provide the address of the next saved area.
23945 * If the memory at ADDRESS was saved in FRAME, set `*BUFFER' to
23946 point to the buffer in which that memory was saved, set
23947 `*SIZE' to the number of bytes from ADDRESS that are saved at
23948 `*BUFFER', and return `OK_TARGET_RESPONSE'. (Clearly, in
23949 this case, the function will always set `*SIZE' to a value
23950 greater than zero.)
23952 * If FRAME does not record any memory at ADDRESS, set `*SIZE'
23953 to the distance from ADDRESS to the start of the saved region
23954 with the lowest address higher than ADDRESS. If there is no
23955 memory saved from any higher address, set `*SIZE' to zero.
23956 Return `NOT_FOUND_TARGET_RESPONSE'.
23958 These two possibilities allow the caller to either retrieve the
23959 data, or walk the address space to the next saved area.
23961 This function allows the GDB agent to map the regions of memory
23962 saved in a particular frame, and retrieve their contents efficiently.
23964 This function also provides a clean interface between the GDB agent
23965 and the Symmetrix tracing structures, making it easier to adapt the GDB
23966 agent to future versions of the Symmetrix system, and vice versa. This
23967 function searches all data saved in FRAME, whether the data is there at
23968 the request of a bytecode expression, or because it falls in one of the
23969 format's memory ranges, or because it was saved from the top of the
23970 stack. EMC can arbitrarily change and enhance the tracing mechanism,
23971 but as long as this function works properly, all collected memory is
23974 The function itself is straightforward to implement. A single pass
23975 over the trace frame's stack area, memory ranges, and expression blocks
23976 can yield the address of the buffer (if the requested address was
23977 saved), and also note the address of the next higher range of memory,
23978 to be returned when the search fails.
23980 As an example, suppose the trace frame `f' has saved sixteen bytes
23981 from address `0x8000' in a buffer at `0x1000', and thirty-two bytes
23982 from address `0xc000' in a buffer at `0x1010'. Here are some sample
23983 calls, and the effect each would have:
23985 `adbg_find_memory_in_frame (f, (char*) 0x8000, &buffer, &size)'
23986 This would set `buffer' to `0x1000', set `size' to sixteen, and
23987 return `OK_TARGET_RESPONSE', since `f' saves sixteen bytes from
23988 `0x8000' at `0x1000'.
23990 `adbg_find_memory_in_frame (f, (char *) 0x8004, &buffer, &size)'
23991 This would set `buffer' to `0x1004', set `size' to twelve, and
23992 return `OK_TARGET_RESPONSE', since `f' saves the twelve bytes from
23993 `0x8004' starting four bytes into the buffer at `0x1000'. This
23994 shows that request addresses may fall in the middle of saved
23995 areas; the function should return the address and size of the
23996 remainder of the buffer.
23998 `adbg_find_memory_in_frame (f, (char *) 0x8100, &buffer, &size)'
23999 This would set `size' to `0x3f00' and return
24000 `NOT_FOUND_TARGET_RESPONSE', since there is no memory saved in `f'
24001 from the address `0x8100', and the next memory available is at
24002 `0x8100 + 0x3f00', or `0xc000'. This shows that request addresses
24003 may fall outside of all saved memory ranges; the function should
24004 indicate the next saved area, if any.
24006 `adbg_find_memory_in_frame (f, (char *) 0x7000, &buffer, &size)'
24007 This would set `size' to `0x1000' and return
24008 `NOT_FOUND_TARGET_RESPONSE', since the next saved memory is at
24009 `0x7000 + 0x1000', or `0x8000'.
24011 `adbg_find_memory_in_frame (f, (char *) 0xf000, &buffer, &size)'
24012 This would set `size' to zero, and return
24013 `NOT_FOUND_TARGET_RESPONSE'. This shows how the function tells the
24014 caller that no further memory ranges have been saved.
24017 As another example, here is a function which will print out the
24018 addresses of all memory saved in the trace frame `frame' on the
24019 Symmetrix INLINES console:
24021 print_frame_addresses (FRAME_DEF *frame)
24025 unsigned long size;
24030 /* Either find out how much memory we have here, or discover
24031 where the next saved region is. */
24032 if (adbg_find_memory_in_frame (frame, addr, &buffer, &size)
24033 == OK_TARGET_RESPONSE)
24034 printp ("saved %x to %x\n", addr, addr + size);
24041 Note that there is not necessarily any connection between the order
24042 in which the data is saved in the trace frame, and the order in which
24043 `adbg_find_memory_in_frame' will return those memory ranges. The code
24044 above will always print the saved memory regions in order of increasing
24045 address, while the underlying frame structure might store the data in a
24048 [[This section should cover the rest of the Symmetrix functions the
24049 stub relies upon, too.]]
24052 File: gdb.info, Node: Rationale, Prev: Tracing on Symmetrix, Up: Agent Expressions
24057 Some of the design decisions apparent above are arguable.
24059 What about stack overflow/underflow?
24060 GDB should be able to query the target to discover its stack size.
24061 Given that information, GDB can determine at translation time
24062 whether a given expression will overflow the stack. But this spec
24063 isn't about what kinds of error-checking GDB ought to do.
24065 Why are you doing everything in LONGEST?
24066 Speed isn't important, but agent code size is; using LONGEST
24067 brings in a bunch of support code to do things like division, etc.
24068 So this is a serious concern.
24070 First, note that you don't need different bytecodes for different
24071 operand sizes. You can generate code without _knowing_ how big the
24072 stack elements actually are on the target. If the target only
24073 supports 32-bit ints, and you don't send any 64-bit bytecodes,
24074 everything just works. The observation here is that the MIPS and
24075 the Alpha have only fixed-size registers, and you can still get
24076 C's semantics even though most instructions only operate on
24077 full-sized words. You just need to make sure everything is
24078 properly sign-extended at the right times. So there is no need
24079 for 32- and 64-bit variants of the bytecodes. Just implement
24080 everything using the largest size you support.
24082 GDB should certainly check to see what sizes the target supports,
24083 so the user can get an error earlier, rather than later. But this
24084 information is not necessary for correctness.
24086 Why don't you have `>' or `<=' operators?
24087 I want to keep the interpreter small, and we don't need them. We
24088 can combine the `less_' opcodes with `log_not', and swap the order
24089 of the operands, yielding all four asymmetrical comparison
24090 operators. For example, `(x <= y)' is `! (x > y)', which is `! (y
24093 Why do you have `log_not'?
24094 Why do you have `ext'?
24095 Why do you have `zero_ext'?
24096 These are all easily synthesized from other instructions, but I
24097 expect them to be used frequently, and they're simple, so I
24098 include them to keep bytecode strings short.
24100 `log_not' is equivalent to `const8 0 equal'; it's used in half the
24101 relational operators.
24103 `ext N' is equivalent to `const8 S-N lsh const8 S-N rsh_signed',
24104 where S is the size of the stack elements; it follows `refM' and
24105 REG bytecodes when the value should be signed. See the next
24108 `zero_ext N' is equivalent to `constM MASK log_and'; it's used
24109 whenever we push the value of a register, because we can't assume
24110 the upper bits of the register aren't garbage.
24112 Why not have sign-extending variants of the `ref' operators?
24113 Because that would double the number of `ref' operators, and we
24114 need the `ext' bytecode anyway for accessing bitfields.
24116 Why not have constant-address variants of the `ref' operators?
24117 Because that would double the number of `ref' operators again, and
24118 `const32 ADDRESS ref32' is only one byte longer.
24120 Why do the `refN' operators have to support unaligned fetches?
24121 GDB will generate bytecode that fetches multi-byte values at
24122 unaligned addresses whenever the executable's debugging
24123 information tells it to. Furthermore, GDB does not know the value
24124 the pointer will have when GDB generates the bytecode, so it
24125 cannot determine whether a particular fetch will be aligned or not.
24127 In particular, structure bitfields may be several bytes long, but
24128 follow no alignment rules; members of packed structures are not
24129 necessarily aligned either.
24131 In general, there are many cases where unaligned references occur
24132 in correct C code, either at the programmer's explicit request, or
24133 at the compiler's discretion. Thus, it is simpler to make the GDB
24134 agent bytecodes work correctly in all circumstances than to make
24135 GDB guess in each case whether the compiler did the usual thing.
24137 Why are there no side-effecting operators?
24138 Because our current client doesn't want them? That's a cheap
24139 answer. I think the real answer is that I'm afraid of
24140 implementing function calls. We should re-visit this issue after
24141 the present contract is delivered.
24143 Why aren't the `goto' ops PC-relative?
24144 The interpreter has the base address around anyway for PC bounds
24145 checking, and it seemed simpler.
24147 Why is there only one offset size for the `goto' ops?
24148 Offsets are currently sixteen bits. I'm not happy with this
24151 Suppose we have multiple branch ops with different offset sizes.
24152 As I generate code left-to-right, all my jumps are forward jumps
24153 (there are no loops in expressions), so I never know the target
24154 when I emit the jump opcode. Thus, I have to either always assume
24155 the largest offset size, or do jump relaxation on the code after I
24156 generate it, which seems like a big waste of time.
24158 I can imagine a reasonable expression being longer than 256 bytes.
24159 I can't imagine one being longer than 64k. Thus, we need 16-bit
24160 offsets. This kind of reasoning is so bogus, but relaxation is
24163 The other approach would be to generate code right-to-left. Then
24164 I'd always know my offset size. That might be fun.
24166 Where is the function call bytecode?
24167 When we add side-effects, we should add this.
24169 Why does the `reg' bytecode take a 16-bit register number?
24170 Intel's IA-64 architecture has 128 general-purpose registers, and
24171 128 floating-point registers, and I'm sure it has some random
24174 Why do we need `trace' and `trace_quick'?
24175 Because GDB needs to record all the memory contents and registers
24176 an expression touches. If the user wants to evaluate an expression
24177 `x->y->z', the agent must record the values of `x' and `x->y' as
24178 well as the value of `x->y->z'.
24180 Don't the `trace' bytecodes make the interpreter less general?
24181 They do mean that the interpreter contains special-purpose code,
24182 but that doesn't mean the interpreter can only be used for that
24183 purpose. If an expression doesn't use the `trace' bytecodes, they
24184 don't get in its way.
24186 Why doesn't `trace_quick' consume its arguments the way everything else does?
24187 In general, you do want your operators to consume their arguments;
24188 it's consistent, and generally reduces the amount of stack
24189 rearrangement necessary. However, `trace_quick' is a kludge to
24190 save space; it only exists so we needn't write `dup const8 SIZE
24191 trace' before every memory reference. Therefore, it's okay for it
24192 not to consume its arguments; it's meant for a specific context in
24193 which we know exactly what it should do with the stack. If we're
24194 going to have a kludge, it should be an effective kludge.
24196 Why does `trace16' exist?
24197 That opcode was added by the customer that contracted Cygnus for
24198 the data tracing work. I personally think it is unnecessary;
24199 objects that large will be quite rare, so it is okay to use `dup
24200 const16 SIZE trace' in those cases.
24202 Whatever we decide to do with `trace16', we should at least leave
24203 opcode 0x30 reserved, to remain compatible with the customer who
24208 File: gdb.info, Node: Copying, Next: GNU Free Documentation License, Prev: Agent Expressions, Up: Top
24210 Appendix F GNU GENERAL PUBLIC LICENSE
24211 *************************************
24213 Version 2, June 1991
24215 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
24216 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24218 Everyone is permitted to copy and distribute verbatim copies
24219 of this license document, but changing it is not allowed.
24224 The licenses for most software are designed to take away your freedom
24225 to share and change it. By contrast, the GNU General Public License is
24226 intended to guarantee your freedom to share and change free
24227 software--to make sure the software is free for all its users. This
24228 General Public License applies to most of the Free Software
24229 Foundation's software and to any other program whose authors commit to
24230 using it. (Some other Free Software Foundation software is covered by
24231 the GNU Library General Public License instead.) You can apply it to
24232 your programs, too.
24234 When we speak of free software, we are referring to freedom, not
24235 price. Our General Public Licenses are designed to make sure that you
24236 have the freedom to distribute copies of free software (and charge for
24237 this service if you wish), that you receive source code or can get it
24238 if you want it, that you can change the software or use pieces of it in
24239 new free programs; and that you know you can do these things.
24241 To protect your rights, we need to make restrictions that forbid
24242 anyone to deny you these rights or to ask you to surrender the rights.
24243 These restrictions translate to certain responsibilities for you if you
24244 distribute copies of the software, or if you modify it.
24246 For example, if you distribute copies of such a program, whether
24247 gratis or for a fee, you must give the recipients all the rights that
24248 you have. You must make sure that they, too, receive or can get the
24249 source code. And you must show them these terms so they know their
24252 We protect your rights with two steps: (1) copyright the software,
24253 and (2) offer you this license which gives you legal permission to copy,
24254 distribute and/or modify the software.
24256 Also, for each author's protection and ours, we want to make certain
24257 that everyone understands that there is no warranty for this free
24258 software. If the software is modified by someone else and passed on, we
24259 want its recipients to know that what they have is not the original, so
24260 that any problems introduced by others will not reflect on the original
24261 authors' reputations.
24263 Finally, any free program is threatened constantly by software
24264 patents. We wish to avoid the danger that redistributors of a free
24265 program will individually obtain patent licenses, in effect making the
24266 program proprietary. To prevent this, we have made it clear that any
24267 patent must be licensed for everyone's free use or not licensed at all.
24269 The precise terms and conditions for copying, distribution and
24270 modification follow.
24272 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
24273 0. This License applies to any program or other work which contains a
24274 notice placed by the copyright holder saying it may be distributed
24275 under the terms of this General Public License. The "Program",
24276 below, refers to any such program or work, and a "work based on
24277 the Program" means either the Program or any derivative work under
24278 copyright law: that is to say, a work containing the Program or a
24279 portion of it, either verbatim or with modifications and/or
24280 translated into another language. (Hereinafter, translation is
24281 included without limitation in the term "modification".) Each
24282 licensee is addressed as "you".
24284 Activities other than copying, distribution and modification are
24285 not covered by this License; they are outside its scope. The act
24286 of running the Program is not restricted, and the output from the
24287 Program is covered only if its contents constitute a work based on
24288 the Program (independent of having been made by running the
24289 Program). Whether that is true depends on what the Program does.
24291 1. You may copy and distribute verbatim copies of the Program's
24292 source code as you receive it, in any medium, provided that you
24293 conspicuously and appropriately publish on each copy an appropriate
24294 copyright notice and disclaimer of warranty; keep intact all the
24295 notices that refer to this License and to the absence of any
24296 warranty; and give any other recipients of the Program a copy of
24297 this License along with the Program.
24299 You may charge a fee for the physical act of transferring a copy,
24300 and you may at your option offer warranty protection in exchange
24303 2. You may modify your copy or copies of the Program or any portion
24304 of it, thus forming a work based on the Program, and copy and
24305 distribute such modifications or work under the terms of Section 1
24306 above, provided that you also meet all of these conditions:
24308 a. You must cause the modified files to carry prominent notices
24309 stating that you changed the files and the date of any change.
24311 b. You must cause any work that you distribute or publish, that
24312 in whole or in part contains or is derived from the Program
24313 or any part thereof, to be licensed as a whole at no charge
24314 to all third parties under the terms of this License.
24316 c. If the modified program normally reads commands interactively
24317 when run, you must cause it, when started running for such
24318 interactive use in the most ordinary way, to print or display
24319 an announcement including an appropriate copyright notice and
24320 a notice that there is no warranty (or else, saying that you
24321 provide a warranty) and that users may redistribute the
24322 program under these conditions, and telling the user how to
24323 view a copy of this License. (Exception: if the Program
24324 itself is interactive but does not normally print such an
24325 announcement, your work based on the Program is not required
24326 to print an announcement.)
24328 These requirements apply to the modified work as a whole. If
24329 identifiable sections of that work are not derived from the
24330 Program, and can be reasonably considered independent and separate
24331 works in themselves, then this License, and its terms, do not
24332 apply to those sections when you distribute them as separate
24333 works. But when you distribute the same sections as part of a
24334 whole which is a work based on the Program, the distribution of
24335 the whole must be on the terms of this License, whose permissions
24336 for other licensees extend to the entire whole, and thus to each
24337 and every part regardless of who wrote it.
24339 Thus, it is not the intent of this section to claim rights or
24340 contest your rights to work written entirely by you; rather, the
24341 intent is to exercise the right to control the distribution of
24342 derivative or collective works based on the Program.
24344 In addition, mere aggregation of another work not based on the
24345 Program with the Program (or with a work based on the Program) on
24346 a volume of a storage or distribution medium does not bring the
24347 other work under the scope of this License.
24349 3. You may copy and distribute the Program (or a work based on it,
24350 under Section 2) in object code or executable form under the terms
24351 of Sections 1 and 2 above provided that you also do one of the
24354 a. Accompany it with the complete corresponding machine-readable
24355 source code, which must be distributed under the terms of
24356 Sections 1 and 2 above on a medium customarily used for
24357 software interchange; or,
24359 b. Accompany it with a written offer, valid for at least three
24360 years, to give any third party, for a charge no more than your
24361 cost of physically performing source distribution, a complete
24362 machine-readable copy of the corresponding source code, to be
24363 distributed under the terms of Sections 1 and 2 above on a
24364 medium customarily used for software interchange; or,
24366 c. Accompany it with the information you received as to the offer
24367 to distribute corresponding source code. (This alternative is
24368 allowed only for noncommercial distribution and only if you
24369 received the program in object code or executable form with
24370 such an offer, in accord with Subsection b above.)
24372 The source code for a work means the preferred form of the work for
24373 making modifications to it. For an executable work, complete
24374 source code means all the source code for all modules it contains,
24375 plus any associated interface definition files, plus the scripts
24376 used to control compilation and installation of the executable.
24377 However, as a special exception, the source code distributed need
24378 not include anything that is normally distributed (in either
24379 source or binary form) with the major components (compiler,
24380 kernel, and so on) of the operating system on which the executable
24381 runs, unless that component itself accompanies the executable.
24383 If distribution of executable or object code is made by offering
24384 access to copy from a designated place, then offering equivalent
24385 access to copy the source code from the same place counts as
24386 distribution of the source code, even though third parties are not
24387 compelled to copy the source along with the object code.
24389 4. You may not copy, modify, sublicense, or distribute the Program
24390 except as expressly provided under this License. Any attempt
24391 otherwise to copy, modify, sublicense or distribute the Program is
24392 void, and will automatically terminate your rights under this
24393 License. However, parties who have received copies, or rights,
24394 from you under this License will not have their licenses
24395 terminated so long as such parties remain in full compliance.
24397 5. You are not required to accept this License, since you have not
24398 signed it. However, nothing else grants you permission to modify
24399 or distribute the Program or its derivative works. These actions
24400 are prohibited by law if you do not accept this License.
24401 Therefore, by modifying or distributing the Program (or any work
24402 based on the Program), you indicate your acceptance of this
24403 License to do so, and all its terms and conditions for copying,
24404 distributing or modifying the Program or works based on it.
24406 6. Each time you redistribute the Program (or any work based on the
24407 Program), the recipient automatically receives a license from the
24408 original licensor to copy, distribute or modify the Program
24409 subject to these terms and conditions. You may not impose any
24410 further restrictions on the recipients' exercise of the rights
24411 granted herein. You are not responsible for enforcing compliance
24412 by third parties to this License.
24414 7. If, as a consequence of a court judgment or allegation of patent
24415 infringement or for any other reason (not limited to patent
24416 issues), conditions are imposed on you (whether by court order,
24417 agreement or otherwise) that contradict the conditions of this
24418 License, they do not excuse you from the conditions of this
24419 License. If you cannot distribute so as to satisfy simultaneously
24420 your obligations under this License and any other pertinent
24421 obligations, then as a consequence you may not distribute the
24422 Program at all. For example, if a patent license would not permit
24423 royalty-free redistribution of the Program by all those who
24424 receive copies directly or indirectly through you, then the only
24425 way you could satisfy both it and this License would be to refrain
24426 entirely from distribution of the Program.
24428 If any portion of this section is held invalid or unenforceable
24429 under any particular circumstance, the balance of the section is
24430 intended to apply and the section as a whole is intended to apply
24431 in other circumstances.
24433 It is not the purpose of this section to induce you to infringe any
24434 patents or other property right claims or to contest validity of
24435 any such claims; this section has the sole purpose of protecting
24436 the integrity of the free software distribution system, which is
24437 implemented by public license practices. Many people have made
24438 generous contributions to the wide range of software distributed
24439 through that system in reliance on consistent application of that
24440 system; it is up to the author/donor to decide if he or she is
24441 willing to distribute software through any other system and a
24442 licensee cannot impose that choice.
24444 This section is intended to make thoroughly clear what is believed
24445 to be a consequence of the rest of this License.
24447 8. If the distribution and/or use of the Program is restricted in
24448 certain countries either by patents or by copyrighted interfaces,
24449 the original copyright holder who places the Program under this
24450 License may add an explicit geographical distribution limitation
24451 excluding those countries, so that distribution is permitted only
24452 in or among countries not thus excluded. In such case, this
24453 License incorporates the limitation as if written in the body of
24456 9. The Free Software Foundation may publish revised and/or new
24457 versions of the General Public License from time to time. Such
24458 new versions will be similar in spirit to the present version, but
24459 may differ in detail to address new problems or concerns.
24461 Each version is given a distinguishing version number. If the
24462 Program specifies a version number of this License which applies
24463 to it and "any later version", you have the option of following
24464 the terms and conditions either of that version or of any later
24465 version published by the Free Software Foundation. If the Program
24466 does not specify a version number of this License, you may choose
24467 any version ever published by the Free Software Foundation.
24469 10. If you wish to incorporate parts of the Program into other free
24470 programs whose distribution conditions are different, write to the
24471 author to ask for permission. For software which is copyrighted
24472 by the Free Software Foundation, write to the Free Software
24473 Foundation; we sometimes make exceptions for this. Our decision
24474 will be guided by the two goals of preserving the free status of
24475 all derivatives of our free software and of promoting the sharing
24476 and reuse of software generally.
24479 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
24480 WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
24481 LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
24482 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
24483 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
24484 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
24485 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
24486 QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
24487 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
24488 SERVICING, REPAIR OR CORRECTION.
24490 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
24491 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
24492 MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
24493 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
24494 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
24495 INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
24496 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
24497 OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
24498 OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
24499 ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
24501 END OF TERMS AND CONDITIONS
24502 How to Apply These Terms to Your New Programs
24503 =============================================
24505 If you develop a new program, and you want it to be of the greatest
24506 possible use to the public, the best way to achieve this is to make it
24507 free software which everyone can redistribute and change under these
24510 To do so, attach the following notices to the program. It is safest
24511 to attach them to the start of each source file to most effectively
24512 convey the exclusion of warranty; and each file should have at least
24513 the "copyright" line and a pointer to where the full notice is found.
24515 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
24516 Copyright (C) YEAR NAME OF AUTHOR
24518 This program is free software; you can redistribute it and/or modify
24519 it under the terms of the GNU General Public License as published by
24520 the Free Software Foundation; either version 2 of the License, or
24521 (at your option) any later version.
24523 This program is distributed in the hope that it will be useful,
24524 but WITHOUT ANY WARRANTY; without even the implied warranty of
24525 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24526 GNU General Public License for more details.
24528 You should have received a copy of the GNU General Public License
24529 along with this program; if not, write to the Free Software
24530 Foundation, Inc., 51 Franklin Street, Fifth Floor,
24531 Boston, MA 02110-1301, USA.
24533 Also add information on how to contact you by electronic and paper
24536 If the program is interactive, make it output a short notice like
24537 this when it starts in an interactive mode:
24539 Gnomovision version 69, Copyright (C) YEAR NAME OF AUTHOR
24540 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
24542 This is free software, and you are welcome to redistribute it
24543 under certain conditions; type `show c' for details.
24545 The hypothetical commands `show w' and `show c' should show the
24546 appropriate parts of the General Public License. Of course, the
24547 commands you use may be called something other than `show w' and `show
24548 c'; they could even be mouse-clicks or menu items--whatever suits your
24551 You should also get your employer (if you work as a programmer) or
24552 your school, if any, to sign a "copyright disclaimer" for the program,
24553 if necessary. Here is a sample; alter the names:
24555 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
24556 `Gnomovision' (which makes passes at compilers) written by James Hacker.
24558 SIGNATURE OF TY COON, 1 April 1989
24559 Ty Coon, President of Vice
24561 This General Public License does not permit incorporating your
24562 program into proprietary programs. If your program is a subroutine
24563 library, you may consider it more useful to permit linking proprietary
24564 applications with the library. If this is what you want to do, use the
24565 GNU Library General Public License instead of this License.
24568 File: gdb.info, Node: GNU Free Documentation License, Next: Index, Prev: Copying, Up: Top
24570 Appendix G GNU Free Documentation License
24571 *****************************************
24573 Version 1.2, November 2002
24575 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
24576 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24578 Everyone is permitted to copy and distribute verbatim copies
24579 of this license document, but changing it is not allowed.
24583 The purpose of this License is to make a manual, textbook, or other
24584 functional and useful document "free" in the sense of freedom: to
24585 assure everyone the effective freedom to copy and redistribute it,
24586 with or without modifying it, either commercially or
24587 noncommercially. Secondarily, this License preserves for the
24588 author and publisher a way to get credit for their work, while not
24589 being considered responsible for modifications made by others.
24591 This License is a kind of "copyleft", which means that derivative
24592 works of the document must themselves be free in the same sense.
24593 It complements the GNU General Public License, which is a copyleft
24594 license designed for free software.
24596 We have designed this License in order to use it for manuals for
24597 free software, because free software needs free documentation: a
24598 free program should come with manuals providing the same freedoms
24599 that the software does. But this License is not limited to
24600 software manuals; it can be used for any textual work, regardless
24601 of subject matter or whether it is published as a printed book.
24602 We recommend this License principally for works whose purpose is
24603 instruction or reference.
24605 1. APPLICABILITY AND DEFINITIONS
24607 This License applies to any manual or other work, in any medium,
24608 that contains a notice placed by the copyright holder saying it
24609 can be distributed under the terms of this License. Such a notice
24610 grants a world-wide, royalty-free license, unlimited in duration,
24611 to use that work under the conditions stated herein. The
24612 "Document", below, refers to any such manual or work. Any member
24613 of the public is a licensee, and is addressed as "you". You
24614 accept the license if you copy, modify or distribute the work in a
24615 way requiring permission under copyright law.
24617 A "Modified Version" of the Document means any work containing the
24618 Document or a portion of it, either copied verbatim, or with
24619 modifications and/or translated into another language.
24621 A "Secondary Section" is a named appendix or a front-matter section
24622 of the Document that deals exclusively with the relationship of the
24623 publishers or authors of the Document to the Document's overall
24624 subject (or to related matters) and contains nothing that could
24625 fall directly within that overall subject. (Thus, if the Document
24626 is in part a textbook of mathematics, a Secondary Section may not
24627 explain any mathematics.) The relationship could be a matter of
24628 historical connection with the subject or with related matters, or
24629 of legal, commercial, philosophical, ethical or political position
24632 The "Invariant Sections" are certain Secondary Sections whose
24633 titles are designated, as being those of Invariant Sections, in
24634 the notice that says that the Document is released under this
24635 License. If a section does not fit the above definition of
24636 Secondary then it is not allowed to be designated as Invariant.
24637 The Document may contain zero Invariant Sections. If the Document
24638 does not identify any Invariant Sections then there are none.
24640 The "Cover Texts" are certain short passages of text that are
24641 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
24642 that says that the Document is released under this License. A
24643 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
24644 be at most 25 words.
24646 A "Transparent" copy of the Document means a machine-readable copy,
24647 represented in a format whose specification is available to the
24648 general public, that is suitable for revising the document
24649 straightforwardly with generic text editors or (for images
24650 composed of pixels) generic paint programs or (for drawings) some
24651 widely available drawing editor, and that is suitable for input to
24652 text formatters or for automatic translation to a variety of
24653 formats suitable for input to text formatters. A copy made in an
24654 otherwise Transparent file format whose markup, or absence of
24655 markup, has been arranged to thwart or discourage subsequent
24656 modification by readers is not Transparent. An image format is
24657 not Transparent if used for any substantial amount of text. A
24658 copy that is not "Transparent" is called "Opaque".
24660 Examples of suitable formats for Transparent copies include plain
24661 ASCII without markup, Texinfo input format, LaTeX input format,
24662 SGML or XML using a publicly available DTD, and
24663 standard-conforming simple HTML, PostScript or PDF designed for
24664 human modification. Examples of transparent image formats include
24665 PNG, XCF and JPG. Opaque formats include proprietary formats that
24666 can be read and edited only by proprietary word processors, SGML or
24667 XML for which the DTD and/or processing tools are not generally
24668 available, and the machine-generated HTML, PostScript or PDF
24669 produced by some word processors for output purposes only.
24671 The "Title Page" means, for a printed book, the title page itself,
24672 plus such following pages as are needed to hold, legibly, the
24673 material this License requires to appear in the title page. For
24674 works in formats which do not have any title page as such, "Title
24675 Page" means the text near the most prominent appearance of the
24676 work's title, preceding the beginning of the body of the text.
24678 A section "Entitled XYZ" means a named subunit of the Document
24679 whose title either is precisely XYZ or contains XYZ in parentheses
24680 following text that translates XYZ in another language. (Here XYZ
24681 stands for a specific section name mentioned below, such as
24682 "Acknowledgements", "Dedications", "Endorsements", or "History".)
24683 To "Preserve the Title" of such a section when you modify the
24684 Document means that it remains a section "Entitled XYZ" according
24685 to this definition.
24687 The Document may include Warranty Disclaimers next to the notice
24688 which states that this License applies to the Document. These
24689 Warranty Disclaimers are considered to be included by reference in
24690 this License, but only as regards disclaiming warranties: any other
24691 implication that these Warranty Disclaimers may have is void and
24692 has no effect on the meaning of this License.
24694 2. VERBATIM COPYING
24696 You may copy and distribute the Document in any medium, either
24697 commercially or noncommercially, provided that this License, the
24698 copyright notices, and the license notice saying this License
24699 applies to the Document are reproduced in all copies, and that you
24700 add no other conditions whatsoever to those of this License. You
24701 may not use technical measures to obstruct or control the reading
24702 or further copying of the copies you make or distribute. However,
24703 you may accept compensation in exchange for copies. If you
24704 distribute a large enough number of copies you must also follow
24705 the conditions in section 3.
24707 You may also lend copies, under the same conditions stated above,
24708 and you may publicly display copies.
24710 3. COPYING IN QUANTITY
24712 If you publish printed copies (or copies in media that commonly
24713 have printed covers) of the Document, numbering more than 100, and
24714 the Document's license notice requires Cover Texts, you must
24715 enclose the copies in covers that carry, clearly and legibly, all
24716 these Cover Texts: Front-Cover Texts on the front cover, and
24717 Back-Cover Texts on the back cover. Both covers must also clearly
24718 and legibly identify you as the publisher of these copies. The
24719 front cover must present the full title with all words of the
24720 title equally prominent and visible. You may add other material
24721 on the covers in addition. Copying with changes limited to the
24722 covers, as long as they preserve the title of the Document and
24723 satisfy these conditions, can be treated as verbatim copying in
24726 If the required texts for either cover are too voluminous to fit
24727 legibly, you should put the first ones listed (as many as fit
24728 reasonably) on the actual cover, and continue the rest onto
24731 If you publish or distribute Opaque copies of the Document
24732 numbering more than 100, you must either include a
24733 machine-readable Transparent copy along with each Opaque copy, or
24734 state in or with each Opaque copy a computer-network location from
24735 which the general network-using public has access to download
24736 using public-standard network protocols a complete Transparent
24737 copy of the Document, free of added material. If you use the
24738 latter option, you must take reasonably prudent steps, when you
24739 begin distribution of Opaque copies in quantity, to ensure that
24740 this Transparent copy will remain thus accessible at the stated
24741 location until at least one year after the last time you
24742 distribute an Opaque copy (directly or through your agents or
24743 retailers) of that edition to the public.
24745 It is requested, but not required, that you contact the authors of
24746 the Document well before redistributing any large number of
24747 copies, to give them a chance to provide you with an updated
24748 version of the Document.
24752 You may copy and distribute a Modified Version of the Document
24753 under the conditions of sections 2 and 3 above, provided that you
24754 release the Modified Version under precisely this License, with
24755 the Modified Version filling the role of the Document, thus
24756 licensing distribution and modification of the Modified Version to
24757 whoever possesses a copy of it. In addition, you must do these
24758 things in the Modified Version:
24760 A. Use in the Title Page (and on the covers, if any) a title
24761 distinct from that of the Document, and from those of
24762 previous versions (which should, if there were any, be listed
24763 in the History section of the Document). You may use the
24764 same title as a previous version if the original publisher of
24765 that version gives permission.
24767 B. List on the Title Page, as authors, one or more persons or
24768 entities responsible for authorship of the modifications in
24769 the Modified Version, together with at least five of the
24770 principal authors of the Document (all of its principal
24771 authors, if it has fewer than five), unless they release you
24772 from this requirement.
24774 C. State on the Title page the name of the publisher of the
24775 Modified Version, as the publisher.
24777 D. Preserve all the copyright notices of the Document.
24779 E. Add an appropriate copyright notice for your modifications
24780 adjacent to the other copyright notices.
24782 F. Include, immediately after the copyright notices, a license
24783 notice giving the public permission to use the Modified
24784 Version under the terms of this License, in the form shown in
24785 the Addendum below.
24787 G. Preserve in that license notice the full lists of Invariant
24788 Sections and required Cover Texts given in the Document's
24791 H. Include an unaltered copy of this License.
24793 I. Preserve the section Entitled "History", Preserve its Title,
24794 and add to it an item stating at least the title, year, new
24795 authors, and publisher of the Modified Version as given on
24796 the Title Page. If there is no section Entitled "History" in
24797 the Document, create one stating the title, year, authors,
24798 and publisher of the Document as given on its Title Page,
24799 then add an item describing the Modified Version as stated in
24800 the previous sentence.
24802 J. Preserve the network location, if any, given in the Document
24803 for public access to a Transparent copy of the Document, and
24804 likewise the network locations given in the Document for
24805 previous versions it was based on. These may be placed in
24806 the "History" section. You may omit a network location for a
24807 work that was published at least four years before the
24808 Document itself, or if the original publisher of the version
24809 it refers to gives permission.
24811 K. For any section Entitled "Acknowledgements" or "Dedications",
24812 Preserve the Title of the section, and preserve in the
24813 section all the substance and tone of each of the contributor
24814 acknowledgements and/or dedications given therein.
24816 L. Preserve all the Invariant Sections of the Document,
24817 unaltered in their text and in their titles. Section numbers
24818 or the equivalent are not considered part of the section
24821 M. Delete any section Entitled "Endorsements". Such a section
24822 may not be included in the Modified Version.
24824 N. Do not retitle any existing section to be Entitled
24825 "Endorsements" or to conflict in title with any Invariant
24828 O. Preserve any Warranty Disclaimers.
24830 If the Modified Version includes new front-matter sections or
24831 appendices that qualify as Secondary Sections and contain no
24832 material copied from the Document, you may at your option
24833 designate some or all of these sections as invariant. To do this,
24834 add their titles to the list of Invariant Sections in the Modified
24835 Version's license notice. These titles must be distinct from any
24836 other section titles.
24838 You may add a section Entitled "Endorsements", provided it contains
24839 nothing but endorsements of your Modified Version by various
24840 parties--for example, statements of peer review or that the text
24841 has been approved by an organization as the authoritative
24842 definition of a standard.
24844 You may add a passage of up to five words as a Front-Cover Text,
24845 and a passage of up to 25 words as a Back-Cover Text, to the end
24846 of the list of Cover Texts in the Modified Version. Only one
24847 passage of Front-Cover Text and one of Back-Cover Text may be
24848 added by (or through arrangements made by) any one entity. If the
24849 Document already includes a cover text for the same cover,
24850 previously added by you or by arrangement made by the same entity
24851 you are acting on behalf of, you may not add another; but you may
24852 replace the old one, on explicit permission from the previous
24853 publisher that added the old one.
24855 The author(s) and publisher(s) of the Document do not by this
24856 License give permission to use their names for publicity for or to
24857 assert or imply endorsement of any Modified Version.
24859 5. COMBINING DOCUMENTS
24861 You may combine the Document with other documents released under
24862 this License, under the terms defined in section 4 above for
24863 modified versions, provided that you include in the combination
24864 all of the Invariant Sections of all of the original documents,
24865 unmodified, and list them all as Invariant Sections of your
24866 combined work in its license notice, and that you preserve all
24867 their Warranty Disclaimers.
24869 The combined work need only contain one copy of this License, and
24870 multiple identical Invariant Sections may be replaced with a single
24871 copy. If there are multiple Invariant Sections with the same name
24872 but different contents, make the title of each such section unique
24873 by adding at the end of it, in parentheses, the name of the
24874 original author or publisher of that section if known, or else a
24875 unique number. Make the same adjustment to the section titles in
24876 the list of Invariant Sections in the license notice of the
24879 In the combination, you must combine any sections Entitled
24880 "History" in the various original documents, forming one section
24881 Entitled "History"; likewise combine any sections Entitled
24882 "Acknowledgements", and any sections Entitled "Dedications". You
24883 must delete all sections Entitled "Endorsements."
24885 6. COLLECTIONS OF DOCUMENTS
24887 You may make a collection consisting of the Document and other
24888 documents released under this License, and replace the individual
24889 copies of this License in the various documents with a single copy
24890 that is included in the collection, provided that you follow the
24891 rules of this License for verbatim copying of each of the
24892 documents in all other respects.
24894 You may extract a single document from such a collection, and
24895 distribute it individually under this License, provided you insert
24896 a copy of this License into the extracted document, and follow
24897 this License in all other respects regarding verbatim copying of
24900 7. AGGREGATION WITH INDEPENDENT WORKS
24902 A compilation of the Document or its derivatives with other
24903 separate and independent documents or works, in or on a volume of
24904 a storage or distribution medium, is called an "aggregate" if the
24905 copyright resulting from the compilation is not used to limit the
24906 legal rights of the compilation's users beyond what the individual
24907 works permit. When the Document is included in an aggregate, this
24908 License does not apply to the other works in the aggregate which
24909 are not themselves derivative works of the Document.
24911 If the Cover Text requirement of section 3 is applicable to these
24912 copies of the Document, then if the Document is less than one half
24913 of the entire aggregate, the Document's Cover Texts may be placed
24914 on covers that bracket the Document within the aggregate, or the
24915 electronic equivalent of covers if the Document is in electronic
24916 form. Otherwise they must appear on printed covers that bracket
24917 the whole aggregate.
24921 Translation is considered a kind of modification, so you may
24922 distribute translations of the Document under the terms of section
24923 4. Replacing Invariant Sections with translations requires special
24924 permission from their copyright holders, but you may include
24925 translations of some or all Invariant Sections in addition to the
24926 original versions of these Invariant Sections. You may include a
24927 translation of this License, and all the license notices in the
24928 Document, and any Warranty Disclaimers, provided that you also
24929 include the original English version of this License and the
24930 original versions of those notices and disclaimers. In case of a
24931 disagreement between the translation and the original version of
24932 this License or a notice or disclaimer, the original version will
24935 If a section in the Document is Entitled "Acknowledgements",
24936 "Dedications", or "History", the requirement (section 4) to
24937 Preserve its Title (section 1) will typically require changing the
24942 You may not copy, modify, sublicense, or distribute the Document
24943 except as expressly provided for under this License. Any other
24944 attempt to copy, modify, sublicense or distribute the Document is
24945 void, and will automatically terminate your rights under this
24946 License. However, parties who have received copies, or rights,
24947 from you under this License will not have their licenses
24948 terminated so long as such parties remain in full compliance.
24950 10. FUTURE REVISIONS OF THIS LICENSE
24952 The Free Software Foundation may publish new, revised versions of
24953 the GNU Free Documentation License from time to time. Such new
24954 versions will be similar in spirit to the present version, but may
24955 differ in detail to address new problems or concerns. See
24956 `http://www.gnu.org/copyleft/'.
24958 Each version of the License is given a distinguishing version
24959 number. If the Document specifies that a particular numbered
24960 version of this License "or any later version" applies to it, you
24961 have the option of following the terms and conditions either of
24962 that specified version or of any later version that has been
24963 published (not as a draft) by the Free Software Foundation. If
24964 the Document does not specify a version number of this License,
24965 you may choose any version ever published (not as a draft) by the
24966 Free Software Foundation.
24968 G.1 ADDENDUM: How to use this License for your documents
24969 ========================================================
24971 To use this License in a document you have written, include a copy of
24972 the License in the document and put the following copyright and license
24973 notices just after the title page:
24975 Copyright (C) YEAR YOUR NAME.
24976 Permission is granted to copy, distribute and/or modify this document
24977 under the terms of the GNU Free Documentation License, Version 1.2
24978 or any later version published by the Free Software Foundation;
24979 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
24980 Texts. A copy of the license is included in the section entitled ``GNU
24981 Free Documentation License''.
24983 If you have Invariant Sections, Front-Cover Texts and Back-Cover
24984 Texts, replace the "with...Texts." line with this:
24986 with the Invariant Sections being LIST THEIR TITLES, with
24987 the Front-Cover Texts being LIST, and with the Back-Cover Texts
24990 If you have Invariant Sections without Cover Texts, or some other
24991 combination of the three, merge those two alternatives to suit the
24994 If your document contains nontrivial examples of program code, we
24995 recommend releasing these examples in parallel under your choice of
24996 free software license, such as the GNU General Public License, to
24997 permit their use in free software.
25000 File: gdb.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
25008 * ! packet: Packets. (line 26)
25009 * "No symbol "foo" in current context": Variables. (line 74)
25010 * # (a comment): Command Syntax. (line 38)
25011 * # in Modula-2: GDB/M2. (line 18)
25012 * $: Value History. (line 13)
25013 * $$: Value History. (line 13)
25014 * $_ and info breakpoints: Set Breaks. (line 136)
25015 * $_ and info line: Machine Code. (line 30)
25016 * $_, $__, and value history: Memory. (line 87)
25017 * $_, convenience variable: Convenience Vars. (line 64)
25018 * $__, convenience variable: Convenience Vars. (line 73)
25019 * $_exitcode, convenience variable: Convenience Vars. (line 79)
25020 * $bpnum, convenience variable: Set Breaks. (line 6)
25021 * $cdir, convenience variable: Source Path. (line 99)
25022 * $cwdr, convenience variable: Source Path. (line 99)
25023 * $tpnum: Create and Delete Tracepoints.
25025 * $trace_file: Tracepoint Variables.
25027 * $trace_frame: Tracepoint Variables.
25029 * $trace_func: Tracepoint Variables.
25031 * $trace_line: Tracepoint Variables.
25033 * $tracepoint: Tracepoint Variables.
25035 * --annotate: Mode Options. (line 101)
25036 * --args: Mode Options. (line 114)
25037 * --batch: Mode Options. (line 23)
25038 * --batch-silent: Mode Options. (line 39)
25039 * --baud: Mode Options. (line 120)
25040 * --cd: Mode Options. (line 80)
25041 * --command: File Options. (line 55)
25042 * --core: File Options. (line 43)
25043 * --directory: File Options. (line 70)
25044 * --epoch: Mode Options. (line 96)
25045 * --eval-command: File Options. (line 60)
25046 * --exec: File Options. (line 35)
25047 * --fullname: Mode Options. (line 85)
25048 * --interpreter: Mode Options. (line 141)
25049 * --nowindows: Mode Options. (line 70)
25050 * --nx: Mode Options. (line 11)
25051 * --pid: File Options. (line 49)
25052 * --quiet: Mode Options. (line 19)
25053 * --readnow: File Options. (line 74)
25054 * --return-child-result: Mode Options. (line 51)
25055 * --se: File Options. (line 39)
25056 * --silent: Mode Options. (line 19)
25057 * --statistics: Mode Options. (line 158)
25058 * --symbols: File Options. (line 31)
25059 * --tty: Mode Options. (line 129)
25060 * --tui: Mode Options. (line 132)
25061 * --version: Mode Options. (line 162)
25062 * --windows: Mode Options. (line 76)
25063 * --with-sysroot: Files. (line 374)
25064 * --write: Mode Options. (line 153)
25065 * -b: Mode Options. (line 120)
25066 * -break-after: GDB/MI Breakpoint Commands.
25068 * -break-condition: GDB/MI Breakpoint Commands.
25070 * -break-delete: GDB/MI Breakpoint Commands.
25072 * -break-disable: GDB/MI Breakpoint Commands.
25074 * -break-enable: GDB/MI Breakpoint Commands.
25076 * -break-info: GDB/MI Breakpoint Commands.
25078 * -break-insert: GDB/MI Breakpoint Commands.
25080 * -break-list: GDB/MI Breakpoint Commands.
25082 * -break-watch: GDB/MI Breakpoint Commands.
25084 * -c: File Options. (line 43)
25085 * -d: File Options. (line 70)
25086 * -data-disassemble: GDB/MI Data Manipulation.
25088 * -data-evaluate-expression: GDB/MI Data Manipulation.
25090 * -data-list-changed-registers: GDB/MI Data Manipulation.
25092 * -data-list-register-names: GDB/MI Data Manipulation.
25094 * -data-list-register-values: GDB/MI Data Manipulation.
25096 * -data-read-memory: GDB/MI Data Manipulation.
25098 * -e: File Options. (line 35)
25099 * -environment-cd: GDB/MI Program Context.
25101 * -environment-directory: GDB/MI Program Context.
25103 * -environment-path: GDB/MI Program Context.
25105 * -environment-pwd: GDB/MI Program Context.
25107 * -ex: File Options. (line 60)
25108 * -exec-abort: GDB/MI Miscellaneous Commands.
25110 * -exec-arguments: GDB/MI Program Context.
25112 * -exec-continue: GDB/MI Program Execution.
25114 * -exec-finish: GDB/MI Program Execution.
25116 * -exec-interrupt: GDB/MI Program Execution.
25118 * -exec-next: GDB/MI Program Execution.
25120 * -exec-next-instruction: GDB/MI Program Execution.
25122 * -exec-return: GDB/MI Program Execution.
25124 * -exec-run: GDB/MI Program Execution.
25126 * -exec-show-arguments: GDB/MI Program Context.
25128 * -exec-step: GDB/MI Program Execution.
25130 * -exec-step-instruction: GDB/MI Program Execution.
25132 * -exec-until: GDB/MI Program Execution.
25134 * -f: Mode Options. (line 85)
25135 * -file-exec-and-symbols: GDB/MI File Commands.
25137 * -file-exec-file: GDB/MI File Commands.
25139 * -file-list-exec-sections: GDB/MI File Commands.
25141 * -file-list-exec-source-file: GDB/MI File Commands.
25143 * -file-list-exec-source-files: GDB/MI File Commands.
25145 * -file-list-shared-libraries: GDB/MI File Commands.
25147 * -file-list-symbol-files: GDB/MI File Commands.
25149 * -file-symbol-file: GDB/MI File Commands.
25151 * -gdb-exit: GDB/MI Miscellaneous Commands.
25153 * -gdb-set: GDB/MI Miscellaneous Commands.
25155 * -gdb-show: GDB/MI Miscellaneous Commands.
25157 * -gdb-version: GDB/MI Miscellaneous Commands.
25159 * -inferior-tty-set: GDB/MI Miscellaneous Commands.
25161 * -inferior-tty-show: GDB/MI Miscellaneous Commands.
25163 * -interpreter-exec: GDB/MI Miscellaneous Commands.
25165 * -l: Mode Options. (line 124)
25166 * -n: Mode Options. (line 11)
25167 * -nw: Mode Options. (line 70)
25168 * -p: File Options. (line 49)
25169 * -q: Mode Options. (line 19)
25170 * -r: File Options. (line 74)
25171 * -s: File Options. (line 31)
25172 * -stack-info-depth: GDB/MI Stack Manipulation.
25174 * -stack-info-frame: GDB/MI Stack Manipulation.
25176 * -stack-list-arguments: GDB/MI Stack Manipulation.
25178 * -stack-list-frames: GDB/MI Stack Manipulation.
25180 * -stack-list-locals: GDB/MI Stack Manipulation.
25182 * -stack-select-frame: GDB/MI Stack Manipulation.
25184 * -symbol-info-address: GDB/MI Symbol Query. (line 9)
25185 * -symbol-info-file: GDB/MI Symbol Query. (line 29)
25186 * -symbol-info-function: GDB/MI Symbol Query. (line 49)
25187 * -symbol-info-line: GDB/MI Symbol Query. (line 69)
25188 * -symbol-info-symbol: GDB/MI Symbol Query. (line 90)
25189 * -symbol-list-functions: GDB/MI Symbol Query. (line 110)
25190 * -symbol-list-lines: GDB/MI Symbol Query. (line 130)
25191 * -symbol-list-types: GDB/MI Symbol Query. (line 155)
25192 * -symbol-list-variables: GDB/MI Symbol Query. (line 176)
25193 * -symbol-locate: GDB/MI Symbol Query. (line 196)
25194 * -symbol-type: GDB/MI Symbol Query. (line 214)
25195 * -t: Mode Options. (line 129)
25196 * -target-attach: GDB/MI Target Manipulation.
25198 * -target-compare-sections: GDB/MI Target Manipulation.
25200 * -target-detach: GDB/MI Target Manipulation.
25202 * -target-disconnect: GDB/MI Target Manipulation.
25204 * -target-download: GDB/MI Target Manipulation.
25206 * -target-exec-status: GDB/MI Target Manipulation.
25208 * -target-list-available-targets: GDB/MI Target Manipulation.
25210 * -target-list-current-targets: GDB/MI Target Manipulation.
25212 * -target-list-parameters: GDB/MI Target Manipulation.
25214 * -target-select: GDB/MI Target Manipulation.
25216 * -thread-info: GDB/MI Thread Commands.
25218 * -thread-list-all-threads: GDB/MI Thread Commands.
25220 * -thread-list-ids: GDB/MI Thread Commands.
25222 * -thread-select: GDB/MI Thread Commands.
25224 * -var-assign: GDB/MI Variable Objects.
25226 * -var-create: GDB/MI Variable Objects.
25228 * -var-delete: GDB/MI Variable Objects.
25230 * -var-evaluate-expression: GDB/MI Variable Objects.
25232 * -var-info-expression: GDB/MI Variable Objects.
25234 * -var-info-num-children: GDB/MI Variable Objects.
25236 * -var-info-type: GDB/MI Variable Objects.
25238 * -var-list-children: GDB/MI Variable Objects.
25240 * -var-set-format: GDB/MI Variable Objects.
25242 * -var-show-attributes: GDB/MI Variable Objects.
25244 * -var-show-format: GDB/MI Variable Objects.
25246 * -var-update: GDB/MI Variable Objects.
25248 * -w: Mode Options. (line 76)
25249 * -x: File Options. (line 55)
25250 * ., Modula-2 scope operator: M2 Scope. (line 6)
25251 * .debug subdirectories: Separate Debug Files.
25253 * .esgdbinit: Startup. (line 54)
25254 * .gdbinit: Startup. (line 37)
25255 * .gnu_debuglink sections: Separate Debug Files.
25257 * .o files, reading symbols from: Files. (line 132)
25258 * .os68gdbinit: Startup. (line 52)
25259 * .vxgdbinit: Startup. (line 50)
25260 * /proc: SVR4 Process Information.
25262 * ? packet: Packets. (line 35)
25263 * @, referencing memory as an array: Arrays. (line 6)
25264 * ^connected: GDB/MI Result Records.
25266 * ^done: GDB/MI Result Records.
25268 * ^error: GDB/MI Result Records.
25270 * ^exit: GDB/MI Result Records.
25272 * ^running: GDB/MI Result Records.
25274 * _NSPrintForDebugger, and printing Objective-C objects: The Print Command with Objective-C.
25276 * A packet: Packets. (line 41)
25277 * abbreviation: Command Syntax. (line 13)
25278 * abort (C-g): Miscellaneous Commands.
25280 * accept-line (Newline or Return): Commands For History.
25282 * acknowledgment, for GDB remote: Overview. (line 33)
25283 * actions: Tracepoint Actions. (line 6)
25284 * active targets: Active Targets. (line 6)
25285 * Ada: Ada. (line 6)
25286 * Ada mode, general: Ada Mode Intro. (line 6)
25287 * Ada, deviations from: Additions to Ada. (line 6)
25288 * Ada, omissions from: Omissions from Ada. (line 6)
25289 * Ada, problems: Ada Glitches. (line 6)
25290 * adbg_find_memory_in_frame: Tracing on Symmetrix.
25292 * add new commands for external monitor: Connecting. (line 104)
25293 * add-shared-symbol-files: Files. (line 172)
25294 * add-symbol-file: Files. (line 113)
25295 * add-symbol-file-from-memory: Files. (line 162)
25296 * address of a symbol: Symbols. (line 44)
25297 * ADP (Angel Debugger Protocol) logging: ARM. (line 70)
25298 * adress size for remote targets: Remote configuration.
25300 * advance LOCATION: Continuing and Stepping.
25302 * aggregates (Ada): Omissions from Ada. (line 44)
25303 * AIX threads: Debugging Output. (line 28)
25304 * alignment of remote memory accesses: Packets. (line 172)
25305 * Alpha stack: MIPS. (line 6)
25306 * AMD 29K register stack: A29K. (line 6)
25307 * annotations: Annotations Overview.
25309 * annotations for errors, warnings and interrupts: Errors. (line 6)
25310 * annotations for invalidation messages: Invalidation. (line 6)
25311 * annotations for prompts: Prompting. (line 6)
25312 * annotations for running programs: Annotations for Running.
25314 * annotations for source display: Source Annotations. (line 6)
25315 * append: Dump/Restore Files. (line 35)
25316 * append data to a file: Dump/Restore Files. (line 6)
25317 * apply command to several threads: Threads. (line 143)
25318 * apropos: Help. (line 63)
25319 * architecture debugging info: Debugging Output. (line 18)
25320 * argument count in user-defined commands: Define. (line 25)
25321 * arguments (to your program): Arguments. (line 6)
25322 * arguments, to user-defined commands: Define. (line 6)
25323 * ARM 32-bit mode: ARM. (line 25)
25324 * ARM RDI: ARM. (line 6)
25325 * array aggregates (Ada): Omissions from Ada. (line 44)
25326 * arrays: Arrays. (line 6)
25327 * arrays in expressions: Expressions. (line 14)
25328 * artificial array: Arrays. (line 6)
25329 * ASCII character set: Character Sets. (line 65)
25330 * assembly instructions: Machine Code. (line 36)
25331 * assf: Files. (line 172)
25332 * assignment: Assignment. (line 6)
25333 * async output in GDB/MI: GDB/MI Output Syntax.
25335 * AT&T disassembly flavor: Machine Code. (line 68)
25336 * attach: Attach. (line 6)
25337 * attach to a program by name: Server. (line 70)
25338 * automatic display: Auto Display. (line 6)
25339 * automatic overlay debugging: Automatic Overlay Debugging.
25341 * automatic thread selection: Threads. (line 152)
25342 * auxiliary vector: OS Information. (line 21)
25343 * AVR: AVR. (line 6)
25344 * awatch: Set Watchpoints. (line 45)
25345 * b (break): Set Breaks. (line 6)
25346 * B packet: Packets. (line 68)
25347 * b packet: Packets. (line 53)
25348 * backtrace: Backtrace. (line 11)
25349 * backtrace beyond main function: Backtrace. (line 87)
25350 * backtrace limit: Backtrace. (line 123)
25351 * backward-char (C-b): Commands For Moving. (line 15)
25352 * backward-delete-char (Rubout): Commands For Text. (line 11)
25353 * backward-kill-line (C-x Rubout): Commands For Killing.
25355 * backward-kill-word (M-<DEL>): Commands For Killing.
25357 * backward-word (M-b): Commands For Moving. (line 22)
25358 * baud rate for remote targets: Remote configuration.
25360 * bcache statistics: Maintenance Commands.
25362 * beginning-of-history (M-<): Commands For History.
25364 * beginning-of-line (C-a): Commands For Moving. (line 6)
25365 * bell-style: Readline Init File Syntax.
25367 * bind-tty-special-chars: Readline Init File Syntax.
25369 * bits in remote address: Remote configuration.
25371 * bookmark: Checkpoint/Restart. (line 6)
25372 * break: Set Breaks. (line 6)
25373 * break ... thread THREADNO: Thread Stops. (line 10)
25374 * break in overloaded functions: Debugging C plus plus.
25376 * break on fork/exec: Set Catchpoints. (line 19)
25377 * break on load/unload of shared library: Set Catchpoints. (line 30)
25378 * BREAK signal instead of Ctrl-C: Remote configuration.
25380 * break, and Objective-C: Method Names in Commands.
25382 * breakpoint address adjusted: Breakpoint related warnings.
25384 * breakpoint annotation: Annotations for Running.
25386 * breakpoint commands: Break Commands. (line 6)
25387 * breakpoint commands for GDB/MI: GDB/MI Breakpoint Commands.
25389 * breakpoint conditions: Conditions. (line 6)
25390 * breakpoint numbers: Breakpoints. (line 41)
25391 * breakpoint on events: Breakpoints. (line 33)
25392 * breakpoint on memory address: Breakpoints. (line 20)
25393 * breakpoint on variable modification: Breakpoints. (line 20)
25394 * breakpoint ranges: Breakpoints. (line 48)
25395 * breakpoint subroutine, remote: Stub Contents. (line 31)
25396 * breakpointing Ada elaboration code: Stopping Before Main Program.
25398 * breakpoints: Breakpoints. (line 6)
25399 * breakpoints and threads: Thread Stops. (line 10)
25400 * breakpoints in functions matching a regexp: Set Breaks. (line 111)
25401 * breakpoints in overlays: Overlay Commands. (line 93)
25402 * breakpoints-invalid annotation: Invalidation. (line 13)
25403 * bt (backtrace): Backtrace. (line 11)
25404 * bug criteria: Bug Criteria. (line 6)
25405 * bug reports: Bug Reporting. (line 6)
25406 * bugs in GDB: GDB Bugs. (line 6)
25407 * building GDB, requirements for: Requirements. (line 6)
25408 * built-in simulator target: Target Commands. (line 73)
25409 * c (continue): Continuing and Stepping.
25411 * c (SingleKey TUI key): TUI Single Key Mode. (line 10)
25412 * C and C++: C. (line 6)
25413 * C and C++ checks: C Checks. (line 6)
25414 * C and C++ constants: C Constants. (line 6)
25415 * C and C++ defaults: C Defaults. (line 6)
25416 * C and C++ operators: C Operators. (line 6)
25417 * c packet: Packets. (line 74)
25418 * C packet: Packets. (line 80)
25419 * C++: C. (line 10)
25420 * C++ compilers: C plus plus expressions.
25422 * C++ exception handling: Debugging C plus plus.
25424 * C++ overload debugging info: Debugging Output. (line 80)
25425 * C++ scope resolution: Variables. (line 54)
25426 * C++ symbol decoding style: Print Settings. (line 255)
25427 * C++ symbol display: Debugging C plus plus.
25429 * C-L: TUI Keys. (line 69)
25430 * C-x 1: TUI Keys. (line 22)
25431 * C-x 2: TUI Keys. (line 29)
25432 * C-x A: TUI Keys. (line 15)
25433 * C-x a: TUI Keys. (line 14)
25434 * C-x C-a: TUI Keys. (line 13)
25435 * C-x o: TUI Keys. (line 37)
25436 * C-x s: TUI Keys. (line 44)
25437 * caching data of remote targets: Caching Remote Data. (line 6)
25438 * call: Calling. (line 10)
25439 * call dummy stack unwinding: Calling. (line 26)
25440 * call overloaded functions: C plus plus expressions.
25442 * call stack: Stack. (line 9)
25443 * call stack traces: Backtrace. (line 6)
25444 * call-last-kbd-macro (C-x e): Keyboard Macros. (line 13)
25445 * calling functions: Calling. (line 6)
25446 * calling make: Shell Commands. (line 19)
25447 * capitalize-word (M-c): Commands For Text. (line 49)
25448 * case sensitivity in symbol names: Symbols. (line 27)
25449 * case-insensitive symbol names: Symbols. (line 27)
25450 * casts, in expressions: Expressions. (line 27)
25451 * casts, to view memory: Expressions. (line 42)
25452 * catch: Set Catchpoints. (line 10)
25453 * catch exceptions, list active handlers: Frame Info. (line 60)
25454 * catchpoints: Breakpoints. (line 33)
25455 * catchpoints, setting: Set Catchpoints. (line 6)
25456 * cd: Working Directory. (line 16)
25457 * cdir: Source Path. (line 99)
25458 * change working directory: Working Directory. (line 16)
25459 * character sets: Character Sets. (line 6)
25460 * character-search (C-]): Miscellaneous Commands.
25462 * character-search-backward (M-C-]): Miscellaneous Commands.
25464 * charset: Character Sets. (line 6)
25465 * checkpoint: Checkpoint/Restart. (line 6)
25466 * checkpoints and process id: Checkpoint/Restart. (line 80)
25467 * checks, range: Type Checking. (line 65)
25468 * checks, type: Checks. (line 31)
25469 * checksum, for GDB remote: Overview. (line 20)
25470 * choosing target byte order: Byte Order. (line 6)
25471 * clear: Delete Breaks. (line 21)
25472 * clear, and Objective-C: Method Names in Commands.
25474 * clear-screen (C-l): Commands For Moving. (line 26)
25475 * clearing breakpoints, watchpoints, catchpoints: Delete Breaks.
25477 * close, file-i/o system call: close. (line 6)
25478 * closest symbol and offset for an address: Symbols. (line 54)
25479 * code address and its source line: Machine Code. (line 25)
25480 * collect (tracepoints): Tracepoint Actions. (line 45)
25481 * collected data discarded: Starting and Stopping Trace Experiment.
25483 * colon, doubled as scope operator: M2 Scope. (line 6)
25484 * colon-colon, context for variables/functions: Variables. (line 44)
25485 * colon-colon, in Modula-2: M2 Scope. (line 6)
25486 * command editing: Readline Bare Essentials.
25488 * command files: Command Files. (line 6)
25489 * command history: Command History. (line 6)
25490 * command hooks: Hooks. (line 6)
25491 * command interpreters: Interpreters. (line 6)
25492 * command line editing: Editing. (line 6)
25493 * command scripts, debugging: Messages/Warnings. (line 65)
25494 * command tracing: Messages/Warnings. (line 60)
25495 * commands: Break Commands. (line 11)
25496 * commands annotation: Prompting. (line 27)
25497 * commands for C++: Debugging C plus plus.
25499 * commands to STDBUG (ST2000): ST2000. (line 30)
25500 * comment: Command Syntax. (line 38)
25501 * comment-begin: Readline Init File Syntax.
25503 * COMMON blocks, Fortran: Special Fortran commands.
25505 * common targets: Target Commands. (line 46)
25506 * compare-sections: Memory. (line 107)
25507 * compatibility, GDB/MI and CLI: GDB/MI Compatibility with CLI.
25509 * compilation directory: Source Path. (line 99)
25510 * compiling, on Sparclet: Sparclet. (line 16)
25511 * complete: Help. (line 77)
25512 * complete (<TAB>): Commands For Completion.
25514 * completion: Completion. (line 6)
25515 * completion of quoted strings: Completion. (line 57)
25516 * completion-query-items: Readline Init File Syntax.
25518 * condition: Conditions. (line 45)
25519 * conditional breakpoints: Conditions. (line 6)
25520 * configuring GDB: Running Configure. (line 6)
25521 * confirmation: Messages/Warnings. (line 50)
25522 * connect (to STDBUG): ST2000. (line 34)
25523 * console i/o as part of file-i/o: Console I/O. (line 6)
25524 * console interpreter: Interpreters. (line 21)
25525 * console output in GDB/MI: GDB/MI Output Syntax.
25527 * constants, in file-i/o protocol: Constants. (line 6)
25528 * continue: Continuing and Stepping.
25530 * continuing: Continuing and Stepping.
25532 * continuing threads: Thread Stops. (line 69)
25533 * control C, and remote debugging: Bootstrapping. (line 25)
25534 * controlling terminal: Input/Output. (line 23)
25535 * convenience variables: Convenience Vars. (line 6)
25536 * convenience variables for tracepoints: Tracepoint Variables.
25538 * convenience variables, initializing: Convenience Vars. (line 41)
25539 * convert-meta: Readline Init File Syntax.
25541 * copy-backward-word (): Commands For Killing.
25543 * copy-forward-word (): Commands For Killing.
25545 * copy-region-as-kill (): Commands For Killing.
25547 * core dump file: Files. (line 6)
25548 * core dump file target: Target Commands. (line 54)
25549 * core-file: Files. (line 97)
25550 * crash of debugger: Bug Criteria. (line 9)
25551 * CRC of memory block, remote request: General Query Packets.
25553 * CRIS: CRIS. (line 6)
25554 * CRIS mode: CRIS. (line 26)
25555 * CRIS version: CRIS. (line 10)
25556 * ctrl-c message, in file-i/o protocol: The Ctrl-C message. (line 6)
25557 * Ctrl-o (operate-and-get-next): Command Syntax. (line 42)
25558 * current directory: Source Path. (line 99)
25559 * current stack frame: Frames. (line 45)
25560 * current thread: Threads. (line 38)
25561 * current thread, remote request: General Query Packets.
25563 * cwd: Source Path. (line 99)
25564 * Cygwin DLL, debugging: Cygwin Native. (line 30)
25565 * Cygwin-specific commands: Cygwin Native. (line 6)
25566 * d (delete): Delete Breaks. (line 36)
25567 * d (SingleKey TUI key): TUI Single Key Mode. (line 13)
25568 * d packet: Packets. (line 86)
25569 * D packet: Packets. (line 92)
25570 * data breakpoints: Breakpoints. (line 20)
25571 * data manipulation, in GDB/MI: GDB/MI Data Manipulation.
25573 * dead names, GNU Hurd: Hurd Native. (line 85)
25574 * debug formats and C++: C plus plus expressions.
25576 * debug links: Separate Debug Files.
25578 * debug remote protocol: Debugging Output. (line 86)
25579 * debug_chaos: M32R/D. (line 50)
25580 * debugger crash: Bug Criteria. (line 9)
25581 * debugging C++ programs: C plus plus expressions.
25583 * debugging information directory, global: Separate Debug Files.
25585 * debugging information in separate files: Separate Debug Files.
25587 * debugging multiple processes: Processes. (line 52)
25588 * debugging multithreaded programs (on HP-UX): Threads. (line 82)
25589 * debugging optimized code: Compilation. (line 26)
25590 * debugging stub, example: remote stub. (line 6)
25591 * debugging target: Targets. (line 6)
25592 * debugging the Cygwin DLL: Cygwin Native. (line 30)
25593 * default value of solib-absolute-prefix: Files. (line 374)
25594 * define: Define. (line 37)
25595 * defining macros interactively: Macros. (line 54)
25596 * definition, showing a macro's: Macros. (line 50)
25597 * delete: Delete Breaks. (line 36)
25598 * delete breakpoints: Delete Breaks. (line 36)
25599 * delete checkpoint CHECKPOINT-ID: Checkpoint/Restart. (line 56)
25600 * delete display: Auto Display. (line 46)
25601 * delete fork FORK-ID: Processes. (line 100)
25602 * delete mem: Memory Region Attributes.
25604 * delete tracepoint: Create and Delete Tracepoints.
25606 * delete-char (C-d): Commands For Text. (line 6)
25607 * delete-char-or-list (): Commands For Completion.
25609 * delete-horizontal-space (): Commands For Killing.
25611 * deleting breakpoints, watchpoints, catchpoints: Delete Breaks.
25613 * deliver a signal to a program: Signaling. (line 6)
25614 * demangling C++ names: Print Settings. (line 236)
25615 * deprecated commands: Maintenance Commands.
25617 * derived type of an object, printing: Print Settings. (line 288)
25618 * descriptor tables display: DJGPP Native. (line 24)
25619 * detach: Attach. (line 36)
25620 * detach (remote): Connecting. (line 90)
25621 * detach fork FORK-ID: Processes. (line 95)
25622 * detach from task, GNU Hurd: Hurd Native. (line 60)
25623 * detach from thread, GNU Hurd: Hurd Native. (line 110)
25624 * device: Renesas Boards. (line 6)
25625 * digit-argument (M-0, M-1, ... M--): Numeric Arguments. (line 6)
25626 * dir: Source Path. (line 39)
25627 * direct memory access (DMA) on MS-DOS: DJGPP Native. (line 75)
25628 * directories for source files: Source Path. (line 6)
25629 * directory: Source Path. (line 39)
25630 * directory, compilation: Source Path. (line 99)
25631 * directory, current: Source Path. (line 99)
25632 * dis (disable): Disabling. (line 35)
25633 * disable: Disabling. (line 35)
25634 * disable display: Auto Display. (line 53)
25635 * disable mem: Memory Region Attributes.
25637 * disable tracepoint: Enable and Disable Tracepoints.
25639 * disable-completion: Readline Init File Syntax.
25641 * disassemble: Machine Code. (line 36)
25642 * disconnect: Connecting. (line 97)
25643 * display: Auto Display. (line 24)
25644 * display command history: Command History. (line 78)
25645 * display derived types: Print Settings. (line 288)
25646 * display disabled out of scope: Auto Display. (line 75)
25647 * display GDB copyright: Help. (line 137)
25648 * display of expressions: Auto Display. (line 6)
25649 * display remote monitor communications: Target Commands. (line 108)
25650 * display remote packets: Debugging Output. (line 86)
25651 * DJGPP debugging: DJGPP Native. (line 6)
25652 * dll-symbols: Cygwin Native. (line 26)
25653 * DLLs with no debugging symbols: Non-debug DLL symbols.
25655 * do (down): Selection. (line 40)
25656 * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
25658 * document: Define. (line 46)
25659 * documentation: Formatting Documentation.
25661 * don't repeat command: Define. (line 58)
25662 * dont-repeat: Define. (line 58)
25663 * DOS serial data link, remote debugging: DJGPP Native. (line 121)
25664 * DOS serial port status: DJGPP Native. (line 142)
25665 * down: Selection. (line 40)
25666 * Down: TUI Keys. (line 60)
25667 * down-silently: Selection. (line 64)
25668 * downcase-word (M-l): Commands For Text. (line 45)
25669 * download server address (M32R): M32R/D. (line 27)
25670 * download to H8/300 or H8/500: H8/300. (line 19)
25671 * download to Renesas SH: H8/300. (line 19)
25672 * download to Sparclet: Sparclet Download. (line 6)
25673 * download to VxWorks: VxWorks Download. (line 6)
25674 * DPMI: DJGPP Native. (line 6)
25675 * drain, E7000: Renesas ICE. (line 37)
25676 * dump: Dump/Restore Files. (line 13)
25677 * dump all data collected at tracepoint: tdump. (line 6)
25678 * dump core from inferior: Core File Generation.
25680 * dump data to a file: Dump/Restore Files. (line 6)
25681 * dump-functions (): Miscellaneous Commands.
25683 * dump-macros (): Miscellaneous Commands.
25685 * dump-variables (): Miscellaneous Commands.
25687 * dump/restore files: Dump/Restore Files. (line 6)
25688 * DWARF 2 compilation units cache: Maintenance Commands.
25690 * DWARF-2 CFI and CRIS: CRIS. (line 18)
25691 * dynamic linking: Files. (line 113)
25692 * e (edit): Edit. (line 6)
25693 * e7000: Renesas ICE. (line 24)
25694 * EBCDIC character set: Character Sets. (line 74)
25695 * echo: Output. (line 12)
25696 * edit: Edit. (line 6)
25697 * editing: Editing. (line 15)
25698 * editing command lines: Readline Bare Essentials.
25700 * editing source files: Edit. (line 6)
25701 * editing-mode: Readline Init File Syntax.
25703 * eight-bit characters in strings: Print Settings. (line 181)
25704 * elaboration phase: Starting. (line 82)
25705 * else: Command Files. (line 56)
25706 * Emacs: Emacs. (line 6)
25707 * empty response, for unsupported packets: Overview. (line 86)
25708 * enable: Disabling. (line 42)
25709 * enable display: Auto Display. (line 58)
25710 * enable mem: Memory Region Attributes.
25712 * enable tracepoint: Enable and Disable Tracepoints.
25714 * enable-keypad: Readline Init File Syntax.
25716 * enable/disable a breakpoint: Disabling. (line 6)
25717 * end (breakpoint commands): Break Commands. (line 11)
25718 * end (if/else/while commands): Command Files. (line 85)
25719 * end (user-defined commands): Define. (line 46)
25720 * end-kbd-macro (C-x )): Keyboard Macros. (line 9)
25721 * end-of-history (M->): Commands For History.
25723 * end-of-line (C-e): Commands For Moving. (line 9)
25724 * entering numbers: Numbers. (line 6)
25725 * environment (of your program): Environment. (line 6)
25726 * errno values, in file-i/o protocol: Errno values. (line 6)
25727 * error annotation: Errors. (line 10)
25728 * error on valid input: Bug Criteria. (line 12)
25729 * error-begin annotation: Errors. (line 22)
25730 * event debugging info: Debugging Output. (line 35)
25731 * event designators: Event Designators. (line 6)
25732 * event handling: Set Catchpoints. (line 6)
25733 * examine process image: SVR4 Process Information.
25735 * examining data: Data. (line 6)
25736 * examining memory: Memory. (line 9)
25737 * exception handlers: Set Catchpoints. (line 6)
25738 * exception handlers, how to list: Frame Info. (line 60)
25739 * exceptionHandler: Bootstrapping. (line 38)
25740 * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
25742 * exec-file: Files. (line 39)
25743 * executable file: Files. (line 16)
25744 * executable file target: Target Commands. (line 50)
25745 * execute commands from a file: Command Files. (line 14)
25746 * execute remote command, remote request: General Query Packets.
25748 * exited annotation: Annotations for Running.
25750 * exiting GDB: Quitting GDB. (line 6)
25751 * expand macro once: Macros. (line 41)
25752 * expand-tilde: Readline Init File Syntax.
25754 * expanding preprocessor macros: Macros. (line 32)
25755 * expression debugging info: Debugging Output. (line 42)
25756 * expressions: Expressions. (line 6)
25757 * expressions in Ada: Ada. (line 11)
25758 * expressions in C or C++: C. (line 6)
25759 * expressions in C++: C plus plus expressions.
25761 * expressions in Modula-2: Modula-2. (line 12)
25762 * extend GDB for remote targets: Connecting. (line 104)
25763 * f (frame): Selection. (line 11)
25764 * f (SingleKey TUI key): TUI Single Key Mode. (line 16)
25765 * F packet: Packets. (line 103)
25766 * F reply packet: The F reply packet. (line 6)
25767 * F request packet: The F request packet.
25769 * fatal signal: Bug Criteria. (line 9)
25770 * fatal signals: Signals. (line 15)
25771 * FDL, GNU Free Documentation License: GNU Free Documentation License.
25773 * features of the remote protocol: General Query Packets.
25775 * fg (resume foreground execution): Continuing and Stepping.
25777 * file: Files. (line 16)
25778 * file-i/o examples: File-I/O Examples. (line 6)
25779 * file-i/o overview: File-I/O Overview. (line 6)
25780 * File-I/O remote protocol extension: File-I/O remote protocol extension.
25782 * file-i/o reply packet: The F reply packet. (line 6)
25783 * file-i/o request packet: The F request packet.
25785 * find downloadable SREC files (M32R): M32R/D. (line 15)
25786 * find trace snapshot: tfind. (line 6)
25787 * finish: Continuing and Stepping.
25789 * flinching: Messages/Warnings. (line 50)
25790 * float promotion: ABI. (line 29)
25791 * floating point: Floating Point Hardware.
25793 * floating point registers: Registers. (line 15)
25794 * floating point, MIPS remote: MIPS Embedded. (line 60)
25795 * flush_i_cache: Bootstrapping. (line 60)
25796 * flushregs: Maintenance Commands.
25798 * focus: TUI Commands. (line 34)
25799 * focus of debugging: Threads. (line 38)
25800 * foo: Symbol Errors. (line 50)
25801 * fork FORK-ID: Processes. (line 85)
25802 * fork, debugging programs which call: Processes. (line 6)
25803 * format options: Print Settings. (line 6)
25804 * formatted output: Output Formats. (line 6)
25805 * Fortran: Summary. (line 35)
25806 * Fortran Defaults: Fortran Defaults. (line 6)
25807 * Fortran operators and expressions: Fortran Operators. (line 6)
25808 * Fortran-specific support in GDB: Fortran. (line 6)
25809 * forward-backward-delete-char (): Commands For Text. (line 15)
25810 * forward-char (C-f): Commands For Moving. (line 12)
25811 * forward-search: Search. (line 9)
25812 * forward-search-history (C-s): Commands For History.
25814 * forward-word (M-f): Commands For Moving. (line 18)
25815 * FR-V shared-library debugging: Debugging Output. (line 104)
25816 * frame debugging info: Debugging Output. (line 50)
25817 * frame number: Frames. (line 28)
25818 * frame pointer: Frames. (line 21)
25819 * frame pointer register: Registers. (line 26)
25820 * frame, command: Frames. (line 45)
25821 * frame, definition: Frames. (line 6)
25822 * frame, selecting: Selection. (line 11)
25823 * frameless execution: Frames. (line 34)
25824 * frames-invalid annotation: Invalidation. (line 9)
25825 * free memory information (MS-DOS): DJGPP Native. (line 19)
25826 * fstat, file-i/o system call: stat/fstat. (line 6)
25827 * ftpload, E7000: Renesas ICE. (line 33)
25828 * ftplogin, E7000: Renesas ICE. (line 27)
25829 * Fujitsu: remote stub. (line 69)
25830 * full symbol tables, listing GDB's internal: Symbols. (line 269)
25831 * function call arguments, optimized out: Backtrace. (line 65)
25832 * function entry/exit, wrong values of variables: Variables. (line 58)
25833 * functions without line info, and stepping: Continuing and Stepping.
25835 * g packet: Packets. (line 108)
25836 * G packet: Packets. (line 124)
25837 * g++, GNU C++ compiler: C. (line 10)
25838 * garbled pointers: DJGPP Native. (line 42)
25839 * GCC and C++: C plus plus expressions.
25841 * gcore: Core File Generation.
25843 * GDB bugs, reporting: Bug Reporting. (line 6)
25844 * GDB reference card: Formatting Documentation.
25846 * GDB startup: Startup. (line 6)
25847 * GDB version number: Help. (line 127)
25848 * gdb.ini: Startup. (line 44)
25849 * GDB/MI development: GDB/MI Development and Front Ends.
25851 * GDB/MI, breakpoint commands: GDB/MI Breakpoint Commands.
25853 * GDB/MI, compatibility with CLI: GDB/MI Compatibility with CLI.
25855 * GDB/MI, data manipulation: GDB/MI Data Manipulation.
25857 * GDB/MI, input syntax: GDB/MI Input Syntax. (line 6)
25858 * GDB/MI, its purpose: GDB/MI. (line 9)
25859 * GDB/MI, out-of-band records: GDB/MI Out-of-band Records.
25861 * GDB/MI, output syntax: GDB/MI Output Syntax.
25863 * GDB/MI, result records: GDB/MI Result Records.
25865 * GDB/MI, simple examples: GDB/MI Simple Examples.
25867 * GDB/MI, stream records: GDB/MI Stream Records.
25869 * gdbarch debugging info: Debugging Output. (line 18)
25870 * GDBHISTFILE, environment variable: Command History. (line 26)
25871 * gdbserver: Server. (line 6)
25872 * GDT: DJGPP Native. (line 24)
25873 * generate-core-file: Core File Generation.
25875 * get thread-local storage address, remote request: General Query Packets.
25877 * getDebugChar: Bootstrapping. (line 14)
25878 * gettimeofday, file-i/o system call: gettimeofday. (line 6)
25879 * global debugging information directory: Separate Debug Files.
25881 * GNU C++: C. (line 10)
25882 * GNU Emacs: Emacs. (line 6)
25883 * GNU Hurd debugging: Hurd Native. (line 6)
25884 * GNU/Linux LWP debug messages: Debugging Output. (line 66)
25885 * gnu_debuglink_crc32: Separate Debug Files.
25887 * h (help): Help. (line 9)
25888 * H packet: Packets. (line 135)
25889 * H8/300 or H8/500 download: H8/300. (line 19)
25890 * handle: Signals. (line 45)
25891 * handle_exception: Stub Contents. (line 15)
25892 * handling signals: Signals. (line 27)
25893 * hardware breakpoints: Set Breaks. (line 81)
25894 * hardware breakpoints, and E7000: Renesas ICE. (line 41)
25895 * hardware watchpoints: Set Watchpoints. (line 22)
25896 * hash mark while downloading: Target Commands. (line 99)
25897 * hbreak: Set Breaks. (line 81)
25898 * help: Help. (line 6)
25899 * help target: Target Commands. (line 19)
25900 * help user-defined: Define. (line 63)
25901 * heuristic-fence-post (Alpha, MIPS): MIPS. (line 14)
25902 * history events: Event Designators. (line 7)
25903 * history expansion: History Interaction. (line 6)
25904 * history expansion, turn on/off: Command History. (line 53)
25905 * history file: Command History. (line 26)
25906 * history number: Value History. (line 13)
25907 * history of values printed by GDB: Value History. (line 6)
25908 * history size: Command History. (line 45)
25909 * history substitution: Command History. (line 26)
25910 * history-preserve-point: Readline Init File Syntax.
25912 * history-search-backward (): Commands For History.
25914 * history-search-forward (): Commands For History.
25916 * HISTSIZE, environment variable: Command History. (line 45)
25917 * hook: Hooks. (line 6)
25918 * hookpost: Hooks. (line 11)
25919 * hooks, for commands: Hooks. (line 6)
25920 * hooks, post-command: Hooks. (line 11)
25921 * hooks, pre-command: Hooks. (line 6)
25922 * horizontal-scroll-mode: Readline Init File Syntax.
25924 * host character set: Character Sets. (line 6)
25925 * how many arguments (user-defined commands): Define. (line 25)
25926 * HPPA support: HPPA. (line 6)
25927 * htrace: OpenRISC 1000. (line 69)
25928 * hwatch: OpenRISC 1000. (line 59)
25929 * i (info): Help. (line 100)
25930 * i packet: Packets. (line 149)
25931 * I packet: Packets. (line 154)
25932 * i/o: Input/Output. (line 6)
25933 * I/O registers (Atmel AVR): AVR. (line 10)
25934 * i386: remote stub. (line 57)
25935 * i386-stub.c: remote stub. (line 57)
25936 * IBM1047 character set: Character Sets. (line 74)
25937 * IDT: DJGPP Native. (line 24)
25938 * if: Command Files. (line 56)
25939 * ignore: Conditions. (line 77)
25940 * ignore count (of breakpoint): Conditions. (line 66)
25941 * INCLUDE_RDB: VxWorks. (line 33)
25942 * incomplete type: Symbols. (line 99)
25943 * indentation in structure display: Print Settings. (line 157)
25944 * inferior debugging info: Debugging Output. (line 57)
25945 * inferior functions, calling: Calling. (line 6)
25946 * inferior tty: Input/Output. (line 44)
25947 * infinite recursion in user-defined commands: Define. (line 73)
25948 * info: Help. (line 100)
25949 * info address: Symbols. (line 44)
25950 * info all-registers: Registers. (line 15)
25951 * info args: Frame Info. (line 51)
25952 * info auxv: OS Information. (line 33)
25953 * info breakpoints: Set Breaks. (line 136)
25954 * info catch: Frame Info. (line 60)
25955 * info checkpoints: Checkpoint/Restart. (line 31)
25956 * info classes: Symbols. (line 196)
25957 * info common: Special Fortran commands.
25959 * info copying: Help. (line 137)
25960 * info dcache: Caching Remote Data. (line 21)
25961 * info display: Auto Display. (line 67)
25962 * info dll: Cygwin Native. (line 23)
25963 * info dos: DJGPP Native. (line 15)
25964 * info extensions: Show. (line 34)
25965 * info f (info frame): Frame Info. (line 17)
25966 * info files: Files. (line 191)
25967 * info float: Floating Point Hardware.
25969 * info for known object files: Maintenance Commands.
25971 * info forks: Processes. (line 80)
25972 * info frame: Frame Info. (line 17)
25973 * info frame, show the source language: Show. (line 15)
25974 * info functions: Symbols. (line 175)
25975 * info handle: Signals. (line 33)
25976 * info io_registers, AVR: AVR. (line 10)
25977 * info line: Machine Code. (line 13)
25978 * info line, and Objective-C: Method Names in Commands.
25980 * info locals: Frame Info. (line 55)
25981 * info macro: Macros. (line 50)
25982 * info mem: Memory Region Attributes.
25984 * info meminfo: SVR4 Process Information.
25986 * info or1k spr: OpenRISC 1000. (line 20)
25987 * info pidlist: SVR4 Process Information.
25989 * info proc: SVR4 Process Information.
25991 * info program: Stopping. (line 18)
25992 * info registers: Registers. (line 11)
25993 * info scope: Symbols. (line 130)
25994 * info selectors: Symbols. (line 202)
25995 * info serial: DJGPP Native. (line 142)
25996 * info set: Help. (line 120)
25997 * info share: Files. (line 323)
25998 * info sharedlibrary: Files. (line 323)
25999 * info signals: Signals. (line 33)
26000 * info source: Symbols. (line 150)
26001 * info source, show the source language: Show. (line 21)
26002 * info sources: Symbols. (line 169)
26003 * info stack: Backtrace. (line 34)
26004 * info symbol: Symbols. (line 54)
26005 * info target: Files. (line 191)
26006 * info terminal: Input/Output. (line 12)
26007 * info threads: Threads. (line 59)
26008 * info threads (HP-UX): Threads. (line 96)
26009 * info tp: Listing Tracepoints. (line 6)
26010 * info tracepoints: Listing Tracepoints. (line 6)
26011 * info types: Symbols. (line 116)
26012 * info udot: OS Information. (line 16)
26013 * info variables: Symbols. (line 187)
26014 * info vector: Vector Unit. (line 9)
26015 * info w32: Cygwin Native. (line 12)
26016 * info warranty: Help. (line 141)
26017 * info watchpoints [N]: Set Watchpoints. (line 49)
26018 * info win: TUI Commands. (line 12)
26019 * information about tracepoints: Listing Tracepoints. (line 6)
26020 * inheritance: Debugging C plus plus.
26022 * init file: Startup. (line 11)
26023 * init file name: Startup. (line 37)
26024 * init-if-undefined: Convenience Vars. (line 41)
26025 * initial frame: Frames. (line 12)
26026 * initialization file, readline: Readline Init File. (line 6)
26027 * innermost frame: Frames. (line 12)
26028 * input syntax for GDB/MI: GDB/MI Input Syntax. (line 6)
26029 * input-meta: Readline Init File Syntax.
26031 * insert-comment (M-#): Miscellaneous Commands.
26033 * insert-completions (M-*): Commands For Completion.
26035 * inspect: Data. (line 6)
26036 * installation: Installing GDB. (line 6)
26037 * instructions, assembly: Machine Code. (line 36)
26038 * integral datatypes, in file-i/o protocol: Integral datatypes.
26040 * Intel: remote stub. (line 57)
26041 * Intel disassembly flavor: Machine Code. (line 68)
26042 * interaction, readline: Readline Interaction.
26044 * internal commands: Maintenance Commands.
26046 * internal GDB breakpoints: Set Breaks. (line 241)
26047 * interpreter-exec: Interpreters. (line 43)
26048 * interrupt: Quitting GDB. (line 13)
26049 * interrupt remote programs: Remote configuration.
26051 * interrupting remote programs: Connecting. (line 77)
26052 * interrupting remote targets: Bootstrapping. (line 25)
26053 * interrupts (remote protocol): Interrupts. (line 6)
26054 * invalid input: Bug Criteria. (line 16)
26055 * invoke another interpreter: Interpreters. (line 37)
26056 * isatty, file-i/o system call: isatty. (line 6)
26057 * isearch-terminators: Readline Init File Syntax.
26059 * ISO 8859-1 character set: Character Sets. (line 68)
26060 * ISO Latin 1 character set: Character Sets. (line 68)
26061 * jump: Jumping. (line 10)
26062 * jump, and Objective-C: Method Names in Commands.
26064 * k packet: Packets. (line 158)
26065 * kernel crash dump: BSD libkvm Interface.
26067 * kernel memory image: BSD libkvm Interface.
26069 * keymap: Readline Init File Syntax.
26071 * kill: Kill Process. (line 6)
26072 * kill ring: Readline Killing Commands.
26074 * kill-line (C-k): Commands For Killing.
26076 * kill-region (): Commands For Killing.
26078 * kill-whole-line (): Commands For Killing.
26080 * kill-word (M-d): Commands For Killing.
26082 * killing text: Readline Killing Commands.
26084 * kvm: BSD libkvm Interface.
26086 * l (list): List. (line 6)
26087 * languages: Languages. (line 6)
26088 * last tracepoint number: Create and Delete Tracepoints.
26090 * latest breakpoint: Set Breaks. (line 6)
26091 * layout: TUI Commands. (line 15)
26092 * LDT: DJGPP Native. (line 24)
26093 * leaving GDB: Quitting GDB. (line 6)
26094 * Left: TUI Keys. (line 63)
26095 * libkvm: BSD libkvm Interface.
26097 * limit hardware breakpoints and watchpoints: Remote configuration.
26099 * limit on number of printed array elements: Print Settings. (line 123)
26100 * limits, in file-i/o protocol: Limits. (line 6)
26101 * linespec: List. (line 45)
26102 * Linux lightweight processes: Debugging Output. (line 66)
26103 * list: List. (line 6)
26104 * list active threads, remote request: General Query Packets.
26106 * list of supported file-i/o calls: List of supported calls.
26108 * list output in GDB/MI: GDB/MI Output Syntax.
26110 * list, and Objective-C: Method Names in Commands.
26112 * list, how many lines to display: List. (line 29)
26113 * listing GDB's internal symbol tables: Symbols. (line 269)
26114 * listing machine instructions: Machine Code. (line 36)
26115 * listing mapped overlays: Overlay Commands. (line 60)
26116 * load address, overlay's: How Overlays Work. (line 6)
26117 * load FILENAME: Target Commands. (line 115)
26118 * load shared library: Files. (line 320)
26119 * load symbols from memory: Files. (line 162)
26120 * local variables: Symbols. (line 130)
26121 * locate address: Output Formats. (line 35)
26122 * lock scheduler: Thread Stops. (line 89)
26123 * log output in GDB/MI: GDB/MI Output Syntax.
26125 * logging file name: Logging output. (line 13)
26126 * logging GDB output: Logging output. (line 6)
26127 * loop_break: Command Files. (line 75)
26128 * loop_continue: Command Files. (line 79)
26129 * lseek flags, in file-i/o protocol: Lseek flags. (line 6)
26130 * lseek, file-i/o system call: lseek. (line 6)
26131 * M packet: Packets. (line 185)
26132 * m packet: Packets. (line 165)
26133 * M32-EVA target board address: M32R/D. (line 21)
26134 * M32R/Chaos debugging: M32R/D. (line 50)
26135 * m680x0: remote stub. (line 60)
26136 * m68k-stub.c: remote stub. (line 60)
26137 * machine instructions: Machine Code. (line 36)
26138 * macro define: Macros. (line 54)
26139 * macro definition, showing: Macros. (line 50)
26140 * macro exp1: Macros. (line 39)
26141 * macro expand: Macros. (line 32)
26142 * macro expansion, showing the results of preprocessor: Macros.
26144 * macro list: Macros. (line 76)
26145 * macro undef: Macros. (line 69)
26146 * macros, example of debugging with: Macros. (line 80)
26147 * macros, user-defined: Macros. (line 54)
26148 * mailing lists: GDB/MI Development and Front Ends.
26150 * maint agent: Maintenance Commands.
26152 * maint check-symtabs: Maintenance Commands.
26154 * maint cplus first_component: Maintenance Commands.
26156 * maint cplus namespace: Maintenance Commands.
26158 * maint demangle: Maintenance Commands.
26160 * maint deprecate: Maintenance Commands.
26162 * maint dump-me: Maintenance Commands.
26164 * maint info breakpoints: Maintenance Commands.
26166 * maint info psymtabs: Symbols. (line 269)
26167 * maint info sections: Files. (line 200)
26168 * maint info sol-threads: Threads. (line 126)
26169 * maint info symtabs: Symbols. (line 269)
26170 * maint internal-error: Maintenance Commands.
26172 * maint internal-warning: Maintenance Commands.
26174 * maint packet: Maintenance Commands.
26176 * maint print architecture: Maintenance Commands.
26178 * maint print cooked-registers: Maintenance Commands.
26180 * maint print dummy-frames: Maintenance Commands.
26182 * maint print objfiles: Maintenance Commands.
26184 * maint print psymbols: Symbols. (line 250)
26185 * maint print raw-registers: Maintenance Commands.
26187 * maint print reggroups: Maintenance Commands.
26189 * maint print register-groups: Maintenance Commands.
26191 * maint print registers: Maintenance Commands.
26193 * maint print statistics: Maintenance Commands.
26195 * maint print symbols: Symbols. (line 250)
26196 * maint print type: Maintenance Commands.
26198 * maint print unwind, HPPA: HPPA. (line 17)
26199 * maint set dwarf2 max-cache-age: Maintenance Commands.
26201 * maint set profile: Maintenance Commands.
26203 * maint show dwarf2 max-cache-age: Maintenance Commands.
26205 * maint show profile: Maintenance Commands.
26207 * maint show-debug-regs: Maintenance Commands.
26209 * maint space: Maintenance Commands.
26211 * maint time: Maintenance Commands.
26213 * maint translate-address: Maintenance Commands.
26215 * maint undeprecate: Maintenance Commands.
26217 * maintenance commands: Maintenance Commands.
26219 * make: Shell Commands. (line 19)
26220 * manual overlay debugging: Overlay Commands. (line 23)
26221 * map an overlay: Overlay Commands. (line 30)
26222 * mapinfo list, QNX Neutrino: SVR4 Process Information.
26224 * mapped address: How Overlays Work. (line 6)
26225 * mapped overlays: How Overlays Work. (line 6)
26226 * mark-modified-lines: Readline Init File Syntax.
26228 * mark-symlinked-directories: Readline Init File Syntax.
26230 * match-hidden-files: Readline Init File Syntax.
26232 * maximum value for offset of closest symbol: Print Settings. (line 70)
26233 * mem: Memory Region Attributes.
26235 * member functions: C plus plus expressions.
26237 * memory address space mappings: SVR4 Process Information.
26239 * memory map format: Memory map format. (line 6)
26240 * memory models, H8/500: H8/500. (line 6)
26241 * memory region attributes: Memory Region Attributes.
26243 * memory tracing: Breakpoints. (line 20)
26244 * memory transfer, in file-i/o protocol: Memory transfer. (line 6)
26245 * memory used by commands: Maintenance Commands.
26247 * memory used for symbol tables: Files. (line 308)
26248 * memory, alignment and size of remote accesses: Packets. (line 172)
26249 * memory, viewing as typed object: Expressions. (line 42)
26250 * memset: Bootstrapping. (line 70)
26251 * menu-complete (): Commands For Completion.
26253 * meta-flag: Readline Init File Syntax.
26255 * mi interpreter: Interpreters. (line 26)
26256 * mi1 interpreter: Interpreters. (line 34)
26257 * mi2 interpreter: Interpreters. (line 31)
26258 * minimal language: Unsupported languages.
26260 * Minimal symbols and DLLs: Non-debug DLL symbols.
26262 * MIPS addresses, masking: MIPS. (line 84)
26263 * MIPS boards: MIPS Embedded. (line 6)
26264 * MIPS GP register size on stack: MIPS. (line 32)
26265 * MIPS remote floating point: MIPS Embedded. (line 60)
26266 * MIPS stack: MIPS. (line 6)
26267 * MIPS stack space for arguments: MIPS. (line 50)
26268 * MMX registers (x86): Registers. (line 71)
26269 * mode_t values, in file-i/o protocol: mode_t values. (line 6)
26270 * Modula-2: Summary. (line 27)
26271 * Modula-2 built-ins: Built-In Func/Proc. (line 6)
26272 * Modula-2 checks: M2 Checks. (line 6)
26273 * Modula-2 constants: Built-In Func/Proc. (line 109)
26274 * Modula-2 defaults: M2 Defaults. (line 6)
26275 * Modula-2 operators: M2 Operators. (line 6)
26276 * Modula-2 types: M2 Types. (line 6)
26277 * Modula-2, deviations from: Deviations. (line 6)
26278 * Modula-2, GDB support: Modula-2. (line 6)
26279 * monitor: Connecting. (line 104)
26280 * Motorola 680x0: remote stub. (line 60)
26281 * MS Windows debugging: Cygwin Native. (line 6)
26282 * MS-DOS system info: DJGPP Native. (line 19)
26283 * MS-DOS-specific commands: DJGPP Native. (line 6)
26284 * multiple processes: Processes. (line 6)
26285 * multiple targets: Active Targets. (line 6)
26286 * multiple threads: Threads. (line 6)
26287 * multiple threads, backtrace: Backtrace. (line 37)
26288 * n (next): Continuing and Stepping.
26290 * n (SingleKey TUI key): TUI Single Key Mode. (line 19)
26291 * names of symbols: Symbols. (line 14)
26292 * namespace in C++: C plus plus expressions.
26294 * native Cygwin debugging: Cygwin Native. (line 6)
26295 * native DJGPP debugging: DJGPP Native. (line 6)
26296 * negative breakpoint numbers: Set Breaks. (line 241)
26297 * NetROM ROM emulator target: Target Commands. (line 88)
26298 * New SYSTAG message: Threads. (line 44)
26299 * New SYSTAG message, on HP-UX: Threads. (line 86)
26300 * next: Continuing and Stepping.
26302 * next-history (C-n): Commands For History.
26304 * nexti: Continuing and Stepping.
26306 * ni (nexti): Continuing and Stepping.
26308 * non-incremental-forward-search-history (M-n): Commands For History.
26310 * non-incremental-reverse-search-history (M-p): Commands For History.
26312 * non-member C++ functions, set breakpoint in: Set Breaks. (line 127)
26313 * noninvasive task options: Hurd Native. (line 73)
26314 * nosharedlibrary: Files. (line 336)
26315 * notation, readline: Readline Bare Essentials.
26317 * notational conventions, for GDB/MI: GDB/MI. (line 25)
26318 * notify output in GDB/MI: GDB/MI Output Syntax.
26320 * NULL elements in arrays: Print Settings. (line 148)
26321 * number of array elements to print: Print Settings. (line 123)
26322 * number representation: Numbers. (line 6)
26323 * numbers for breakpoints: Breakpoints. (line 41)
26324 * object files, relocatable, reading symbols from: Files. (line 132)
26325 * Objective-C: Objective-C. (line 6)
26326 * Objective-C, classes and selectors: Symbols. (line 196)
26327 * Objective-C, print objects: The Print Command with Objective-C.
26329 * observer debugging info: Debugging Output. (line 73)
26330 * octal escapes in strings: Print Settings. (line 181)
26331 * online documentation: Help. (line 6)
26332 * opaque data types: Symbols. (line 232)
26333 * open flags, in file-i/o protocol: Open flags. (line 6)
26334 * open, file-i/o system call: open. (line 6)
26335 * OpenRISC 1000: OpenRISC 1000. (line 6)
26336 * OpenRISC 1000 htrace: OpenRISC 1000. (line 58)
26337 * operations allowed on pending breakpoints: Set Breaks. (line 228)
26338 * optimized code, debugging: Compilation. (line 26)
26339 * optimized code, wrong values of variables: Variables. (line 58)
26340 * optional debugging messages: Debugging Output. (line 6)
26341 * optional warnings: Messages/Warnings. (line 6)
26342 * or1k boards: OpenRISC 1000. (line 6)
26343 * or1ksim: OpenRISC 1000. (line 16)
26344 * OS ABI: ABI. (line 11)
26345 * OS information: OS Information. (line 6)
26346 * out-of-band records in GDB/MI: GDB/MI Out-of-band Records.
26348 * outermost frame: Frames. (line 12)
26349 * output: Output. (line 35)
26350 * output formats: Output Formats. (line 6)
26351 * output syntax of GDB/MI: GDB/MI Output Syntax.
26353 * output-meta: Readline Init File Syntax.
26355 * overlay: Overlay Commands. (line 17)
26356 * overlay area: How Overlays Work. (line 6)
26357 * overlay example program: Overlay Sample Program.
26359 * overlays: Overlays. (line 6)
26360 * overlays, setting breakpoints in: Overlay Commands. (line 93)
26361 * overload-choice annotation: Prompting. (line 32)
26362 * overloaded functions, calling: C plus plus expressions.
26364 * overloaded functions, overload resolution: Debugging C plus plus.
26366 * overloading: Breakpoint Menus. (line 6)
26367 * overloading in C++: Debugging C plus plus.
26369 * overwrite-mode (): Commands For Text. (line 53)
26370 * p packet: Packets. (line 198)
26371 * P packet: Packets. (line 213)
26372 * Pacal objects, static members display: Print Settings. (line 312)
26373 * packet size, remote protocol: General Query Packets.
26375 * packets, reporting on stdout: Debugging Output. (line 86)
26376 * packets, tracepoint: Tracepoint Packets. (line 6)
26377 * page tables display (MS-DOS): DJGPP Native. (line 56)
26378 * page-completions: Readline Init File Syntax.
26380 * partial symbol dump: Symbols. (line 250)
26381 * partial symbol tables, listing GDB's internal: Symbols. (line 269)
26382 * Pascal: Summary. (line 30)
26383 * Pascal support in GDB, limitations: Pascal. (line 6)
26384 * passcount: Tracepoint Passcounts.
26386 * patching binaries: Patching. (line 6)
26387 * patching object files: Files. (line 26)
26388 * path: Environment. (line 14)
26389 * pause current task (GNU Hurd): Hurd Native. (line 49)
26390 * pause current thread (GNU Hurd): Hurd Native. (line 91)
26391 * pauses in output: Screen Size. (line 6)
26392 * pending breakpoints: Set Breaks. (line 195)
26393 * PgDn: TUI Keys. (line 54)
26394 * PgUp: TUI Keys. (line 51)
26395 * physical address from linear address: DJGPP Native. (line 81)
26396 * pipe, target remote to: Connecting. (line 60)
26397 * pipes: Starting. (line 54)
26398 * pmon, MIPS remote: MIPS Embedded. (line 132)
26399 * po (print-object): The Print Command with Objective-C.
26401 * pointer values, in file-i/o protocol: Pointer values. (line 6)
26402 * pointer, finding referent: Print Settings. (line 79)
26403 * port rights, GNU Hurd: Hurd Native. (line 85)
26404 * port sets, GNU Hurd: Hurd Native. (line 85)
26405 * possible-completions (M-?): Commands For Completion.
26407 * post-commands annotation: Prompting. (line 27)
26408 * post-overload-choice annotation: Prompting. (line 32)
26409 * post-prompt annotation: Prompting. (line 24)
26410 * post-prompt-for-continue annotation: Prompting. (line 40)
26411 * post-query annotation: Prompting. (line 36)
26412 * pre-commands annotation: Prompting. (line 27)
26413 * pre-overload-choice annotation: Prompting. (line 32)
26414 * pre-prompt annotation: Prompting. (line 24)
26415 * pre-prompt-for-continue annotation: Prompting. (line 40)
26416 * pre-query annotation: Prompting. (line 36)
26417 * prefix for shared library file names: Files. (line 366)
26418 * prefix-meta (<ESC>): Miscellaneous Commands.
26420 * premature return from system calls: Thread Stops. (line 36)
26421 * preprocessor macro expansion, showing the results of: Macros.
26423 * pretty print arrays: Print Settings. (line 98)
26424 * pretty print C++ virtual function tables: Print Settings. (line 323)
26425 * previous-history (C-p): Commands For History.
26427 * print: Data. (line 6)
26428 * print an Objective-C object description: The Print Command with Objective-C.
26430 * print array indexes: Print Settings. (line 108)
26431 * print settings: Print Settings. (line 6)
26432 * print structures in indented form: Print Settings. (line 157)
26433 * print-object: The Print Command with Objective-C.
26435 * print/don't print memory addresses: Print Settings. (line 13)
26436 * printf: Output. (line 46)
26437 * printing data: Data. (line 6)
26438 * proc-trace-entry: SVR4 Process Information.
26440 * proc-trace-exit: SVR4 Process Information.
26442 * proc-untrace-entry: SVR4 Process Information.
26444 * proc-untrace-exit: SVR4 Process Information.
26446 * process detailed status information: SVR4 Process Information.
26448 * process ID: SVR4 Process Information.
26450 * process info via /proc: SVR4 Process Information.
26452 * process list, QNX Neutrino: SVR4 Process Information.
26454 * process status register: Registers. (line 26)
26455 * processes, multiple: Processes. (line 6)
26456 * procfs API calls: SVR4 Process Information.
26458 * profiling GDB: Maintenance Commands.
26460 * program counter register: Registers. (line 26)
26461 * program entry point: Backtrace. (line 87)
26462 * prompt: Prompt. (line 6)
26463 * prompt annotation: Prompting. (line 24)
26464 * prompt-for-continue annotation: Prompting. (line 40)
26465 * protocol basics, file-i/o: Protocol basics. (line 6)
26466 * protocol specific representation of datatypes, in file-i/o protocol: Protocol specific representation of datatypes.
26468 * protocol, GDB remote serial: Overview. (line 14)
26469 * ptrace system call: OS Information. (line 9)
26470 * ptype: Symbols. (line 77)
26471 * putDebugChar: Bootstrapping. (line 20)
26472 * pwd: Working Directory. (line 19)
26473 * q (quit): Quitting GDB. (line 6)
26474 * q (SingleKey TUI key): TUI Single Key Mode. (line 22)
26475 * Q packet: Packets. (line 226)
26476 * q packet: Packets. (line 226)
26477 * qC packet: General Query Packets.
26479 * qCRC packet: General Query Packets.
26481 * qfThreadInfo packet: General Query Packets.
26483 * qGetTLSAddr packet: General Query Packets.
26485 * QNX Neutrino: Neutrino. (line 6)
26486 * qOffsets packet: General Query Packets.
26488 * qP packet: General Query Packets.
26490 * qRcmd packet: General Query Packets.
26492 * qsThreadInfo packet: General Query Packets.
26494 * qSupported packet: General Query Packets.
26496 * qSymbol packet: General Query Packets.
26498 * qThreadExtraInfo packet: General Query Packets.
26500 * query annotation: Prompting. (line 36)
26501 * quit [EXPRESSION]: Quitting GDB. (line 6)
26502 * quit annotation: Errors. (line 6)
26503 * quoted-insert (C-q or C-v): Commands For Text. (line 20)
26504 * quotes in commands: Completion. (line 57)
26505 * quoting Ada internal identifiers: Additions to Ada. (line 76)
26506 * quoting names: Symbols. (line 14)
26507 * qXfer packet: General Query Packets.
26509 * r (run): Starting. (line 6)
26510 * r (SingleKey TUI key): TUI Single Key Mode. (line 25)
26511 * R packet: Packets. (line 235)
26512 * r packet: Packets. (line 230)
26513 * raise exceptions: Set Catchpoints. (line 64)
26514 * range checking: Type Checking. (line 65)
26515 * ranges of breakpoints: Breakpoints. (line 48)
26516 * rbreak: Set Breaks. (line 111)
26517 * RDI heartbeat: ARM. (line 93)
26518 * rdilogenable: ARM. (line 76)
26519 * rdilogfile: ARM. (line 70)
26520 * re-read-init-file (C-x C-r): Miscellaneous Commands.
26522 * read special object, remote request: General Query Packets.
26524 * read, file-i/o system call: read. (line 6)
26525 * read-only sections: Files. (line 258)
26526 * reading symbols from relocatable object files: Files. (line 132)
26527 * reading symbols immediately: Files. (line 90)
26528 * readline: Editing. (line 6)
26529 * readnow: Files. (line 90)
26530 * receive rights, GNU Hurd: Hurd Native. (line 85)
26531 * recent tracepoint number: Create and Delete Tracepoints.
26533 * record aggregates (Ada): Omissions from Ada. (line 44)
26534 * record serial communications on file: Remote configuration.
26536 * recording a session script: Bug Reporting. (line 104)
26537 * redirection: Input/Output. (line 6)
26538 * redraw-current-line (): Commands For Moving. (line 30)
26539 * reference card: Formatting Documentation.
26541 * reference declarations: C plus plus expressions.
26543 * refresh: TUI Commands. (line 39)
26544 * register stack, AMD29K: A29K. (line 6)
26545 * registers: Registers. (line 6)
26546 * regs, Super-H: Super-H. (line 9)
26547 * regular expression: Set Breaks. (line 111)
26548 * reloading symbols: Symbols. (line 208)
26549 * reloading the overlay table: Overlay Commands. (line 52)
26550 * relocatable object files, reading symbols from: Files. (line 132)
26551 * remote connection without stubs: Server. (line 6)
26552 * remote debugging: Remote. (line 6)
26553 * remote memory comparison: Memory. (line 101)
26554 * remote monitor prompt: MIPS Embedded. (line 107)
26555 * remote packets, enabling and disabling: Remote configuration.
26557 * remote programs, interrupting: Connecting. (line 77)
26558 * remote protocol debugging: Debugging Output. (line 86)
26559 * remote protocol, binary data: Overview. (line 55)
26560 * remote protocol, field separator: Overview. (line 47)
26561 * remote query requests: General Query Packets.
26563 * remote serial debugging summary: Debug Session. (line 6)
26564 * remote serial debugging, overview: remote stub. (line 14)
26565 * remote serial protocol: Overview. (line 14)
26566 * remote serial stub: Stub Contents. (line 6)
26567 * remote serial stub list: remote stub. (line 54)
26568 * remote serial stub, initialization: Stub Contents. (line 10)
26569 * remote serial stub, main routine: Stub Contents. (line 15)
26570 * remote stub, example: remote stub. (line 6)
26571 * remote stub, support routines: Bootstrapping. (line 6)
26572 * remote target: Target Commands. (line 58)
26573 * remote target, limit break- and watchpoints: Remote configuration.
26575 * remote timeout: Remote configuration.
26577 * remote, a command: Remote. (line 26)
26578 * remotetimeout: Sparclet. (line 12)
26579 * remove actions from a tracepoint: Tracepoint Actions. (line 17)
26580 * rename, file-i/o system call: rename. (line 6)
26581 * Renesas: remote stub. (line 63)
26582 * Renesas SH download: H8/300. (line 19)
26583 * repeated array elements: Print Settings. (line 135)
26584 * repeating command sequences: Command Syntax. (line 42)
26585 * repeating commands: Command Syntax. (line 21)
26586 * reporting bugs in GDB: GDB Bugs. (line 6)
26587 * reprint the last value: Data. (line 21)
26588 * reset SDI connection, M32R: M32R/D. (line 44)
26589 * response time, MIPS debugging: MIPS. (line 10)
26590 * restart: Checkpoint/Restart. (line 6)
26591 * restart CHECKPOINT-ID: Checkpoint/Restart. (line 44)
26592 * restore: Dump/Restore Files. (line 41)
26593 * restore data from a file: Dump/Restore Files. (line 6)
26594 * result records in GDB/MI: GDB/MI Result Records.
26596 * resuming execution: Continuing and Stepping.
26598 * RET (repeat last command): Command Syntax. (line 21)
26599 * retransmit-timeout, MIPS protocol: MIPS Embedded. (line 83)
26600 * return: Returning. (line 6)
26601 * returning from a function: Returning. (line 6)
26602 * reverse-search: Search. (line 16)
26603 * reverse-search-history (C-r): Commands For History.
26605 * revert-line (M-r): Miscellaneous Commands.
26607 * rewind program state: Checkpoint/Restart. (line 6)
26608 * Right: TUI Keys. (line 66)
26609 * ROM at zero address, RDI: ARM. (line 83)
26610 * run: Starting. (line 6)
26611 * run to main procedure: Starting. (line 71)
26612 * run until specified location: Continuing and Stepping.
26614 * running: Starting. (line 6)
26615 * running and debugging Sparclet programs: Sparclet Execution.
26617 * running VxWorks tasks: VxWorks Attach. (line 6)
26618 * running, on Sparclet: Sparclet. (line 28)
26619 * rwatch: Set Watchpoints. (line 41)
26620 * s (SingleKey TUI key): TUI Single Key Mode. (line 28)
26621 * s (step): Continuing and Stepping.
26623 * s packet: Packets. (line 241)
26624 * S packet: Packets. (line 247)
26625 * save command history: Command History. (line 36)
26626 * save GDB output to a file: Logging output. (line 6)
26627 * save tracepoints for future sessions: save-tracepoints. (line 6)
26628 * save-tracepoints: save-tracepoints. (line 6)
26629 * scheduler locking mode: Thread Stops. (line 89)
26630 * scope: M2 Scope. (line 6)
26631 * scripting commands: Command Files. (line 6)
26632 * sdireset: M32R/D. (line 44)
26633 * sdistatus: M32R/D. (line 47)
26634 * SDS protocol: PowerPC. (line 17)
26635 * sds, a command: PowerPC. (line 28)
26636 * search: Search. (line 9)
26637 * searching source files: Search. (line 6)
26638 * section: Files. (line 182)
26639 * section offsets, remote request: General Query Packets.
26641 * segment descriptor tables: DJGPP Native. (line 24)
26642 * select trace snapshot: tfind. (line 6)
26643 * select-frame: Frames. (line 51)
26644 * selected frame: Stack. (line 19)
26645 * selecting frame silently: Frames. (line 51)
26646 * self-insert (a, b, A, 1, !, ...): Commands For Text. (line 27)
26647 * send command to E7000 monitor: Renesas ICE. (line 24)
26648 * send command to remote monitor <1>: Connecting. (line 104)
26649 * send command to remote monitor: Remote. (line 26)
26650 * send command to simulator: Embedded Processors. (line 9)
26651 * send PMON command: MIPS Embedded. (line 132)
26652 * send rights, GNU Hurd: Hurd Native. (line 85)
26653 * separate debugging information files: Separate Debug Files.
26655 * sequence-id, for GDB remote: Overview. (line 29)
26656 * serial connections, debugging: Debugging Output. (line 86)
26657 * serial device, Renesas micros: Renesas Boards. (line 6)
26658 * serial line speed, Renesas micros: Renesas Boards. (line 11)
26659 * serial line, target remote: Connecting. (line 18)
26660 * serial port name: Remote configuration.
26662 * serial protocol, GDB remote: Overview. (line 14)
26663 * server, command prefix: Command History. (line 20)
26664 * set: Help. (line 108)
26665 * set ABI for MIPS: MIPS. (line 55)
26666 * set annotate: Annotations Overview.
26668 * set architecture: Targets. (line 21)
26669 * set args: Arguments. (line 21)
26670 * set arm: ARM. (line 18)
26671 * set auto-solib-add: Files. (line 300)
26672 * set backtrace: Backtrace. (line 98)
26673 * set board-address: M32R/D. (line 21)
26674 * set breakpoint pending: Set Breaks. (line 211)
26675 * set breakpoints in many functions: Set Breaks. (line 111)
26676 * set breakpoints on all functions: Set Breaks. (line 131)
26677 * set can-use-hw-watchpoints: Set Watchpoints. (line 68)
26678 * set case-sensitive: Symbols. (line 27)
26679 * set charset: Character Sets. (line 47)
26680 * set check range: Range Checking. (line 34)
26681 * set check type: Type Checking. (line 42)
26682 * set coerce-float-to-double: ABI. (line 41)
26683 * set com1base: DJGPP Native. (line 125)
26684 * set com1irq: DJGPP Native. (line 125)
26685 * set com2base: DJGPP Native. (line 125)
26686 * set com2irq: DJGPP Native. (line 125)
26687 * set com3base: DJGPP Native. (line 125)
26688 * set com3irq: DJGPP Native. (line 125)
26689 * set com4base: DJGPP Native. (line 125)
26690 * set com4irq: DJGPP Native. (line 125)
26691 * set complaints: Messages/Warnings. (line 29)
26692 * set confirm: Messages/Warnings. (line 50)
26693 * set cp-abi: ABI. (line 53)
26694 * set cygwin-exceptions: Cygwin Native. (line 30)
26695 * set debug: Debugging Output. (line 18)
26696 * set debug hppa: HPPA. (line 10)
26697 * set debug mips: MIPS. (line 104)
26698 * set debug monitor: Target Commands. (line 108)
26699 * set debug nto-debug: Neutrino. (line 9)
26700 * set debug-file-directory: Separate Debug Files.
26702 * set debugevents: Cygwin Native. (line 59)
26703 * set debugexceptions: Cygwin Native. (line 70)
26704 * set debugexec: Cygwin Native. (line 66)
26705 * set debugmemory: Cygwin Native. (line 74)
26706 * set demangle-style: Print Settings. (line 255)
26707 * set detach-on-fork: Processes. (line 55)
26708 * set disassembly-flavor: Machine Code. (line 68)
26709 * set download-path: M32R/D. (line 15)
26710 * set editing: Editing. (line 15)
26711 * set endian: Byte Order. (line 13)
26712 * set environment: Environment. (line 39)
26713 * set exceptions, Hurd command: Hurd Native. (line 40)
26714 * set exec-done-display: Debugging Output. (line 11)
26715 * set extension-language: Show. (line 30)
26716 * set follow-fork-mode: Processes. (line 35)
26717 * set gnutarget: Target Commands. (line 28)
26718 * set hash, for remote monitors: Target Commands. (line 99)
26719 * set height: Screen Size. (line 21)
26720 * set history expansion: Command History. (line 65)
26721 * set history filename: Command History. (line 26)
26722 * set history save: Command History. (line 36)
26723 * set history size: Command History. (line 45)
26724 * set host-charset: Character Sets. (line 34)
26725 * set inferior controlling terminal: Input/Output. (line 44)
26726 * set inferior-tty: Input/Output. (line 49)
26727 * set input-radix: Numbers. (line 14)
26728 * set language: Manually. (line 9)
26729 * set listsize: List. (line 32)
26730 * set logging: Logging output. (line 9)
26731 * set machine: Renesas Special. (line 8)
26732 * set max-user-call-depth: Define. (line 73)
26733 * set memory MOD: H8/500. (line 6)
26734 * set mips abi: MIPS. (line 55)
26735 * set mips mask-address: MIPS. (line 84)
26736 * set mips saved-gpreg-size: MIPS. (line 32)
26737 * set mips stack-arg-size: MIPS. (line 50)
26738 * set mipsfpu: MIPS Embedded. (line 60)
26739 * set monitor-prompt, MIPS remote: MIPS Embedded. (line 107)
26740 * set monitor-warnings, MIPS remote: MIPS Embedded. (line 123)
26741 * set new-console: Cygwin Native. (line 42)
26742 * set new-group: Cygwin Native. (line 51)
26743 * set opaque-type-resolution: Symbols. (line 232)
26744 * set osabi: ABI. (line 11)
26745 * set output-radix: Numbers. (line 31)
26746 * set overload-resolution: Debugging C plus plus.
26748 * set pagination: Screen Size. (line 38)
26749 * set print: Print Settings. (line 11)
26750 * set processor: Targets. (line 31)
26751 * set procfs-file: SVR4 Process Information.
26753 * set procfs-trace: SVR4 Process Information.
26755 * set prompt: Prompt. (line 16)
26756 * set radix: Numbers. (line 44)
26757 * set rdiheartbeat: ARM. (line 93)
26758 * set rdiromatzero: ARM. (line 83)
26759 * set remote: Remote configuration.
26761 * set remote system-call-allowed: system. (line 38)
26762 * set remote-mips64-transfers-32bit-regs: MIPS. (line 94)
26763 * set remoteaddhost: WinCE. (line 24)
26764 * set remotecache: Caching Remote Data. (line 13)
26765 * set remotedirectory: WinCE. (line 9)
26766 * set remoteupload: WinCE. (line 16)
26767 * set retransmit-timeout: MIPS Embedded. (line 83)
26768 * set rstack_high_address: A29K. (line 6)
26769 * set sdstimeout: PowerPC. (line 21)
26770 * set server-address: M32R/D. (line 27)
26771 * set shell: Cygwin Native. (line 78)
26772 * set signal-thread: Hurd Native. (line 21)
26773 * set signals, Hurd command: Hurd Native. (line 11)
26774 * set sigs, Hurd command: Hurd Native. (line 11)
26775 * set sigthread: Hurd Native. (line 21)
26776 * set solib-absolute-prefix: Files. (line 366)
26777 * set solib-search-path: Files. (line 380)
26778 * set step-mode: Continuing and Stepping.
26780 * set stop-on-solib-events: Files. (line 346)
26781 * set stopped, Hurd command: Hurd Native. (line 32)
26782 * set struct-convention: i386. (line 7)
26783 * set substitute-path: Source Path. (line 114)
26784 * set symbol-reloading: Symbols. (line 215)
26785 * set syn-garbage-limit, MIPS remote: MIPS Embedded. (line 98)
26786 * set target-charset: Character Sets. (line 28)
26787 * set task, Hurd commands: Hurd Native. (line 49)
26788 * set thread, Hurd command: Hurd Native. (line 91)
26789 * set timeout: MIPS Embedded. (line 83)
26790 * set trace-commands: Messages/Warnings. (line 65)
26791 * set tracepoint: Create and Delete Tracepoints.
26793 * set trust-readonly-sections: Files. (line 258)
26794 * set tui active-border-mode: TUI Configuration. (line 25)
26795 * set tui border-kind: TUI Configuration. (line 10)
26796 * set tui border-mode: TUI Configuration. (line 30)
26797 * set unwindonsignal: Calling. (line 26)
26798 * set usehardbreakpoints, E7000: Renesas ICE. (line 41)
26799 * set variable: Assignment. (line 16)
26800 * set verbose: Messages/Warnings. (line 15)
26801 * set watchdog: Maintenance Commands.
26803 * set width: Screen Size. (line 21)
26804 * set write: Patching. (line 15)
26805 * set-mark (C-@): Miscellaneous Commands.
26807 * set_debug_traps: Stub Contents. (line 10)
26808 * setting variables: Assignment. (line 6)
26809 * setting watchpoints: Set Watchpoints. (line 6)
26810 * SH: remote stub. (line 63)
26811 * sh-stub.c: remote stub. (line 63)
26812 * share: Files. (line 327)
26813 * shared libraries: Files. (line 281)
26814 * sharedlibrary: Files. (line 327)
26815 * shell: Shell Commands. (line 10)
26816 * shell escape: Shell Commands. (line 10)
26817 * show: Help. (line 113)
26818 * show all user variables: Convenience Vars. (line 37)
26819 * show annotate: Annotations Overview.
26821 * show architecture: Targets. (line 21)
26822 * show args: Arguments. (line 28)
26823 * show arm: ARM. (line 22)
26824 * show auto-solib-add: Files. (line 317)
26825 * show backtrace: Backtrace. (line 105)
26826 * show board-address: M32R/D. (line 24)
26827 * show breakpoint pending: Set Breaks. (line 211)
26828 * show can-use-hw-watchpoints: Set Watchpoints. (line 71)
26829 * show case-sensitive: Symbols. (line 40)
26830 * show charset: Character Sets. (line 53)
26831 * show check range: Range Checking. (line 34)
26832 * show check type: Type Checking. (line 42)
26833 * show coerce-float-to-double: ABI. (line 50)
26834 * show com1base: DJGPP Native. (line 137)
26835 * show com1irq: DJGPP Native. (line 137)
26836 * show com2base: DJGPP Native. (line 137)
26837 * show com2irq: DJGPP Native. (line 137)
26838 * show com3base: DJGPP Native. (line 137)
26839 * show com3irq: DJGPP Native. (line 137)
26840 * show com4base: DJGPP Native. (line 137)
26841 * show com4irq: DJGPP Native. (line 137)
26842 * show commands: Command History. (line 78)
26843 * show complaints: Messages/Warnings. (line 35)
26844 * show confirm: Messages/Warnings. (line 56)
26845 * show convenience: Convenience Vars. (line 37)
26846 * show copying: Help. (line 137)
26847 * show cp-abi: ABI. (line 53)
26848 * show cygwin-exceptions: Cygwin Native. (line 38)
26849 * show debug: Debugging Output. (line 22)
26850 * show debug mips: MIPS. (line 108)
26851 * show debug monitor: Target Commands. (line 112)
26852 * show debug nto-debug: Neutrino. (line 13)
26853 * show debug-file-directory: Separate Debug Files.
26855 * show detach-on-follow: Processes. (line 71)
26856 * show directories: Source Path. (line 111)
26857 * show disassembly-flavor: Machine Code. (line 77)
26858 * show download-path: M32R/D. (line 18)
26859 * show editing: Editing. (line 22)
26860 * show environment: Environment. (line 33)
26861 * show exceptions, Hurd command: Hurd Native. (line 46)
26862 * show exec-done-display: Debugging Output. (line 14)
26863 * show follow-fork-mode: Processes. (line 49)
26864 * show gnutarget: Target Commands. (line 40)
26865 * show hash, for remote monitors: Target Commands. (line 105)
26866 * show height: Screen Size. (line 21)
26867 * show history: Command History. (line 70)
26868 * show host-charset: Character Sets. (line 56)
26869 * show inferior-tty: Input/Output. (line 52)
26870 * show input-radix: Numbers. (line 36)
26871 * show language: Show. (line 10)
26872 * show last commands: Command History. (line 78)
26873 * show listsize: List. (line 36)
26874 * show logging: Logging output. (line 26)
26875 * show machine: Renesas Special. (line 8)
26876 * show max-user-call-depth: Define. (line 73)
26877 * show mips abi: MIPS. (line 77)
26878 * show mips mask-address: MIPS. (line 90)
26879 * show mips saved-gpreg-size: MIPS. (line 47)
26880 * show mipsfpu: MIPS Embedded. (line 60)
26881 * show monitor-prompt, MIPS remote: MIPS Embedded. (line 119)
26882 * show monitor-warnings, MIPS remote: MIPS Embedded. (line 129)
26883 * show new-console: Cygwin Native. (line 47)
26884 * show new-group: Cygwin Native. (line 56)
26885 * show opaque-type-resolution: Symbols. (line 247)
26886 * show osabi: ABI. (line 11)
26887 * show output-radix: Numbers. (line 39)
26888 * show overload-resolution: Debugging C plus plus.
26890 * show pagination: Screen Size. (line 42)
26891 * show paths: Environment. (line 29)
26892 * show print: Print Settings. (line 39)
26893 * show processor: Targets. (line 31)
26894 * show procfs-file: SVR4 Process Information.
26896 * show procfs-trace: SVR4 Process Information.
26898 * show prompt: Prompt. (line 19)
26899 * show radix: Numbers. (line 44)
26900 * show rdiheartbeat: ARM. (line 98)
26901 * show rdiromatzero: ARM. (line 90)
26902 * show remote: Remote configuration.
26904 * show remote system-call-allowed: system. (line 42)
26905 * show remote-mips64-transfers-32bit-regs: MIPS. (line 100)
26906 * show remoteaddhost: WinCE. (line 28)
26907 * show remotecache: Caching Remote Data. (line 18)
26908 * show remotedirectory: WinCE. (line 13)
26909 * show remoteupload: WinCE. (line 21)
26910 * show retransmit-timeout: MIPS Embedded. (line 83)
26911 * show rstack_high_address: A29K. (line 17)
26912 * show sdstimeout: PowerPC. (line 25)
26913 * show server-address: M32R/D. (line 31)
26914 * show shell: Cygwin Native. (line 82)
26915 * show signal-thread: Hurd Native. (line 28)
26916 * show signals, Hurd command: Hurd Native. (line 17)
26917 * show sigs, Hurd command: Hurd Native. (line 17)
26918 * show sigthread: Hurd Native. (line 28)
26919 * show solib-absolute-prefix: Files. (line 377)
26920 * show solib-search-path: Files. (line 390)
26921 * show stop-on-solib-events: Files. (line 352)
26922 * show stopped, Hurd command: Hurd Native. (line 37)
26923 * show struct-convention: i386. (line 15)
26924 * show substitute-path: Source Path. (line 151)
26925 * show symbol-reloading: Symbols. (line 229)
26926 * show syn-garbage-limit, MIPS remote: MIPS Embedded. (line 103)
26927 * show target-charset: Character Sets. (line 59)
26928 * show task, Hurd commands: Hurd Native. (line 57)
26929 * show thread, Hurd command: Hurd Native. (line 101)
26930 * show timeout: MIPS Embedded. (line 83)
26931 * show unwindonsignal: Calling. (line 33)
26932 * show usehardbreakpoints, E7000: Renesas ICE. (line 41)
26933 * show user: Define. (line 67)
26934 * show values: Value History. (line 47)
26935 * show verbose: Messages/Warnings. (line 21)
26936 * show version: Help. (line 127)
26937 * show warranty: Help. (line 141)
26938 * show width: Screen Size. (line 21)
26939 * show write: Patching. (line 26)
26940 * show-all-if-ambiguous: Readline Init File Syntax.
26942 * show-all-if-unmodified: Readline Init File Syntax.
26944 * si (stepi): Continuing and Stepping.
26946 * signal: Signaling. (line 6)
26947 * signal annotation: Annotations for Running.
26949 * signal-name annotation: Annotations for Running.
26951 * signal-name-end annotation: Annotations for Running.
26953 * signal-string annotation: Annotations for Running.
26955 * signal-string-end annotation: Annotations for Running.
26957 * signalled annotation: Annotations for Running.
26959 * signals: Signals. (line 6)
26960 * SIGQUIT signal, dump core of GDB: Maintenance Commands.
26962 * silent: Break Commands. (line 38)
26963 * sim: Z8000. (line 15)
26964 * sim, a command: Embedded Processors. (line 13)
26965 * simulator, Z8000: Z8000. (line 6)
26966 * size of remote memory accesses: Packets. (line 172)
26967 * size of screen: Screen Size. (line 6)
26968 * snapshot of a process: Checkpoint/Restart. (line 6)
26969 * software watchpoints: Set Watchpoints. (line 22)
26970 * source: Command Files. (line 14)
26971 * source annotation: Source Annotations. (line 6)
26972 * source file and line of a symbol: Print Settings. (line 51)
26973 * source line and its code address: Machine Code. (line 6)
26974 * source path: Source Path. (line 6)
26975 * Sparc: remote stub. (line 66)
26976 * sparc-stub.c: remote stub. (line 66)
26977 * sparcl-stub.c: remote stub. (line 69)
26978 * Sparclet: Sparclet. (line 6)
26979 * SparcLite: remote stub. (line 69)
26980 * Special Fortran commands: Special Fortran commands.
26982 * speed: Renesas Boards. (line 11)
26983 * spr: OpenRISC 1000. (line 33)
26984 * SSE registers (x86): Registers. (line 71)
26985 * ST2000 auxiliary commands: ST2000. (line 26)
26986 * st2000 CMD: ST2000. (line 30)
26987 * stack frame: Frames. (line 6)
26988 * stack on Alpha: MIPS. (line 6)
26989 * stack on MIPS: MIPS. (line 6)
26990 * stack pointer register: Registers. (line 26)
26991 * stacking targets: Active Targets. (line 6)
26992 * standard registers: Registers. (line 26)
26993 * start: Starting. (line 70)
26994 * start a new trace experiment: Starting and Stopping Trace Experiment.
26996 * start-kbd-macro (C-x (): Keyboard Macros. (line 6)
26997 * starting: Starting. (line 6)
26998 * starting annotation: Annotations for Running.
27000 * startup code, and backtrace: Backtrace. (line 87)
27001 * stat, file-i/o system call: stat/fstat. (line 6)
27002 * static members of C++ objects: Print Settings. (line 301)
27003 * static members of Pacal objects: Print Settings. (line 312)
27004 * status of trace data collection: Starting and Stopping Trace Experiment.
27006 * status output in GDB/MI: GDB/MI Output Syntax.
27008 * STDBUG commands (ST2000): ST2000. (line 30)
27009 * step: Continuing and Stepping.
27011 * stepi: Continuing and Stepping.
27013 * stepping: Continuing and Stepping.
27015 * stepping into functions with no line info: Continuing and Stepping.
27017 * stop a running trace experiment: Starting and Stopping Trace Experiment.
27019 * stop on C++ exceptions: Set Catchpoints. (line 13)
27020 * stop reply packets: Stop Reply Packets. (line 6)
27021 * stop, a pseudo-command: Hooks. (line 21)
27022 * stopped threads: Thread Stops. (line 31)
27023 * stopping annotation: Annotations for Running.
27025 * stream records in GDB/MI: GDB/MI Stream Records.
27027 * struct return convention: i386. (line 7)
27028 * struct stat, in file-i/o protocol: struct stat. (line 6)
27029 * struct timeval, in file-i/o protocol: struct timeval. (line 6)
27030 * struct user contents: OS Information. (line 9)
27031 * struct/union returned in registers: i386. (line 7)
27032 * stub example, remote debugging: remote stub. (line 6)
27033 * stupid questions: Messages/Warnings. (line 50)
27034 * Super-H: Super-H. (line 6)
27035 * supported packets, remote query: General Query Packets.
27037 * switching threads: Threads. (line 6)
27038 * switching threads automatically: Threads. (line 152)
27039 * symbol decoding style, C++: Print Settings. (line 255)
27040 * symbol dump: Symbols. (line 250)
27041 * symbol from address: Symbols. (line 54)
27042 * symbol lookup, remote request: General Query Packets.
27044 * symbol names: Symbols. (line 14)
27045 * symbol overloading: Breakpoint Menus. (line 6)
27046 * symbol table: Files. (line 6)
27047 * symbol tables, listing GDB's internal: Symbols. (line 269)
27048 * symbol, source file and line: Print Settings. (line 51)
27049 * symbol-file: Files. (line 45)
27050 * symbols, reading from relocatable object files: Files. (line 132)
27051 * symbols, reading immediately: Files. (line 90)
27052 * synchronize with remote MIPS target: MIPS Embedded. (line 98)
27053 * syscall DSO: Files. (line 162)
27054 * sysinfo: DJGPP Native. (line 19)
27055 * system calls and thread breakpoints: Thread Stops. (line 36)
27056 * system, file-i/o system call: system. (line 6)
27057 * t packet: Packets. (line 254)
27058 * T packet: Packets. (line 259)
27059 * T packet reply: Stop Reply Packets. (line 22)
27060 * tabset NCHARS: TUI Commands. (line 65)
27061 * target: Target Commands. (line 49)
27062 * target abug: M68K. (line 9)
27063 * target architecture: Targets. (line 17)
27064 * target array: MIPS Embedded. (line 49)
27065 * target byte order: Byte Order. (line 6)
27066 * target character set: Character Sets. (line 6)
27067 * target cpu32bug: M68K. (line 12)
27068 * target dbug: M68K. (line 15)
27069 * target ddb PORT: MIPS Embedded. (line 41)
27070 * target debugging info: Debugging Output. (line 111)
27071 * target dink32: PowerPC. (line 6)
27072 * target e7000, with H8/300: H8/300. (line 11)
27073 * target e7000, with Renesas ICE: Renesas ICE. (line 6)
27074 * target e7000, with Renesas SH: SH. (line 11)
27075 * target est: M68K. (line 18)
27076 * target hms, and serial protocol: Renesas Boards. (line 48)
27077 * target hms, with H8/300: H8/300. (line 6)
27078 * target hms, with Renesas SH: SH. (line 6)
27079 * target jtag: OpenRISC 1000. (line 9)
27080 * target lsi PORT: MIPS Embedded. (line 44)
27081 * target m32r: M32R/D. (line 6)
27082 * target m32rsdi: M32R/D. (line 9)
27083 * target mips PORT: MIPS Embedded. (line 14)
27084 * target op50n: PA. (line 6)
27085 * target output in GDB/MI: GDB/MI Output Syntax.
27087 * target pmon PORT: MIPS Embedded. (line 38)
27088 * target ppcbug: PowerPC. (line 9)
27089 * target ppcbug1: PowerPC. (line 10)
27090 * target r3900: MIPS Embedded. (line 46)
27091 * target rdi: ARM. (line 6)
27092 * target rdp: ARM. (line 11)
27093 * target remote: Connecting. (line 11)
27094 * target rom68k: M68K. (line 21)
27095 * target rombug: M68K. (line 25)
27096 * target sds: PowerPC. (line 14)
27097 * target sh3, with H8/300: H8/300. (line 14)
27098 * target sh3, with SH: SH. (line 14)
27099 * target sh3e, with H8/300: H8/300. (line 14)
27100 * target sh3e, with SH: SH. (line 14)
27101 * target sim, with Z8000: Z8000. (line 15)
27102 * target sparclite: Sparclite. (line 6)
27103 * target vxworks: VxWorks. (line 6)
27104 * target w89k: PA. (line 9)
27105 * task attributes (GNU Hurd): Hurd Native. (line 49)
27106 * task exception port, GNU Hurd: Hurd Native. (line 68)
27107 * task suspend count: Hurd Native. (line 60)
27108 * tbreak: Set Breaks. (line 74)
27109 * TCP port, target remote: Connecting. (line 29)
27110 * tdump: tdump. (line 6)
27111 * terminal: Input/Output. (line 6)
27112 * Text User Interface: TUI. (line 6)
27113 * tfind: tfind. (line 6)
27114 * thbreak: Set Breaks. (line 101)
27115 * this, inside C++ member functions: C plus plus expressions.
27117 * thread apply: Threads. (line 143)
27118 * thread attributes info, remote request: General Query Packets.
27120 * thread breakpoints: Thread Stops. (line 10)
27121 * thread breakpoints and system calls: Thread Stops. (line 36)
27122 * thread default settings, GNU Hurd: Hurd Native. (line 131)
27123 * thread identifier (GDB): Threads. (line 56)
27124 * thread identifier (GDB), on HP-UX: Threads. (line 82)
27125 * thread identifier (system): Threads. (line 44)
27126 * thread identifier (system), on HP-UX: Threads. (line 86)
27127 * thread info (Solaris): Threads. (line 126)
27128 * thread information, remote request: General Query Packets.
27130 * thread number: Threads. (line 56)
27131 * thread properties, GNU Hurd: Hurd Native. (line 91)
27132 * thread suspend count, GNU Hurd: Hurd Native. (line 110)
27133 * thread THREADNO: Threads. (line 128)
27134 * threads and watchpoints: Set Watchpoints. (line 143)
27135 * threads of execution: Threads. (line 6)
27136 * threads, automatic switching: Threads. (line 152)
27137 * threads, continuing: Thread Stops. (line 69)
27138 * threads, stopped: Thread Stops. (line 31)
27139 * time of command execution: Maintenance Commands.
27141 * timeout for commands: Maintenance Commands.
27143 * timeout for serial communications: Remote configuration.
27145 * timeout, MIPS protocol: MIPS Embedded. (line 83)
27146 * tload, M32R: M32R/D. (line 39)
27147 * trace: Create and Delete Tracepoints.
27149 * trace experiment, status of: Starting and Stopping Trace Experiment.
27151 * traceback: Backtrace. (line 6)
27152 * tracepoint actions: Tracepoint Actions. (line 6)
27153 * tracepoint data, display: tdump. (line 6)
27154 * tracepoint deletion: Create and Delete Tracepoints.
27156 * tracepoint number: Create and Delete Tracepoints.
27158 * tracepoint packets: Tracepoint Packets. (line 6)
27159 * tracepoint pass count: Tracepoint Passcounts.
27161 * tracepoint variables: Tracepoint Variables.
27163 * tracepoints: Tracepoints. (line 6)
27164 * trailing underscore, in Fortran symbols: Fortran. (line 9)
27165 * translating between character sets: Character Sets. (line 6)
27166 * transpose-chars (C-t): Commands For Text. (line 30)
27167 * transpose-words (M-t): Commands For Text. (line 36)
27168 * tstart: Starting and Stopping Trace Experiment.
27170 * tstatus: Starting and Stopping Trace Experiment.
27172 * tstop: Starting and Stopping Trace Experiment.
27174 * tty: Input/Output. (line 23)
27175 * TUI: TUI. (line 6)
27176 * TUI commands: TUI Commands. (line 6)
27177 * TUI configuration variables: TUI Configuration. (line 6)
27178 * TUI key bindings: TUI Keys. (line 6)
27179 * tui reg: TUI Commands. (line 42)
27180 * TUI single key mode: TUI Single Key Mode. (line 6)
27181 * type casting memory: Expressions. (line 42)
27182 * type chain of a data type: Maintenance Commands.
27184 * type checking: Checks. (line 31)
27185 * type conversions in C++: C plus plus expressions.
27187 * u (SingleKey TUI key): TUI Single Key Mode. (line 31)
27188 * u (until): Continuing and Stepping.
27190 * UDP port, target remote: Connecting. (line 49)
27191 * undisplay: Auto Display. (line 46)
27192 * undo (C-_ or C-x C-u): Miscellaneous Commands.
27194 * unions in structures, printing: Print Settings. (line 195)
27195 * universal-argument (): Numeric Arguments. (line 10)
27196 * unix-filename-rubout (): Commands For Killing.
27198 * unix-line-discard (C-u): Commands For Killing.
27200 * unix-word-rubout (C-w): Commands For Killing.
27202 * unknown address, locating: Output Formats. (line 35)
27203 * unlink, file-i/o system call: unlink. (line 6)
27204 * unlinked object files: Files. (line 26)
27205 * unload symbols from shared libraries: Files. (line 336)
27206 * unmap an overlay: Overlay Commands. (line 39)
27207 * unmapped overlays: How Overlays Work. (line 6)
27208 * unset environment: Environment. (line 55)
27209 * unset substitute-path: Source Path. (line 143)
27210 * unsupported languages: Unsupported languages.
27212 * until: Continuing and Stepping.
27214 * unwind stack in called functions: Calling. (line 26)
27215 * Up: TUI Keys. (line 57)
27216 * up: Selection. (line 35)
27217 * up-silently: Selection. (line 64)
27218 * upcase-word (M-u): Commands For Text. (line 41)
27219 * update: TUI Commands. (line 57)
27220 * upload, M32R: M32R/D. (line 34)
27221 * use only software watchpoints: Set Watchpoints. (line 60)
27222 * use_dbt_break: M32R/D. (line 64)
27223 * use_debug_dma: M32R/D. (line 53)
27224 * use_ib_break: M32R/D. (line 61)
27225 * use_mon_code: M32R/D. (line 57)
27226 * user-defined command: Define. (line 6)
27227 * user-defined macros: Macros. (line 54)
27228 * user-defined variables: Convenience Vars. (line 6)
27229 * v (SingleKey TUI key): TUI Single Key Mode. (line 34)
27230 * value history: Value History. (line 6)
27231 * value optimized out, in backtrace: Backtrace. (line 65)
27232 * variable name conflict: Variables. (line 36)
27233 * variable object debugging info: Debugging Output. (line 122)
27234 * variable objects in GDB/MI: GDB/MI Variable Objects.
27236 * variable values, wrong: Variables. (line 58)
27237 * variables, readline: Readline Init File Syntax.
27239 * variables, setting: Assignment. (line 16)
27240 * vCont packet: Packets. (line 273)
27241 * vCont? packet: Packets. (line 299)
27242 * vector unit: Vector Unit. (line 6)
27243 * vector, auxiliary: OS Information. (line 21)
27244 * verbose operation: Messages/Warnings. (line 6)
27245 * verify remote memory image: Memory. (line 101)
27246 * vFlashDone packet: Packets. (line 349)
27247 * vFlashErase packet: Packets. (line 310)
27248 * vFlashWrite packet: Packets. (line 327)
27249 * virtual functions (C++) display: Print Settings. (line 323)
27250 * visible-stats: Readline Init File Syntax.
27252 * VTBL display: Print Settings. (line 323)
27253 * VxWorks: VxWorks. (line 6)
27254 * vxworks-timeout: VxWorks. (line 23)
27255 * w (SingleKey TUI key): TUI Single Key Mode. (line 37)
27256 * watch: Set Watchpoints. (line 33)
27257 * watchdog timer: Maintenance Commands.
27259 * watchpoint annotation: Annotations for Running.
27261 * watchpoints: Breakpoints. (line 20)
27262 * watchpoints and threads: Set Watchpoints. (line 143)
27263 * weak alias functions: Calling. (line 36)
27264 * whatis: Symbols. (line 66)
27265 * where: Backtrace. (line 34)
27266 * where to look for shared libraries: Files. (line 361)
27267 * while: Command Files. (line 67)
27268 * while-stepping (tracepoints): Tracepoint Actions. (line 67)
27269 * wild pointer, interpreting: Print Settings. (line 79)
27270 * Windows CE: WinCE. (line 6)
27271 * winheight: TUI Commands. (line 61)
27272 * word completion: Completion. (line 6)
27273 * working directory: Source Path. (line 99)
27274 * working directory (of your program): Working Directory. (line 6)
27275 * working language: Languages. (line 13)
27276 * write data into object, remote request: General Query Packets.
27278 * write, file-i/o system call: write. (line 6)
27279 * writing into corefiles: Patching. (line 6)
27280 * writing into executables: Patching. (line 6)
27281 * wrong values: Variables. (line 58)
27282 * x (examine memory): Memory. (line 9)
27283 * x command, default address: Machine Code. (line 30)
27284 * X packet: Packets. (line 357)
27285 * x(examine), and info line: Machine Code. (line 30)
27286 * x86 hardware debug registers: Maintenance Commands.
27288 * yank (C-y): Commands For Killing.
27290 * yank-last-arg (M-. or M-_): Commands For History.
27292 * yank-nth-arg (M-C-y): Commands For History.
27294 * yank-pop (M-y): Commands For Killing.
27296 * yanking text: Readline Killing Commands.
27298 * z packet: Packets. (line 370)
27299 * Z packets: Packets. (line 370)
27300 * Z0 packet: Packets. (line 385)
27301 * z0 packet: Packets. (line 385)
27302 * Z1 packet: Packets. (line 411)
27303 * z1 packet: Packets. (line 411)
27304 * z2 packet: Packets. (line 432)
27305 * Z2 packet: Packets. (line 432)
27306 * Z3 packet: Packets. (line 446)
27307 * z3 packet: Packets. (line 446)
27308 * z4 packet: Packets. (line 460)
27309 * Z4 packet: Packets. (line 460)
27310 * Z8000: Z8000. (line 6)
27311 * Zilog Z8000 simulator: Z8000. (line 6)
27312 * {TYPE}: Expressions. (line 42)
27318 Node: Summary
\7f3605
27319 Node: Free Software
\7f5241
27320 Node: Contributors
\7f10809
27321 Node: Sample Session
\7f18793
27322 Node: Invocation
\7f25629
27323 Node: Invoking GDB
\7f26173
27324 Node: File Options
\7f28486
27325 Node: Mode Options
\7f31246
27326 Node: Startup
\7f37658
27327 Ref: Startup-Footnote-1
\7f40113
27328 Node: Quitting GDB
\7f40222
27329 Node: Shell Commands
\7f41119
27330 Node: Logging output
\7f41961
27331 Node: Commands
\7f42807
27332 Node: Command Syntax
\7f43445
27333 Node: Completion
\7f45611
27335 Node: Running
\7f55176
27336 Node: Compilation
\7f56358
27337 Node: Starting
\7f58997
27338 Node: Arguments
\7f63886
27339 Node: Environment
\7f65156
27340 Node: Working Directory
\7f68424
27341 Node: Input/Output
\7f69532
27342 Node: Attach
\7f71503
27343 Node: Kill Process
\7f73939
27344 Node: Threads
\7f74905
27345 Node: Processes
\7f81049
27346 Node: Checkpoint/Restart
\7f86100
27347 Ref: Checkpoint/Restart-Footnote-1
\7f90633
27348 Node: Stopping
\7f90668
27349 Node: Breakpoints
\7f91815
27350 Node: Set Breaks
\7f95233
27351 Node: Set Watchpoints
\7f106952
27352 Node: Set Catchpoints
\7f114790
27353 Node: Delete Breaks
\7f118268
27354 Node: Disabling
\7f119985
27355 Node: Conditions
\7f122752
27356 Node: Break Commands
\7f127700
27357 Node: Breakpoint Menus
\7f130585
27358 Node: Error in Breakpoints
\7f132317
27359 Node: Breakpoint related warnings
\7f133895
27360 Node: Continuing and Stepping
\7f136222
27361 Node: Signals
\7f145562
27362 Node: Thread Stops
\7f149834
27363 Node: Stack
\7f154439
27364 Node: Frames
\7f155914
27365 Node: Backtrace
\7f158666
27366 Ref: Backtrace-Footnote-1
\7f163556
27367 Node: Selection
\7f163744
27368 Node: Frame Info
\7f166608
27369 Node: Source
\7f168939
27370 Node: List
\7f169943
27371 Node: Edit
\7f173472
27372 Ref: Edit-Footnote-1
\7f175203
27373 Node: Search
\7f175438
27374 Node: Source Path
\7f176246
27375 Ref: set substitute-path
\7f182000
27376 Node: Machine Code
\7f184221
27377 Node: Data
\7f187631
27378 Node: Expressions
\7f190012
27379 Node: Variables
\7f191980
27380 Node: Arrays
\7f195966
27381 Node: Output Formats
\7f198495
27382 Ref: Output Formats-Footnote-1
\7f200717
27383 Node: Memory
\7f200874
27384 Node: Auto Display
\7f205910
27385 Node: Print Settings
\7f209682
27386 Node: Value History
\7f221468
27387 Node: Convenience Vars
\7f223884
27388 Node: Registers
\7f227408
27389 Ref: Registers-Footnote-1
\7f232083
27390 Node: Floating Point Hardware
\7f232478
27391 Node: Vector Unit
\7f233008
27392 Node: OS Information
\7f233393
27393 Node: Memory Region Attributes
\7f235391
27394 Node: Dump/Restore Files
\7f239207
27395 Node: Core File Generation
\7f241510
27396 Node: Character Sets
\7f242742
27397 Node: Caching Remote Data
\7f249574
27398 Node: Macros
\7f250712
27399 Node: Tracepoints
\7f257663
27400 Node: Set Tracepoints
\7f259505
27401 Node: Create and Delete Tracepoints
\7f260704
27402 Node: Enable and Disable Tracepoints
\7f262348
27403 Node: Tracepoint Passcounts
\7f263047
27404 Node: Tracepoint Actions
\7f264471
27405 Node: Listing Tracepoints
\7f267471
27406 Node: Starting and Stopping Trace Experiment
\7f268592
27407 Node: Analyze Collected Data
\7f269770
27408 Node: tfind
\7f271075
27409 Node: tdump
\7f275468
27410 Node: save-tracepoints
\7f277127
27411 Node: Tracepoint Variables
\7f277546
27412 Node: Overlays
\7f278561
27413 Node: How Overlays Work
\7f279281
27414 Ref: A code overlay
\7f281841
27415 Node: Overlay Commands
\7f285279
27416 Node: Automatic Overlay Debugging
\7f289469
27417 Node: Overlay Sample Program
\7f291610
27418 Node: Languages
\7f293370
27419 Node: Setting
\7f294533
27420 Node: Filenames
\7f296235
27421 Node: Manually
\7f297021
27422 Node: Automatically
\7f298230
27423 Node: Show
\7f299291
27424 Node: Checks
\7f300613
27425 Node: Type Checking
\7f302003
27426 Node: Range Checking
\7f304736
27427 Node: Supported languages
\7f307137
27429 Node: C Operators
\7f309541
27430 Node: C Constants
\7f313922
27431 Node: C plus plus expressions
\7f316409
27432 Node: C Defaults
\7f319952
27433 Node: C Checks
\7f320635
27434 Node: Debugging C
\7f321358
27435 Node: Debugging C plus plus
\7f321878
27436 Node: Objective-C
\7f324964
27437 Node: Method Names in Commands
\7f325425
27438 Node: The Print Command with Objective-C
\7f327140
27439 Node: Fortran
\7f327791
27440 Node: Fortran Operators
\7f328516
27441 Node: Fortran Defaults
\7f329106
27442 Node: Special Fortran commands
\7f329491
27443 Node: Pascal
\7f329991
27444 Node: Modula-2
\7f330506
27445 Node: M2 Operators
\7f331481
27446 Node: Built-In Func/Proc
\7f334479
27447 Node: M2 Constants
\7f337257
27448 Node: M2 Types
\7f338858
27449 Node: M2 Defaults
\7f342131
27450 Node: Deviations
\7f342736
27451 Node: M2 Checks
\7f343837
27452 Node: M2 Scope
\7f344655
27453 Node: GDB/M2
\7f345679
27455 Node: Ada Mode Intro
\7f347390
27456 Node: Omissions from Ada
\7f349262
27457 Node: Additions to Ada
\7f353223
27458 Node: Stopping Before Main Program
\7f357121
27459 Node: Ada Glitches
\7f357653
27460 Node: Unsupported languages
\7f359631
27461 Node: Symbols
\7f360321
27462 Node: Altering
\7f373682
27463 Node: Assignment
\7f374651
27464 Node: Jumping
\7f377756
27465 Node: Signaling
\7f379913
27466 Node: Returning
\7f381044
27467 Node: Calling
\7f382246
27468 Node: Patching
\7f384139
27469 Node: GDB Files
\7f385216
27470 Node: Files
\7f385757
27471 Node: Separate Debug Files
\7f403498
27472 Node: Symbol Errors
\7f411840
27473 Node: Targets
\7f415443
27474 Node: Active Targets
\7f416972
27475 Node: Target Commands
\7f418551
27476 Node: Byte Order
\7f423791
27477 Node: Remote
\7f424783
27478 Node: Remote Debugging
\7f425893
27479 Node: Connecting
\7f426283
27480 Node: Server
\7f431151
27481 Ref: Server-Footnote-1
\7f435514
27482 Node: Remote configuration
\7f435634
27483 Ref: set remotebreak
\7f436658
27484 Ref: set remote hardware-watchpoint-limit
\7f438383
27485 Ref: set remote hardware-breakpoint-limit
\7f438383
27486 Node: remote stub
\7f440297
27487 Node: Stub Contents
\7f443194
27488 Node: Bootstrapping
\7f445305
27489 Node: Debug Session
\7f449114
27490 Node: Configurations
\7f450674
27491 Node: Native
\7f451443
27492 Node: HP-UX
\7f452037
27493 Node: BSD libkvm Interface
\7f452326
27494 Node: SVR4 Process Information
\7f453397
27495 Node: DJGPP Native
\7f456827
27496 Node: Cygwin Native
\7f463407
27497 Node: Non-debug DLL symbols
\7f466805
27498 Node: Hurd Native
\7f471355
27499 Node: Neutrino
\7f476618
27500 Node: Embedded OS
\7f476993
27501 Node: VxWorks
\7f477469
27502 Node: VxWorks Connection
\7f479686
27503 Node: VxWorks Download
\7f480620
27504 Node: VxWorks Attach
\7f482355
27505 Node: Embedded Processors
\7f482753
27507 Node: H8/300
\7f487084
27508 Node: Renesas Boards
\7f488583
27509 Node: Renesas ICE
\7f493007
27510 Node: Renesas Special
\7f494734
27511 Node: H8/500
\7f495184
27512 Node: M32R/D
\7f495559
27513 Node: M68K
\7f497264
27514 Node: MIPS Embedded
\7f497898
27515 Node: OpenRISC 1000
\7f502843
27516 Node: PowerPC
\7f505697
27519 Node: Sparclet
\7f507102
27520 Node: Sparclet File
\7f508574
27521 Node: Sparclet Connection
\7f509456
27522 Node: Sparclet Download
\7f509936
27523 Node: Sparclet Execution
\7f510987
27524 Node: Sparclite
\7f511580
27525 Node: ST2000
\7f511956
27526 Node: Z8000
\7f513501
27528 Node: CRIS
\7f515245
27529 Node: Super-H
\7f516223
27530 Node: WinCE
\7f516479
27531 Node: Architectures
\7f517387
27532 Node: i386
\7f517735
27533 Node: A29K
\7f518419
27534 Node: Alpha
\7f519258
27535 Node: MIPS
\7f519391
27536 Node: HPPA
\7f522703
27537 Node: Controlling GDB
\7f523209
27538 Node: Prompt
\7f523970
27539 Node: Editing
\7f524749
27540 Node: Command History
\7f525692
27541 Node: Screen Size
\7f529072
27542 Node: Numbers
\7f530777
27544 Node: Messages/Warnings
\7f535683
27545 Node: Debugging Output
\7f538176
27546 Node: Sequences
\7f542383
27547 Node: Define
\7f542985
27548 Node: Hooks
\7f546336
27549 Node: Command Files
\7f548526
27550 Node: Output
\7f552379
27551 Node: Interpreters
\7f554793
27553 Node: TUI Overview
\7f557578
27554 Node: TUI Keys
\7f560663
27555 Node: TUI Single Key Mode
\7f563164
27556 Node: TUI Commands
\7f564007
27557 Node: TUI Configuration
\7f565944
27558 Node: Emacs
\7f567422
27559 Node: GDB/MI
\7f572530
27560 Node: GDB/MI Command Syntax
\7f574321
27561 Node: GDB/MI Input Syntax
\7f574534
27562 Node: GDB/MI Output Syntax
\7f576088
27563 Node: GDB/MI Compatibility with CLI
\7f579506
27564 Node: GDB/MI Development and Front Ends
\7f580243
27565 Node: GDB/MI Output Records
\7f582045
27566 Node: GDB/MI Result Records
\7f582327
27567 Node: GDB/MI Stream Records
\7f583054
27568 Node: GDB/MI Out-of-band Records
\7f584325
27569 Node: GDB/MI Simple Examples
\7f585762
27570 Node: GDB/MI Command Description Format
\7f587575
27571 Node: GDB/MI Breakpoint Commands
\7f588455
27572 Node: GDB/MI Program Context
\7f604824
27573 Node: GDB/MI Thread Commands
\7f609306
27574 Node: GDB/MI Program Execution
\7f611382
27575 Node: GDB/MI Stack Manipulation
\7f619991
27576 Node: GDB/MI Variable Objects
\7f629625
27577 Ref: -var-list-children
\7f635389
27578 Node: GDB/MI Data Manipulation
\7f638622
27579 Node: GDB/MI Tracepoint Commands
\7f652988
27580 Node: GDB/MI Symbol Query
\7f653232
27581 Node: GDB/MI File Commands
\7f656520
27582 Node: GDB/MI Target Manipulation
\7f660626
27583 Node: GDB/MI Miscellaneous Commands
\7f667805
27584 Ref: -interpreter-exec
\7f669937
27585 Node: Annotations
\7f671159
27586 Node: Annotations Overview
\7f671999
27587 Node: Prompting
\7f674457
27588 Node: Errors
\7f675981
27589 Node: Invalidation
\7f676877
27590 Node: Annotations for Running
\7f677354
27591 Node: Source Annotations
\7f678874
27592 Node: GDB Bugs
\7f679799
27593 Node: Bug Criteria
\7f680525
27594 Node: Bug Reporting
\7f681402
27595 Node: Command Line Editing
\7f689024
27596 Node: Introduction and Notation
\7f689692
27597 Node: Readline Interaction
\7f691312
27598 Node: Readline Bare Essentials
\7f692501
27599 Node: Readline Movement Commands
\7f694288
27600 Node: Readline Killing Commands
\7f695251
27601 Node: Readline Arguments
\7f697169
27602 Node: Searching
\7f698211
27603 Node: Readline Init File
\7f700360
27604 Node: Readline Init File Syntax
\7f701423
27605 Node: Conditional Init Constructs
\7f713355
27606 Node: Sample Init File
\7f715886
27607 Node: Bindable Readline Commands
\7f719001
27608 Node: Commands For Moving
\7f720056
27609 Node: Commands For History
\7f720915
27610 Node: Commands For Text
\7f724037
27611 Node: Commands For Killing
\7f726761
27612 Node: Numeric Arguments
\7f728901
27613 Node: Commands For Completion
\7f730038
27614 Node: Keyboard Macros
\7f731580
27615 Node: Miscellaneous Commands
\7f732149
27616 Node: Readline vi Mode
\7f735508
27617 Node: Using History Interactively
\7f736425
27618 Node: History Interaction
\7f736930
27619 Node: Event Designators
\7f738352
27620 Node: Word Designators
\7f739285
27621 Node: Modifiers
\7f740922
27622 Node: Formatting Documentation
\7f742147
27623 Ref: Formatting Documentation-Footnote-1
\7f745467
27624 Node: Installing GDB
\7f745531
27625 Node: Requirements
\7f746043
27626 Node: Running Configure
\7f747124
27627 Node: Separate Objdir
\7f750663
27628 Node: Config Names
\7f753547
27629 Node: Configure Options
\7f754992
27630 Node: Maintenance Commands
\7f757329
27631 Ref: maint info breakpoints
\7f757988
27632 Node: Remote Protocol
\7f767496
27633 Node: Overview
\7f767903
27634 Ref: Binary Data
\7f770089
27635 Node: Packets
\7f771895
27636 Ref: read registers packet
\7f775501
27637 Ref: cycle step packet
\7f776654
27638 Ref: write register packet
\7f778530
27639 Ref: step with signal packet
\7f779408
27640 Ref: X packet
\7f783079
27641 Ref: insert breakpoint or watchpoint packet
\7f783369
27642 Node: Stop Reply Packets
\7f785815
27643 Node: General Query Packets
\7f788874
27644 Ref: qSupported
\7f795860
27645 Ref: qXfer read
\7f803364
27646 Ref: qXfer auxiliary vector read
\7f803862
27647 Ref: qXfer memory map read
\7f804207
27648 Ref: General Query Packets-Footnote-1
\7f807009
27649 Node: Register Packet Format
\7f807336
27650 Node: Tracepoint Packets
\7f808254
27651 Node: Interrupts
\7f814343
27652 Node: Examples
\7f815806
27653 Node: File-I/O remote protocol extension
\7f816419
27654 Node: File-I/O Overview
\7f816877
27655 Node: Protocol basics
\7f819024
27656 Node: The F request packet
\7f821254
27657 Node: The F reply packet
\7f822153
27658 Node: The Ctrl-C message
\7f823069
27659 Node: Console I/O
\7f824696
27660 Node: List of supported calls
\7f825912
27661 Node: open
\7f826272
27662 Node: close
\7f828766
27663 Node: read
\7f829148
27664 Node: write
\7f829755
27665 Node: lseek
\7f830522
27666 Node: rename
\7f831400
27667 Node: unlink
\7f832796
27668 Node: stat/fstat
\7f833735
27669 Node: gettimeofday
\7f834622
27670 Node: isatty
\7f835057
27671 Node: system
\7f835653
27672 Node: Protocol specific representation of datatypes
\7f837195
27673 Node: Integral datatypes
\7f837570
27674 Node: Pointer values
\7f838377
27675 Node: Memory transfer
\7f839085
27676 Node: struct stat
\7f839705
27677 Node: struct timeval
\7f841907
27678 Node: Constants
\7f842424
27679 Node: Open flags
\7f842871
27680 Node: mode_t values
\7f843212
27681 Node: Errno values
\7f843704
27682 Node: Lseek flags
\7f844515
27683 Node: Limits
\7f844700
27684 Node: File-I/O Examples
\7f845060
27685 Node: Memory map format
\7f846174
27686 Node: Agent Expressions
\7f848629
27687 Node: General Bytecode Design
\7f851550
27688 Node: Bytecode Descriptions
\7f856350
27689 Node: Using Agent Expressions
\7f867036
27690 Node: Varying Target Capabilities
\7f868569
27691 Node: Tracing on Symmetrix
\7f869742
27692 Node: Rationale
\7f875564
27693 Node: Copying
\7f882943
27694 Node: GNU Free Documentation License
\7f902159
27695 Node: Index
\7f924594