home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2GNU / GDB416B.ZIP / info / gdb.inf
Encoding:
GNU Info File  |  1996-09-11  |  400.5 KB  |  10,085 lines

  1. This is Info file ./gdb.info, produced by Makeinfo-1.63 from the input
  2. file gdb.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                     The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.12, January 1994, of `Debugging with GDB: the GNU
  10. Source-Level Debugger' for GDB Version 4.16.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free
  13. Software Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the entire resulting derived work is distributed under the terms
  22. of a permission notice identical to this one.
  23.  
  24.    Permission is granted to copy and distribute translations of this
  25. manual into another language, under the above conditions for modified
  26. versions.
  27.  
  28. 
  29. File: gdb,  Node: Top,  Next: Summary,  Up: (dir)
  30.  
  31. Debugging with GDB
  32. ******************
  33.  
  34.    This file describes GDB, the GNU symbolic debugger.
  35.  
  36.    This is Edition 4.12, January 1994, for GDB Version 4.16.
  37.  
  38. * Menu:
  39.  
  40. * Summary::                     Summary of GDB
  41.  
  42. * Sample Session::              A sample GDB session
  43.  
  44. * Invocation::                  Getting in and out of GDB
  45. * Commands::                    GDB commands
  46. * Running::                     Running programs under GDB
  47. * Stopping::                    Stopping and continuing
  48. * Stack::                       Examining the stack
  49. * Source::                      Examining source files
  50. * Data::                        Examining data
  51.  
  52. * Languages::                   Using GDB with different languages
  53.  
  54. * Symbols::                     Examining the symbol table
  55. * Altering::                    Altering execution
  56. * GDB Files::                   GDB files
  57. * Targets::                     Specifying a debugging target
  58. * Controlling GDB::             Controlling GDB
  59. * Sequences::                   Canned sequences of commands
  60.  
  61. * Emacs::                       Using GDB under GNU Emacs
  62.  
  63. * GDB Bugs::                    Reporting bugs in GDB
  64. * Command Line Editing::        Facilities of the readline library
  65. * Using History Interactively::
  66.  
  67. * Formatting Documentation::    How to format and print GDB documentation
  68. * Installing GDB::              Installing GDB
  69.  
  70. * Index::                       Index
  71.  
  72. 
  73. File: gdb,  Node: Summary,  Next: Sample Session,  Prev: Top,  Up: Top
  74.  
  75. Summary of GDB
  76. **************
  77.  
  78.    The purpose of a debugger such as GDB is to allow you to see what is
  79. going on "inside" another program while it executes--or what another
  80. program was doing at the moment it crashed.
  81.  
  82.    GDB can do four main kinds of things (plus other things in support of
  83. these) to help you catch bugs in the act:
  84.  
  85.    * Start your program, specifying anything that might affect its
  86.      behavior.
  87.  
  88.    * Make your program stop on specified conditions.
  89.  
  90.    * Examine what has happened, when your program has stopped.
  91.  
  92.    * Change things in your program, so you can experiment with
  93.      correcting the effects of one bug and go on to learn about another.
  94.  
  95.    You can use GDB to debug programs written in C or C++.  For more
  96. information, see *Note C and C++: C.
  97.  
  98.    Support for Modula-2 and Chill is partial.  For information on
  99. Modula-2, see *Note Modula-2: Modula-2.  There is no further
  100. documentation on Chill yet.
  101.  
  102.    Debugging Pascal programs which use sets, subranges, file variables,
  103. or nested functions does not currently work.  GDB does not support
  104. entering expressions, printing values, or similar features using Pascal
  105. syntax.
  106.  
  107.    GDB can be used to debug programs written in Fortran, although it
  108. does not yet support entering expressions, printing values, or similar
  109. features using Fortran syntax.  It may be necessary to refer to some
  110. variables with a trailing underscore.
  111.  
  112. * Menu:
  113.  
  114. * Free Software::               Freely redistributable software
  115. * Contributors::                Contributors to GDB
  116.  
  117. 
  118. File: gdb,  Node: Free Software,  Next: Contributors,  Up: Summary
  119.  
  120. Free software
  121. =============
  122.  
  123.    GDB is "free software", protected by the GNU General Public License
  124. (GPL).  The GPL gives you the freedom to copy or adapt a licensed
  125. program--but every person getting a copy also gets with it the freedom
  126. to modify that copy (which means that they must get access to the
  127. source code), and the freedom to distribute further copies.  Typical
  128. software companies use copyrights to limit your freedoms; the Free
  129. Software Foundation uses the GPL to preserve these freedoms.
  130.  
  131.    Fundamentally, the General Public License is a license which says
  132. that you have these freedoms and that you cannot take these freedoms
  133. away from anyone else.
  134.  
  135. 
  136. File: gdb,  Node: Contributors,  Prev: Free Software,  Up: Summary
  137.  
  138. Contributors to GDB
  139. ===================
  140.  
  141.    Richard Stallman was the original author of GDB, and of many other
  142. GNU programs.  Many others have contributed to its development.  This
  143. section attempts to credit major contributors.  One of the virtues of
  144. free software is that everyone is free to contribute to it; with
  145. regret, we cannot actually acknowledge everyone here.  The file
  146. `ChangeLog' in the GDB distribution approximates a blow-by-blow account.
  147.  
  148.    Changes much prior to version 2.0 are lost in the mists of time.
  149.  
  150.      *Plea:* Additions to this section are particularly welcome.  If you
  151.      or your friends (or enemies, to be evenhanded) have been unfairly
  152.      omitted from this list, we would like to add your names!
  153.  
  154.    So that they may not regard their long labor as thankless, we
  155. particularly thank those who shepherded GDB through major releases:
  156. Stan Shebs (release 4.14), Fred Fish (releases 4.13, 4.12, 4.11, 4.10,
  157. and 4.9), Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5,
  158. and 4.4), John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim
  159. Kingdon (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2,
  160. 3.1, and 3.0).  As major maintainer of GDB for some period, each
  161. contributed significantly to the structure, stability, and capabilities
  162. of the entire debugger.
  163.  
  164.    Richard Stallman, assisted at various times by Peter TerMaat, Chris
  165. Hanson, and Richard Mlynarik, handled releases through 2.8.
  166.  
  167.    Michael Tiemann is the author of most of the GNU C++ support in GDB,
  168. with significant additional contributions from Per Bothner.  James
  169. Clark wrote the GNU C++ demangler.  Early work on C++ was by Peter
  170. TerMaat (who also did much general update work leading to release 3.0).
  171.  
  172.    GDB 4 uses the BFD subroutine library to examine multiple
  173. object-file formats; BFD was a joint project of David V.
  174. Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore.
  175.  
  176.    David Johnson wrote the original COFF support; Pace Willison did the
  177. original support for encapsulated COFF.
  178.  
  179.    Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
  180. Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
  181. support.  Jean-Daniel Fekete contributed Sun 386i support.  Chris
  182. Hanson improved the HP9000 support.  Noboyuki Hikichi and Tomoyuki
  183. Hasei contributed Sony/News OS 3 support.  David Johnson contributed
  184. Encore Umax support.  Jyrki Kuoppala contributed Altos 3068 support.
  185. Jeff Law contributed HP PA and SOM support.  Keith Packard contributed
  186. NS32K support.  Doug Rabson contributed Acorn Risc Machine support.
  187. Bob Rusk contributed Harris Nighthawk CX-UX support.  Chris Smith
  188. contributed Convex support (and Fortran debugging).  Jonathan Stone
  189. contributed Pyramid support.  Michael Tiemann contributed SPARC support.
  190. Tim Tucker contributed support for the Gould NP1 and Gould Powernode.
  191. Pace Willison contributed Intel 386 support.  Jay Vosburgh contributed
  192. Symmetry support.
  193.  
  194.    Rich Schaefer and Peter Schauer helped with support of SunOS shared
  195. libraries.
  196.  
  197.    Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about
  198. several machine instruction sets.
  199.  
  200.    Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped
  201. develop remote debugging.  Intel Corporation and Wind River Systems
  202. contributed remote debugging modules for their products.
  203.  
  204.    Brian Fox is the author of the readline libraries providing
  205. command-line editing and command history.
  206.  
  207.    Andrew Beers of SUNY Buffalo wrote the language-switching code, the
  208. Modula-2 support, and contributed the Languages chapter of this manual.
  209.  
  210.    Fred Fish wrote most of the support for Unix System Vr4.  He also
  211. enhanced the command-completion support to cover C++ overloaded symbols.
  212.  
  213.    Hitachi America, Ltd. sponsored the support for Hitachi
  214. microprocessors.
  215.  
  216.    Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware
  217. watchpoints.
  218.  
  219.    Stu Grossman wrote gdbserver.
  220.  
  221.    Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly
  222. innumerable bug fixes and cleanups throughout GDB.
  223.  
  224. 
  225. File: gdb,  Node: Sample Session,  Next: Invocation,  Prev: Summary,  Up: Top
  226.  
  227. A Sample GDB Session
  228. ********************
  229.  
  230.    You can use this manual at your leisure to read all about GDB.
  231. However, a handful of commands are enough to get started using the
  232. debugger.  This chapter illustrates those commands.
  233.  
  234.    One of the preliminary versions of GNU `m4' (a generic macro
  235. processor) exhibits the following bug: sometimes, when we change its
  236. quote strings from the default, the commands used to capture one macro
  237. definition within another stop working.  In the following short `m4'
  238. session, we define a macro `foo' which expands to `0000'; we then use
  239. the `m4' built-in `defn' to define `bar' as the same thing.  However,
  240. when we change the open quote string to `<QUOTE>' and the close quote
  241. string to `<UNQUOTE>', the same procedure fails to define a new synonym
  242. `baz':
  243.  
  244.      $ cd gnu/m4
  245.      $ ./m4
  246.      define(foo,0000)
  247.      
  248.      foo
  249.      0000
  250.      define(bar,defn(`foo'))
  251.      
  252.      bar
  253.      0000
  254.      changequote(<QUOTE>,<UNQUOTE>)
  255.      
  256.      define(baz,defn(<QUOTE>foo<UNQUOTE>))
  257.      baz
  258.      C-d
  259.      m4: End of input: 0: fatal error: EOF in string
  260.  
  261. Let us use GDB to try to see what is going on.
  262.  
  263.      $ gdb m4
  264.      GDB is free software and you are welcome to distribute copies
  265.       of it under certain conditions; type "show copying" to see
  266.       the conditions.
  267.      There is absolutely no warranty for GDB; type "show warranty"
  268.       for details.
  269.      
  270.      GDB 4.16, Copyright 1995 Free Software Foundation, Inc...
  271.      (gdb)
  272.  
  273. GDB reads only enough symbol data to know where to find the rest when
  274. needed; as a result, the first prompt comes up very quickly.  We now
  275. tell GDB to use a narrower display width than usual, so that examples
  276. fit in this manual.
  277.  
  278.      (gdb) set width 70
  279.  
  280. We need to see how the `m4' built-in `changequote' works.  Having
  281. looked at the source, we know the relevant subroutine is
  282. `m4_changequote', so we set a breakpoint there with the GDB `break'
  283. command.
  284.  
  285.      (gdb) break m4_changequote
  286.      Breakpoint 1 at 0x62f4: file builtin.c, line 879.
  287.  
  288. Using the `run' command, we start `m4' running under GDB control; as
  289. long as control does not reach the `m4_changequote' subroutine, the
  290. program runs as usual:
  291.  
  292.      (gdb) run
  293.      Starting program: /work/Editorial/gdb/gnu/m4/m4
  294.      define(foo,0000)
  295.      
  296.      foo
  297.      0000
  298.  
  299. To trigger the breakpoint, we call `changequote'.  GDB suspends
  300. execution of `m4', displaying information about the context where it
  301. stops.
  302.  
  303.      changequote(<QUOTE>,<UNQUOTE>)
  304.      
  305.      Breakpoint 1, m4_changequote (argc=3, argv=0x33c70)
  306.          at builtin.c:879
  307.      879         if (bad_argc(TOKEN_DATA_TEXT(argv[0]),argc,1,3))
  308.  
  309. Now we use the command `n' (`next') to advance execution to the next
  310. line of the current function.
  311.  
  312.      (gdb) n
  313.      882         set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\
  314.       : nil,
  315.  
  316. `set_quotes' looks like a promising subroutine.  We can go into it by
  317. using the command `s' (`step') instead of `next'.  `step' goes to the
  318. next line to be executed in *any* subroutine, so it steps into
  319. `set_quotes'.
  320.  
  321.      (gdb) s
  322.      set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  323.          at input.c:530
  324.      530         if (lquote != def_lquote)
  325.  
  326. The display that shows the subroutine where `m4' is now suspended (and
  327. its arguments) is called a stack frame display.  It shows a summary of
  328. the stack.  We can use the `backtrace' command (which can also be
  329. spelled `bt'), to see where we are in the stack as a whole: the
  330. `backtrace' command displays a stack frame for each active subroutine.
  331.  
  332.      (gdb) bt
  333.      #0  set_quotes (lq=0x34c78 "<QUOTE>", rq=0x34c88 "<UNQUOTE>")
  334.          at input.c:530
  335.      #1  0x6344 in m4_changequote (argc=3, argv=0x33c70)
  336.          at builtin.c:882
  337.      #2  0x8174 in expand_macro (sym=0x33320) at macro.c:242
  338.      #3  0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30)
  339.          at macro.c:71
  340.      #4  0x79dc in expand_input () at macro.c:40
  341.      #5  0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195
  342.  
  343. We step through a few more lines to see what happens.  The first two
  344. times, we can use `s'; the next two times we use `n' to avoid falling
  345. into the `xstrdup' subroutine.
  346.  
  347.      (gdb) s
  348.      0x3b5c  532         if (rquote != def_rquote)
  349.      (gdb) s
  350.      0x3b80  535         lquote = (lq == nil || *lq == '\0') ?  \
  351.      def_lquote : xstrdup(lq);
  352.      (gdb) n
  353.      536         rquote = (rq == nil || *rq == '\0') ? def_rquote\
  354.       : xstrdup(rq);
  355.      (gdb) n
  356.      538         len_lquote = strlen(rquote);
  357.  
  358. The last line displayed looks a little odd; we can examine the variables
  359. `lquote' and `rquote' to see if they are in fact the new left and right
  360. quotes we specified.  We use the command `p' (`print') to see their
  361. values.
  362.  
  363.      (gdb) p lquote
  364.      $1 = 0x35d40 "<QUOTE>"
  365.      (gdb) p rquote
  366.      $2 = 0x35d50 "<UNQUOTE>"
  367.  
  368. `lquote' and `rquote' are indeed the new left and right quotes.  To
  369. look at some context, we can display ten lines of source surrounding
  370. the current line with the `l' (`list') command.
  371.  
  372.      (gdb) l
  373.      533             xfree(rquote);
  374.      534
  375.      535         lquote = (lq == nil || *lq == '\0') ? def_lquote\
  376.       : xstrdup (lq);
  377.      536         rquote = (rq == nil || *rq == '\0') ? def_rquote\
  378.       : xstrdup (rq);
  379.      537
  380.      538         len_lquote = strlen(rquote);
  381.      539         len_rquote = strlen(lquote);
  382.      540     }
  383.      541
  384.      542     void
  385.  
  386. Let us step past the two lines that set `len_lquote' and `len_rquote',
  387. and then examine the values of those variables.
  388.  
  389.      (gdb) n
  390.      539         len_rquote = strlen(lquote);
  391.      (gdb) n
  392.      540     }
  393.      (gdb) p len_lquote
  394.      $3 = 9
  395.      (gdb) p len_rquote
  396.      $4 = 7
  397.  
  398. That certainly looks wrong, assuming `len_lquote' and `len_rquote' are
  399. meant to be the lengths of `lquote' and `rquote' respectively.  We can
  400. set them to better values using the `p' command, since it can print the
  401. value of any expression--and that expression can include subroutine
  402. calls and assignments.
  403.  
  404.      (gdb) p len_lquote=strlen(lquote)
  405.      $5 = 7
  406.      (gdb) p len_rquote=strlen(rquote)
  407.      $6 = 9
  408.  
  409. Is that enough to fix the problem of using the new quotes with the `m4'
  410. built-in `defn'?  We can allow `m4' to continue executing with the `c'
  411. (`continue') command, and then try the example that caused trouble
  412. initially:
  413.  
  414.      (gdb) c
  415.      Continuing.
  416.      
  417.      define(baz,defn(<QUOTE>foo<UNQUOTE>))
  418.      
  419.      baz
  420.      0000
  421.  
  422. Success!  The new quotes now work just as well as the default ones.  The
  423. problem seems to have been just the two typos defining the wrong
  424. lengths.  We allow `m4' exit by giving it an EOF as input:
  425.  
  426.      C-d
  427.      Program exited normally.
  428.  
  429. The message `Program exited normally.' is from GDB; it indicates `m4'
  430. has finished executing.  We can end our GDB session with the GDB `quit'
  431. command.
  432.  
  433.      (gdb) quit
  434.  
  435. 
  436. File: gdb,  Node: Invocation,  Next: Commands,  Prev: Sample Session,  Up: Top
  437.  
  438. Getting In and Out of GDB
  439. *************************
  440.  
  441.    This chapter discusses how to start GDB, and how to get out of it.
  442. The essentials are:
  443.    * type `gdb' to start GDB.
  444.  
  445.    * type `quit' or `C-d' to exit.
  446.  
  447. * Menu:
  448.  
  449. * Invoking GDB::                How to start GDB
  450. * Quitting GDB::                 How to quit GDB
  451. * Shell Commands::              How to use shell commands inside GDB
  452.  
  453. 
  454. File: gdb,  Node: Invoking GDB,  Next: Quitting GDB,  Up: Invocation
  455.  
  456. Invoking GDB
  457. ============
  458.  
  459.    Invoke GDB by running the program `gdb'.  Once started, GDB reads
  460. commands from the terminal until you tell it to exit.
  461.  
  462.    You can also run `gdb' with a variety of arguments and options, to
  463. specify more of your debugging environment at the outset.
  464.  
  465.    The command-line options described here are designed to cover a
  466. variety of situations; in some environments, some of these options may
  467. effectively be unavailable.
  468.  
  469.    The most usual way to start GDB is with one argument, specifying an
  470. executable program:
  471.  
  472.      gdb PROGRAM
  473.  
  474. You can also start with both an executable program and a core file
  475. specified:
  476.  
  477.      gdb PROGRAM CORE
  478.  
  479.    You can, instead, specify a process ID as a second argument, if you
  480. want to debug a running process:
  481.  
  482.      gdb PROGRAM 1234
  483.  
  484. would attach GDB to process `1234' (unless you also have a file named
  485. `1234'; GDB does check for a core file first).
  486.  
  487.    Taking advantage of the second command-line argument requires a
  488. fairly complete operating system; when you use GDB as a remote debugger
  489. attached to a bare board, there may not be any notion of "process", and
  490. there is often no way to get a core dump.
  491.  
  492.    You can run `gdb' without printing the front material, which
  493. describes GDB's non-warranty, by specifying `-silent':
  494.  
  495.      gdb -SILENT
  496.  
  497. You can further control how GDB starts up by using command-line
  498. options.  GDB itself can remind you of the options available.
  499.  
  500. Type
  501.  
  502.      gdb -help
  503.  
  504. to display all available options and briefly describe their use (`gdb
  505. -h' is a shorter equivalent).
  506.  
  507.    All options and command line arguments you give are processed in
  508. sequential order.  The order makes a difference when the `-x' option is
  509. used.
  510.  
  511. * Menu:
  512.  
  513.  
  514. * File Options::                Choosing files
  515. * Mode Options::                Choosing modes
  516.  
  517. 
  518. File: gdb,  Node: File Options,  Next: Mode Options,  Up: Invoking GDB
  519.  
  520. Choosing files
  521. --------------
  522.  
  523.    When GDB starts, it reads any arguments other than options as
  524. specifying an executable file and core file (or process ID).  This is
  525. the same as if the arguments were specified by the `-se' and `-c'
  526. options respectively.  (GDB reads the first argument that does not have
  527. an associated option flag as equivalent to the `-se' option followed by
  528. that argument; and the second argument that does not have an associated
  529. option flag, if any, as equivalent to the `-c' option followed by that
  530. argument.)
  531.  
  532.    Many options have both long and short forms; both are shown in the
  533. following list.  GDB also recognizes the long forms if you truncate
  534. them, so long as enough of the option is present to be unambiguous.
  535. (If you prefer, you can flag option arguments with `--' rather than
  536. `-', though we illustrate the more usual convention.)
  537.  
  538. `-symbols FILE'
  539. `-s FILE'
  540.      Read symbol table from file FILE.
  541.  
  542. `-exec FILE'
  543. `-e FILE'
  544.      Use file FILE as the executable file to execute when appropriate,
  545.      and for examining pure data in conjunction with a core dump.
  546.  
  547. `-se FILE'
  548.      Read symbol table from file FILE and use it as the executable file.
  549.  
  550. `-core FILE'
  551. `-c FILE'
  552.      Use file FILE as a core dump to examine.
  553.  
  554. `-c NUMBER'
  555.      Connect to process ID NUMBER, as with the `attach' command (unless
  556.      there is a file in core-dump format named NUMBER, in which case
  557.      `-c' specifies that file as a core dump to read).
  558.  
  559. `-command FILE'
  560. `-x FILE'
  561.      Execute GDB commands from file FILE.  *Note Command files: Command
  562.      Files.
  563.  
  564. `-directory DIRECTORY'
  565. `-d DIRECTORY'
  566.      Add DIRECTORY to the path to search for source files.
  567.  
  568. `-m'
  569. `-mapped'
  570.      *Warning: this option depends on operating system facilities that
  571.      are not supported on all systems.*
  572.      If memory-mapped files are available on your system through the
  573.      `mmap' system call, you can use this option to have GDB write the
  574.      symbols from your program into a reusable file in the current
  575.      directory.  If the program you are debugging is called
  576.      `/tmp/fred', the mapped symbol file is `./fred.syms'.  Future GDB
  577.      debugging sessions notice the presence of this file, and can
  578.      quickly map in symbol information from it, rather than reading the
  579.      symbol table from the executable program.
  580.  
  581.      The `.syms' file is specific to the host machine where GDB is run.
  582.      It holds an exact image of the internal GDB symbol table.  It
  583.      cannot be shared across multiple host platforms.
  584.  
  585. `-r'
  586. `-readnow'
  587.      Read each symbol file's entire symbol table immediately, rather
  588.      than the default, which is to read it incrementally as it is
  589.      needed.  This makes startup slower, but makes future operations
  590.      faster.
  591.  
  592.    The `-mapped' and `-readnow' options are typically combined in order
  593. to build a `.syms' file that contains complete symbol information.
  594. (*Note Commands to specify files: Files, for information
  595.  
  596.    a `.syms' file for future use is:
  597.  
  598.          gdb -batch -nx -mapped -readnow programname
  599.  
  600. 
  601. File: gdb,  Node: Mode Options,  Prev: File Options,  Up: Invoking GDB
  602.  
  603. Choosing modes
  604. --------------
  605.  
  606.    You can run GDB in various alternative modes--for example, in batch
  607. mode or quiet mode.
  608.  
  609. `-nx'
  610. `-n'
  611.      Do not execute commands from any initialization files (normally
  612.      called `.gdbinit').  Normally, the commands in these files are
  613.      executed after all the command options and arguments have been
  614.      processed.  *Note Command files: Command Files.
  615.  
  616. `-quiet'
  617. `-q'
  618.      "Quiet".  Do not print the introductory and copyright messages.
  619.      These messages are also suppressed in batch mode.
  620.  
  621. `-batch'
  622.      Run in batch mode.  Exit with status `0' after processing all the
  623.      command files specified with `-x' (and all commands from
  624.      initialization files, if not inhibited with `-n').  Exit with
  625.      nonzero status if an error occurs in executing the GDB commands in
  626.      the command files.
  627.  
  628.      Batch mode may be useful for running GDB as a filter, for example
  629.      to download and run a program on another computer; in order to
  630.      make this more useful, the message
  631.  
  632.           Program exited normally.
  633.  
  634.      (which is ordinarily issued whenever a program running under GDB
  635.      control terminates) is not issued when running in batch mode.
  636.  
  637. `-cd DIRECTORY'
  638.      Run GDB using DIRECTORY as its working directory, instead of the
  639.      current directory.
  640.  
  641. `-fullname'
  642. `-f'
  643.      GNU Emacs sets this option when it runs GDB as a subprocess.  It
  644.      tells GDB to output the full file name and line number in a
  645.      standard, recognizable fashion each time a stack frame is
  646.      displayed (which includes each time your program stops).  This
  647.      recognizable format looks like two `\032' characters, followed by
  648.      the file name, line number and character position separated by
  649.      colons, and a newline.  The Emacs-to-GDB interface program uses
  650.      the two `\032' characters as a signal to display the source code
  651.      for the frame.
  652.  
  653. `-b BPS'
  654.      Set the line speed (baud rate or bits per second) of any serial
  655.      interface used by GDB for remote debugging.
  656.  
  657. `-tty DEVICE'
  658.      Run using DEVICE for your program's standard input and output.
  659.  
  660. 
  661. File: gdb,  Node: Quitting GDB,  Next: Shell Commands,  Prev: Invoking GDB,  Up: Invocation
  662.  
  663. Quitting GDB
  664. ============
  665.  
  666. `quit'
  667.      To exit GDB, use the `quit' command (abbreviated `q'), or type an
  668.      end-of-file character (usually `C-d').  If you do not supply
  669.      EXPRESSION, GDB will terminate normally; otherwise it will
  670.      terminate using the result of EXPRESSION as the error code.
  671.  
  672.    An interrupt (often `C-c') does not exit from GDB, but rather
  673. terminates the action of any GDB command that is in progress and
  674. returns to GDB command level.  It is safe to type the interrupt
  675. character at any time because GDB does not allow it to take effect
  676. until a time when it is safe.
  677.  
  678.    If you have been using GDB to control an attached process or device,
  679. you can release it with the `detach' command (*note Debugging an
  680. already-running process: Attach.).
  681.  
  682. 
  683. File: gdb,  Node: Shell Commands,  Prev: Quitting GDB,  Up: Invocation
  684.  
  685. Shell commands
  686. ==============
  687.  
  688.    If you need to execute occasional shell commands during your
  689. debugging session, there is no need to leave or suspend GDB; you can
  690. just use the `shell' command.
  691.  
  692. `shell COMMAND STRING'
  693.      Invoke a the standard shell to execute COMMAND STRING.  If it
  694.      exists, the environment variable `SHELL' determines which shell to
  695.      run.  Otherwise GDB uses `/bin/sh'.
  696.  
  697.    The utility `make' is often needed in development environments.  You
  698. do not have to use the `shell' command for this purpose in GDB:
  699.  
  700. `make MAKE-ARGS'
  701.      Execute the `make' program with the specified arguments.  This is
  702.      equivalent to `shell make MAKE-ARGS'.
  703.  
  704. 
  705. File: gdb,  Node: Commands,  Next: Running,  Prev: Invocation,  Up: Top
  706.  
  707. GDB Commands
  708. ************
  709.  
  710.    You can abbreviate a GDB command to the first few letters of the
  711. command name, if that abbreviation is unambiguous; and you can repeat
  712. certain GDB commands by typing just RET.  You can also use the TAB key
  713. to get GDB to fill out the rest of a word in a command (or to show you
  714. the alternatives available, if there is more than one possibility).
  715.  
  716. * Menu:
  717.  
  718. * Command Syntax::              How to give commands to GDB
  719. * Completion::                  Command completion
  720. * Help::                        How to ask GDB for help
  721.  
  722. 
  723. File: gdb,  Node: Command Syntax,  Next: Completion,  Up: Commands
  724.  
  725. Command syntax
  726. ==============
  727.  
  728.    A GDB command is a single line of input.  There is no limit on how
  729. long it can be.  It starts with a command name, which is followed by
  730. arguments whose meaning depends on the command name.  For example, the
  731. command `step' accepts an argument which is the number of times to
  732. step, as in `step 5'.  You can also use the `step' command with no
  733. arguments.  Some command names do not allow any arguments.
  734.  
  735.    GDB command names may always be truncated if that abbreviation is
  736. unambiguous.  Other possible command abbreviations are listed in the
  737. documentation for individual commands.  In some cases, even ambiguous
  738. abbreviations are allowed; for example, `s' is specially defined as
  739. equivalent to `step' even though there are other commands whose names
  740. start with `s'.  You can test abbreviations by using them as arguments
  741. to the `help' command.
  742.  
  743.    A blank line as input to GDB (typing just RET) means to repeat the
  744. previous command. Certain commands (for example, `run') will not repeat
  745. this way; these are commands whose unintentional repetition might cause
  746. trouble and which you are unlikely to want to repeat.
  747.  
  748.    The `list' and `x' commands, when you repeat them with RET,
  749. construct new arguments rather than repeating exactly as typed.  This
  750. permits easy scanning of source or memory.
  751.  
  752.    GDB can also use RET in another way: to partition lengthy output, in
  753. a way similar to the common utility `more' (*note Screen size: Screen
  754. Size.).  Since it is easy to press one RET too many in this situation,
  755. GDB disables command repetition after any command that generates this
  756. sort of display.
  757.  
  758.    Any text from a `#' to the end of the line is a comment; it does
  759. nothing.  This is useful mainly in command files (*note Command files:
  760. Command Files.).
  761.  
  762. 
  763. File: gdb,  Node: Completion,  Next: Help,  Prev: Command Syntax,  Up: Commands
  764.  
  765. Command completion
  766. ==================
  767.  
  768.    GDB can fill in the rest of a word in a command for you, if there is
  769. only one possibility; it can also show you what the valid possibilities
  770. are for the next word in a command, at any time.  This works for GDB
  771. commands, GDB subcommands, and the names of symbols in your program.
  772.  
  773.    Press the TAB key whenever you want GDB to fill out the rest of a
  774. word.  If there is only one possibility, GDB fills in the word, and
  775. waits for you to finish the command (or press RET to enter it).  For
  776. example, if you type
  777.  
  778.      (gdb) info bre TAB
  779.  
  780. GDB fills in the rest of the word `breakpoints', since that is the only
  781. `info' subcommand beginning with `bre':
  782.  
  783.      (gdb) info breakpoints
  784.  
  785. You can either press RET at this point, to run the `info breakpoints'
  786. command, or backspace and enter something else, if `breakpoints' does
  787. not look like the command you expected.  (If you were sure you wanted
  788. `info breakpoints' in the first place, you might as well just type RET
  789. immediately after `info bre', to exploit command abbreviations rather
  790. than command completion).
  791.  
  792.    If there is more than one possibility for the next word when you
  793. press TAB, GDB sounds a bell.  You can either supply more characters
  794. and try again, or just press TAB a second time; GDB displays all the
  795. possible completions for that word.  For example, you might want to set
  796. a breakpoint on a subroutine whose name begins with `make_', but when
  797. you type `b make_TAB' GDB just sounds the bell.  Typing TAB again
  798. displays all the function names in your program that begin with those
  799. characters, for example:
  800.  
  801.      (gdb) b make_ TAB
  802. GDB sounds bell; press TAB again, to see:
  803.      make_a_section_from_file     make_environ
  804.      make_abs_section             make_function_type
  805.      make_blockvector             make_pointer_type
  806.      make_cleanup                 make_reference_type
  807.      make_command                 make_symbol_completion_list
  808.      (gdb) b make_
  809.  
  810. After displaying the available possibilities, GDB copies your partial
  811. input (`b make_' in the example) so you can finish the command.
  812.  
  813.    If you just want to see the list of alternatives in the first place,
  814. you can press `M-?' rather than pressing TAB twice. `M-?' means `META
  815. ?'.  You can type this either by holding down a key designated as the
  816. META shift on your keyboard (if there is one) while typing `?', or as
  817. ESC followed by `?'.
  818.  
  819.    Sometimes the string you need, while logically a "word", may contain
  820. parentheses or other characters that GDB normally excludes from its
  821. notion of a word.  To permit word completion to work in this situation,
  822. you may enclose words in `'' (single quote marks) in GDB commands.
  823.  
  824.    The most likely situation where you might need this is in typing the
  825. name of a C++ function.  This is because C++ allows function overloading
  826. (multiple definitions of the same function, distinguished by argument
  827. type).  For example, when you want to set a breakpoint you may need to
  828. distinguish whether you mean the version of `name' that takes an `int'
  829. parameter, `name(int)', or the version that takes a `float' parameter,
  830. `name(float)'.  To use the word-completion facilities in this
  831. situation, type a single quote `'' at the beginning of the function
  832. name.  This alerts GDB that it may need to consider more information
  833. than usual when you press TAB or `M-?' to request word completion:
  834.  
  835.      (gdb) b 'bubble( M-?
  836.      bubble(double,double)    bubble(int,int)
  837.      (gdb) b 'bubble(
  838.  
  839.    In some cases, GDB can tell that completing a name requires using
  840. quotes.  When this happens, GDB inserts the quote for you (while
  841. completing as much as it can) if you do not type the quote in the first
  842. place:
  843.  
  844.      (gdb) b bub TAB
  845. GDB alters your input line to the following, and rings a bell:
  846.      (gdb) b 'bubble(
  847.  
  848. In general, GDB can tell that a quote is needed (and inserts it) if you
  849. have not yet started typing the argument list when you ask for
  850. completion on an overloaded symbol.
  851.  
  852. 
  853. File: gdb,  Node: Help,  Prev: Completion,  Up: Commands
  854.  
  855. Getting help
  856. ============
  857.  
  858.    You can always ask GDB itself for information on its commands, using
  859. the command `help'.
  860.  
  861. `help'
  862. `h'
  863.      You can use `help' (abbreviated `h') with no arguments to display
  864.      a short list of named classes of commands:
  865.  
  866.           (gdb) help
  867.           List of classes of commands:
  868.           
  869.           running -- Running the program
  870.           stack -- Examining the stack
  871.           data -- Examining data
  872.           breakpoints -- Making program stop at certain points
  873.           files -- Specifying and examining files
  874.           status -- Status inquiries
  875.           support -- Support facilities
  876.           user-defined -- User-defined commands
  877.           aliases -- Aliases of other commands
  878.           obscure -- Obscure features
  879.           
  880.           Type "help" followed by a class name for a list of
  881.           commands in that class.
  882.           Type "help" followed by command name for full
  883.           documentation.
  884.           Command name abbreviations are allowed if unambiguous.
  885.           (gdb)
  886.  
  887. `help CLASS'
  888.      Using one of the general help classes as an argument, you can get a
  889.      list of the individual commands in that class.  For example, here
  890.      is the help display for the class `status':
  891.  
  892.           (gdb) help status
  893.           Status inquiries.
  894.           
  895.           List of commands:
  896.           
  897.           show -- Generic command for showing things set
  898.            with "set"
  899.           info -- Generic command for printing status
  900.           
  901.           Type "help" followed by command name for full
  902.           documentation.
  903.           Command name abbreviations are allowed if unambiguous.
  904.           (gdb)
  905.  
  906. `help COMMAND'
  907.      With a command name as `help' argument, GDB displays a short
  908.      paragraph on how to use that command.
  909.  
  910. `complete ARGS'
  911.      The `complete ARGS' command lists all the possible completions for
  912.      the beginning of a command.  Use ARGS to specify the beginning of
  913.      the command you want completed.  For example:
  914.  
  915.           complete i
  916.  
  917.      results in:
  918.  
  919.           info
  920.           inspect
  921.           ignore
  922.  
  923.      This is intended for use by GNU Emacs.
  924.  
  925.    In addition to `help', you can use the GDB commands `info' and
  926. `show' to inquire about the state of your program, or the state of GDB
  927. itself.  Each command supports many topics of inquiry; this manual
  928. introduces each of them in the appropriate context.  The listings under
  929. `info' and under `show' in the Index point to all the sub-commands.
  930. *Note Index::.
  931.  
  932. `info'
  933.      This command (abbreviated `i') is for describing the state of your
  934.      program.  For example, you can list the arguments given to your
  935.      program with `info args', list the registers currently in use with
  936.      `info registers', or list the breakpoints you have set with `info
  937.      breakpoints'.  You can get a complete list of the `info'
  938.      sub-commands with `help info'.
  939.  
  940. `set'
  941.      You can assign the result of an expresson to an environment
  942.      variable with `set'.  For example, you can set the GDB prompt to a
  943.      $-sign with `set prompt $'.
  944.  
  945. `show'
  946.      In contrast to `info', `show' is for describing the state of GDB
  947.      itself.  You can change most of the things you can `show', by
  948.      using the related command `set'; for example, you can control what
  949.      number system is used for displays with `set radix', or simply
  950.      inquire which is currently in use with `show radix'.
  951.  
  952.      To display all the settable parameters and their current values,
  953.      you can use `show' with no arguments; you may also use `info set'.
  954.      Both commands produce the same display.
  955.  
  956.    Here are three miscellaneous `show' subcommands, all of which are
  957. exceptional in lacking corresponding `set' commands:
  958.  
  959. `show version'
  960.      Show what version of GDB is running.  You should include this
  961.      information in GDB bug-reports.  If multiple versions of GDB are in
  962.      use at your site, you may occasionally want to determine which
  963.      version of GDB you are running; as GDB evolves, new commands are
  964.      introduced, and old ones may wither away.  The version number is
  965.      also announced when you start GDB.
  966.  
  967. `show copying'
  968.      Display information about permission for copying GDB.
  969.  
  970. `show warranty'
  971.      Display the GNU "NO WARRANTY" statement.
  972.  
  973. 
  974. File: gdb,  Node: Running,  Next: Stopping,  Prev: Commands,  Up: Top
  975.  
  976. Running Programs Under GDB
  977. **************************
  978.  
  979.    When you run a program under GDB, you must first generate debugging
  980. information when you compile it.  You may start GDB with its arguments,
  981. if any, in an environment of your choice.  You may redirect your
  982. program's input and output, debug an already running process, or kill a
  983. child process.
  984.  
  985. * Menu:
  986.  
  987. * Compilation::                 Compiling for debugging
  988. * Starting::                    Starting your program
  989.  
  990. * Arguments::                   Your program's arguments
  991. * Environment::                 Your program's environment
  992. * Working Directory::           Your program's working directory
  993. * Input/Output::                Your program's input and output
  994. * Attach::                      Debugging an already-running process
  995. * Kill Process::                Killing the child process
  996. * Process Information::         Additional process information
  997. * Threads::            Debugging programs with multiple threads
  998. * Processes::                   Debugging programs with multiple processes
  999.  
  1000. 
  1001. File: gdb,  Node: Compilation,  Next: Starting,  Up: Running
  1002.  
  1003. Compiling for debugging
  1004. =======================
  1005.  
  1006.    In order to debug a program effectively, you need to generate
  1007. debugging information when you compile it.  This debugging information
  1008. is stored in the object file; it describes the data type of each
  1009. variable or function and the correspondence between source line numbers
  1010. and addresses in the executable code.
  1011.  
  1012.    To request debugging information, specify the `-g' option when you
  1013. run the compiler.
  1014.  
  1015.    Many C compilers are unable to handle the `-g' and `-O' options
  1016. together.  Using those compilers, you cannot generate optimized
  1017. executables containing debugging information.
  1018.  
  1019.    GCC, the GNU C compiler, supports `-g' with or without `-O', making
  1020. it possible to debug optimized code.  We recommend that you *always*
  1021. use `-g' whenever you compile a program.  You may think your program is
  1022. correct, but there is no sense in pushing your luck.
  1023.  
  1024.    When you debug a program compiled with `-g -O', remember that the
  1025. optimizer is rearranging your code; the debugger shows you what is
  1026. really there.  Do not be too surprised when the execution path does not
  1027. exactly match your source file!  An extreme example: if you define a
  1028. variable, but never use it, GDB never sees that variable--because the
  1029. compiler optimizes it out of existence.
  1030.  
  1031.    Some things do not work as well with `-g -O' as with just `-g',
  1032. particularly on machines with instruction scheduling.  If in doubt,
  1033. recompile with `-g' alone, and if this fixes the problem, please report
  1034. it to us as a bug (including a test case!).
  1035.  
  1036.    Older versions of the GNU C compiler permitted a variant option
  1037. `-gg' for debugging information.  GDB no longer supports this format;
  1038. if your GNU C compiler has this option, do not use it.
  1039.  
  1040. 
  1041. File: gdb,  Node: Starting,  Next: Arguments,  Prev: Compilation,  Up: Running
  1042.  
  1043. Starting your program
  1044. =====================
  1045.  
  1046. `run'
  1047. `r'
  1048.      Use the `run' command to start your program under GDB.  You must
  1049.      first specify the program name (except on VxWorks) with an
  1050.      argument to GDB (*note Getting In and Out of GDB: Invocation.), or
  1051.      by using the `file' or `exec-file' command (*note Commands to
  1052.      specify files: Files.).
  1053.  
  1054.    If you are running your program in an execution environment that
  1055. supports processes, `run' creates an inferior process and makes that
  1056. process run your program.  (In environments without processes, `run'
  1057. jumps to the start of your program.)
  1058.  
  1059.    The execution of a program is affected by certain information it
  1060. receives from its superior.  GDB provides ways to specify this
  1061. information, which you must do *before* starting your program.  (You
  1062. can change it after starting your program, but such changes only affect
  1063. your program the next time you start it.)  This information may be
  1064. divided into four categories:
  1065.  
  1066. The *arguments.*
  1067.      Specify the arguments to give your program as the arguments of the
  1068.      `run' command.  If a shell is available on your target, the shell
  1069.      is used to pass the arguments, so that you may use normal
  1070.      conventions (such as wildcard expansion or variable substitution)
  1071.      in describing the arguments.  In Unix systems, you can control
  1072.      which shell is used with the `SHELL' environment variable. *Note
  1073.      Your program's arguments: Arguments.
  1074.  
  1075. The *environment.*
  1076.      Your program normally inherits its environment from GDB, but you
  1077.      can use the GDB commands `set environment' and `unset environment'
  1078.      to change parts of the environment that affect your program.
  1079.      *Note Your program's environment: Environment.
  1080.  
  1081. The *working directory.*
  1082.      Your program inherits its working directory from GDB.  You can set
  1083.      the GDB working directory with the `cd' command in GDB.  *Note
  1084.      Your program's working directory: Working Directory.
  1085.  
  1086. The *standard input and output.*
  1087.      Your program normally uses the same device for standard input and
  1088.      standard output as GDB is using.  You can redirect input and output
  1089.      in the `run' command line, or you can use the `tty' command to set
  1090.      a different device for your program.  *Note Your program's input
  1091.      and output: Input/Output.
  1092.  
  1093.      *Warning:* While input and output redirection work, you cannot use
  1094.      pipes to pass the output of the program you are debugging to
  1095.      another program; if you attempt this, GDB is likely to wind up
  1096.      debugging the wrong program.
  1097.  
  1098.    When you issue the `run' command, your program begins to execute
  1099. immediately.  *Note Stopping and continuing: Stopping, for discussion
  1100. of how to arrange for your program to stop.  Once your program has
  1101. stopped, you may call functions in your program, using the `print' or
  1102. `call' commands.  *Note Examining Data: Data.
  1103.  
  1104.    If the modification time of your symbol file has changed since the
  1105. last time GDB read its symbols, GDB discards its symbol table, and
  1106. reads it again.  When it does this, GDB tries to retain your current
  1107. breakpoints.
  1108.  
  1109. 
  1110. File: gdb,  Node: Arguments,  Next: Environment,  Prev: Starting,  Up: Running
  1111.  
  1112. Your program's arguments
  1113. ========================
  1114.  
  1115.    The arguments to your program can be specified by the arguments of
  1116. the `run' command.  They are passed to a shell, which expands wildcard
  1117. characters and performs redirection of I/O, and thence to your program.
  1118. Your `SHELL' environment variable (if it exists) specifies what shell
  1119. GDB uses.  If you do not define `SHELL', GDB uses `/bin/sh'.
  1120.  
  1121.    `run' with no arguments uses the same arguments used by the previous
  1122. `run', or those set by the `set args' command.
  1123.  
  1124. `set args'
  1125.      Specify the arguments to be used the next time your program is
  1126.      run.  If `set args' has no arguments, `run' executes your program
  1127.      with no arguments.  Once you have run your program with arguments,
  1128.      using `set args' before the next `run' is the only way to run it
  1129.      again without arguments.
  1130.  
  1131. `show args'
  1132.      Show the arguments to give your program when it is started.
  1133.  
  1134. 
  1135. File: gdb,  Node: Environment,  Next: Working Directory,  Prev: Arguments,  Up: Running
  1136.  
  1137. Your program's environment
  1138. ==========================
  1139.  
  1140.    The "environment" consists of a set of environment variables and
  1141. their values.  Environment variables conventionally record such things
  1142. as your user name, your home directory, your terminal type, and your
  1143. search path for programs to run.  Usually you set up environment
  1144. variables with the shell and they are inherited by all the other
  1145. programs you run.  When debugging, it can be useful to try running your
  1146. program with a modified environment without having to start GDB over
  1147. again.
  1148.  
  1149. `path DIRECTORY'
  1150.      Add DIRECTORY to the front of the `PATH' environment variable (the
  1151.      search path for executables), for both GDB and your program.  You
  1152.      may specify several directory names, separated by `:' or
  1153.      whitespace.  If DIRECTORY is already in the path, it is moved to
  1154.      the front, so it is searched sooner.
  1155.  
  1156.      You can use the string `$cwd' to refer to whatever is the current
  1157.      working directory at the time GDB searches the path.  If you use
  1158.      `.' instead, it refers to the directory where you executed the
  1159.      `path' command.  GDB replaces `.' in the DIRECTORY argument (with
  1160.      the current path) before adding DIRECTORY to the search path.
  1161.  
  1162. `show paths'
  1163.      Display the list of search paths for executables (the `PATH'
  1164.      environment variable).
  1165.  
  1166. `show environment [VARNAME]'
  1167.      Print the value of environment variable VARNAME to be given to
  1168.      your program when it starts.  If you do not supply VARNAME, print
  1169.      the names and values of all environment variables to be given to
  1170.      your program.  You can abbreviate `environment' as `env'.
  1171.  
  1172. `set environment VARNAME [=] VALUE'
  1173.      Set environment variable VARNAME to VALUE.  The value changes for
  1174.      your program only, not for GDB itself.  VALUE may be any string;
  1175.      the values of environment variables are just strings, and any
  1176.      interpretation is supplied by your program itself.  The VALUE
  1177.      parameter is optional; if it is eliminated, the variable is set to
  1178.      a null value.
  1179.  
  1180.      For example, this command:
  1181.  
  1182.           set env USER = foo
  1183.  
  1184.      tells a Unix program, when subsequently run, that its user is named
  1185.      `foo'.  (The spaces around `=' are used for clarity here; they are
  1186.      not actually required.)
  1187.  
  1188. `unset environment VARNAME'
  1189.      Remove variable VARNAME from the environment to be passed to your
  1190.      program.  This is different from `set env VARNAME ='; `unset
  1191.      environment' removes the variable from the environment, rather
  1192.      than assigning it an empty value.
  1193.  
  1194.    *Warning:* GDB runs your program using the shell indicated by your
  1195. `SHELL' environment variable if it exists (or `/bin/sh' if not).  If
  1196. your `SHELL' variable names a shell that runs an initialization
  1197. file--such as `.cshrc' for C-shell, or `.bashrc' for BASH--any
  1198. variables you set in that file affect your program.  You may wish to
  1199. move setting of environment variables to files that are only run when
  1200. you sign on, such as `.login' or `.profile'.
  1201.  
  1202. 
  1203. File: gdb,  Node: Working Directory,  Next: Input/Output,  Prev: Environment,  Up: Running
  1204.  
  1205. Your program's working directory
  1206. ================================
  1207.  
  1208.    Each time you start your program with `run', it inherits its working
  1209. directory from the current working directory of GDB.  The GDB working
  1210. directory is initially whatever it inherited from its parent process
  1211. (typically the shell), but you can specify a new working directory in
  1212. GDB with the `cd' command.
  1213.  
  1214.    The GDB working directory also serves as a default for the commands
  1215. that specify files for GDB to operate on.  *Note Commands to specify
  1216. files: Files.
  1217.  
  1218. `cd DIRECTORY'
  1219.      Set the GDB working directory to DIRECTORY.
  1220.  
  1221. `pwd'
  1222.      Print the GDB working directory.
  1223.  
  1224. 
  1225. File: gdb,  Node: Input/Output,  Next: Attach,  Prev: Working Directory,  Up: Running
  1226.  
  1227. Your program's input and output
  1228. ===============================
  1229.  
  1230.    By default, the program you run under GDB does input and output to
  1231. the same terminal that GDB uses.  GDB switches the terminal to its own
  1232. terminal modes to interact with you, but it records the terminal modes
  1233. your program was using and switches back to them when you continue
  1234. running your program.
  1235.  
  1236. `info terminal'
  1237.      Displays information recorded by GDB about the terminal modes your
  1238.      program is using.
  1239.  
  1240.    You can redirect your program's input and/or output using shell
  1241. redirection with the `run' command.  For example,
  1242.  
  1243.      run > outfile
  1244.  
  1245. starts your program, diverting its output to the file `outfile'.
  1246.  
  1247.    Another way to specify where your program should do input and output
  1248. is with the `tty' command.  This command accepts a file name as
  1249. argument, and causes this file to be the default for future `run'
  1250. commands.  It also resets the controlling terminal for the child
  1251. process, for future `run' commands.  For example,
  1252.  
  1253.      tty /dev/ttyb
  1254.  
  1255. directs that processes started with subsequent `run' commands default
  1256. to do input and output on the terminal `/dev/ttyb' and have that as
  1257. their controlling terminal.
  1258.  
  1259.    An explicit redirection in `run' overrides the `tty' command's
  1260. effect on the input/output device, but not its effect on the controlling
  1261. terminal.
  1262.  
  1263.    When you use the `tty' command or redirect input in the `run'
  1264. command, only the input *for your program* is affected.  The input for
  1265. GDB still comes from your terminal.
  1266.  
  1267. 
  1268. File: gdb,  Node: Attach,  Next: Kill Process,  Prev: Input/Output,  Up: Running
  1269.  
  1270. Debugging an already-running process
  1271. ====================================
  1272.  
  1273. `attach PROCESS-ID'
  1274.      This command attaches to a running process--one that was started
  1275.      outside GDB.  (`info files' shows your active targets.)  The
  1276.      command takes as argument a process ID.  The usual way to find out
  1277.      the process-id of a Unix process is with the `ps' utility, or with
  1278.      the `jobs -l' shell command.
  1279.  
  1280.      `attach' does not repeat if you press RET a second time after
  1281.      executing the command.
  1282.  
  1283.    To use `attach', your program must be running in an environment
  1284. which supports processes; for example, `attach' does not work for
  1285. programs on bare-board targets that lack an operating system.  You must
  1286. also have permission to send the process a signal.
  1287.  
  1288.    When using `attach', you should first use the `file' command to
  1289. specify the program running in the process and load its symbol table.
  1290. *Note Commands to Specify Files: Files.
  1291.  
  1292.    The first thing GDB does after arranging to debug the specified
  1293. process is to stop it.  You can examine and modify an attached process
  1294. with all the GDB commands that are ordinarily available when you start
  1295. processes with `run'.  You can insert breakpoints; you can step and
  1296. continue; you can modify storage.  If you would rather the process
  1297. continue running, you may use the `continue' command after attaching
  1298. GDB to the process.
  1299.  
  1300. `detach'
  1301.      When you have finished debugging the attached process, you can use
  1302.      the `detach' command to release it from GDB control.  Detaching
  1303.      the process continues its execution.  After the `detach' command,
  1304.      that process and GDB become completely independent once more, and
  1305.      you are ready to `attach' another process or start one with `run'.
  1306.      `detach' does not repeat if you press RET again after executing
  1307.      the command.
  1308.  
  1309.    If you exit GDB or use the `run' command while you have an attached
  1310. process, you kill that process.  By default, GDB asks for confirmation
  1311. if you try to do either of these things; you can control whether or not
  1312. you need to confirm by using the `set confirm' command (*note Optional
  1313. warnings and messages: Messages/Warnings.).
  1314.  
  1315. 
  1316. File: gdb,  Node: Kill Process,  Next: Process Information,  Prev: Attach,  Up: Running
  1317.  
  1318. Killing the child process
  1319. =========================
  1320.  
  1321. `kill'
  1322.      Kill the child process in which your program is running under GDB.
  1323.  
  1324.    This command is useful if you wish to debug a core dump instead of a
  1325. running process.  GDB ignores any core dump file while your program is
  1326. running.
  1327.  
  1328.    On some operating systems, a program cannot be executed outside GDB
  1329. while you have breakpoints set on it inside GDB.  You can use the
  1330. `kill' command in this situation to permit running your program outside
  1331. the debugger.
  1332.  
  1333.    The `kill' command is also useful if you wish to recompile and
  1334. relink your program, since on many systems it is impossible to modify an
  1335. executable file while it is running in a process.  In this case, when
  1336. you next type `run', GDB notices that the file has changed, and reads
  1337. the symbol table again (while trying to preserve your current
  1338. breakpoint settings).
  1339.  
  1340. 
  1341. File: gdb,  Node: Process Information,  Next: Threads,  Prev: Kill Process,  Up: Running
  1342.  
  1343. Additional process information
  1344. ==============================
  1345.  
  1346.    Some operating systems provide a facility called `/proc' that can be
  1347. used to examine the image of a running process using file-system
  1348. subroutines.  If GDB is configured for an operating system with this
  1349. facility, the command `info proc' is available to report on several
  1350. kinds of information about the process running your program.  `info
  1351. proc' works only on SVR4 systems that support `procfs'.
  1352.  
  1353. `info proc'
  1354.      Summarize available information about the process.
  1355.  
  1356. `info proc mappings'
  1357.      Report on the address ranges accessible in the program, with
  1358.      information on whether your program may read, write, or execute
  1359.      each range.
  1360.  
  1361. `info proc times'
  1362.      Starting time, user CPU time, and system CPU time for your program
  1363.      and its children.
  1364.  
  1365. `info proc id'
  1366.      Report on the process IDs related to your program: its own process
  1367.      ID, the ID of its parent, the process group ID, and the session ID.
  1368.  
  1369. `info proc status'
  1370.      General information on the state of the process.  If the process is
  1371.      stopped, this report includes the reason for stopping, and any
  1372.      signal received.
  1373.  
  1374. `info proc all'
  1375.      Show all the above information about the process.
  1376.  
  1377. 
  1378. File: gdb,  Node: Threads,  Next: Processes,  Prev: Process Information,  Up: Running
  1379.  
  1380. Debugging programs with multiple threads
  1381. ========================================
  1382.  
  1383.    In some operating systems, a single program may have more than one
  1384. "thread" of execution.  The precise semantics of threads differ from
  1385. one operating system to another, but in general the threads of a single
  1386. program are akin to multiple processes--except that they share one
  1387. address space (that is, they can all examine and modify the same
  1388. variables).  On the other hand, each thread has its own registers and
  1389. execution stack, and perhaps private memory.
  1390.  
  1391.    GDB provides these facilities for debugging multi-thread programs:
  1392.  
  1393.    * automatic notification of new threads
  1394.  
  1395.    * `thread THREADNO', a command to switch among threads
  1396.  
  1397.    * `info threads', a command to inquire about existing threads
  1398.  
  1399.    * `thread apply [THREADNO] [ALL] ARGS', a command to apply a command
  1400.      to a list of threads
  1401.  
  1402.    * thread-specific breakpoints
  1403.  
  1404.      *Warning:* These facilities are not yet available on every GDB
  1405.      configuration where the operating system supports threads.  If
  1406.      your GDB does not support threads, these commands have no effect.
  1407.      For example, a system without thread support shows no output from
  1408.      `info threads', and always rejects the `thread' command, like this:
  1409.  
  1410.           (gdb) info threads
  1411.           (gdb) thread 1
  1412.           Thread ID 1 not known.  Use the "info threads" command to
  1413.           see the IDs of currently known threads.
  1414.  
  1415.    The GDB thread debugging facility allows you to observe all threads
  1416. while your program runs--but whenever GDB takes control, one thread in
  1417. particular is always the focus of debugging.  This thread is called the
  1418. "current thread".  Debugging commands show program information from the
  1419. perspective of the current thread.
  1420.  
  1421.    Whenever GDB detects a new thread in your program, it displays the
  1422. target system's identification for the thread with a message in the
  1423. form `[New SYSTAG]'.  SYSTAG is a thread identifier whose form varies
  1424. depending on the particular system.  For example, on LynxOS, you might
  1425. see
  1426.  
  1427.      [New process 35 thread 27]
  1428.  
  1429. when GDB notices a new thread.  In contrast, on an SGI system, the
  1430. SYSTAG is simply something like `process 368', with no further
  1431. qualifier.
  1432.  
  1433.    For debugging purposes, GDB associates its own thread number--always
  1434. a single integer--with each thread in your program.
  1435.  
  1436. `info threads'
  1437.      Display a summary of all threads currently in your program.  GDB
  1438.      displays for each thread (in this order):
  1439.  
  1440.        1. the thread number assigned by GDB
  1441.  
  1442.        2. the target system's thread identifier (SYSTAG)
  1443.  
  1444.        3. the current stack frame summary for that thread
  1445.  
  1446.      An asterisk `*' to the left of the GDB thread number indicates the
  1447.      current thread.
  1448.  
  1449.      For example,
  1450.  
  1451.      (gdb) info threads
  1452.        3 process 35 thread 27  0x34e5 in sigpause ()
  1453.        2 process 35 thread 23  0x34e5 in sigpause ()
  1454.      * 1 process 35 thread 13  main (argc=1, argv=0x7ffffff8)
  1455.          at threadtest.c:68
  1456.  
  1457. `thread THREADNO'
  1458.      Make thread number THREADNO the current thread.  The command
  1459.      argument THREADNO is the internal GDB thread number, as shown in
  1460.      the first field of the `info threads' display.  GDB responds by
  1461.      displaying the system identifier of the thread you selected, and
  1462.      its current stack frame summary:
  1463.  
  1464.           (gdb) thread 2
  1465.           [Switching to process 35 thread 23]
  1466.           0x34e5 in sigpause ()
  1467.  
  1468.      As with the `[New ...]' message, the form of the text after
  1469.      `Switching to' depends on your system's conventions for identifying
  1470.      threads.
  1471.  
  1472. `thread apply [THREADNO] [ALL]  ARGS'
  1473.      The `thread apply' command allows you to apply a command to one or
  1474.      more threads.  Specify the numbers of the threads that you want
  1475.      affected with the command argument THREADNO.  THREADNO is the
  1476.      internal GDB thread number, as shown in the first field of the
  1477.      `info threads' display.  To apply a command to all threads, use
  1478.      `thread apply all' ARGS.
  1479.  
  1480.    Whenever GDB stops your program, due to a breakpoint or a signal, it
  1481. automatically selects the thread where that breakpoint or signal
  1482. happened.  GDB alerts you to the context switch with a message of the
  1483. form `[Switching to SYSTAG]' to identify the thread.
  1484.  
  1485.    *Note Stopping and starting multi-thread programs: Thread Stops, for
  1486. more information about how GDB behaves when you stop and start programs
  1487. with multiple threads.
  1488.  
  1489.    *Note Setting watchpoints: Set Watchpoints, for information about
  1490. watchpoints in programs with multiple threads.
  1491.  
  1492. 
  1493. File: gdb,  Node: Processes,  Prev: Threads,  Up: Running
  1494.  
  1495. Debugging programs with multiple processes
  1496. ==========================================
  1497.  
  1498.    GDB has no special support for debugging programs which create
  1499. additional processes using the `fork' function.  When a program forks,
  1500. GDB will continue to debug the parent process and the child process
  1501. will run unimpeded.  If you have set a breakpoint in any code which the
  1502. child then executes, the child will get a `SIGTRAP' signal which
  1503. (unless it catches the signal) will cause it to terminate.
  1504.  
  1505.    However, if you want to debug the child process there is a workaround
  1506. which isn't too painful.  Put a call to `sleep' in the code which the
  1507. child process executes after the fork.  It may be useful to sleep only
  1508. if a certain environment variable is set, or a certain file exists, so
  1509. that the delay need not occur when you don't want to run GDB on the
  1510. child.  While the child is sleeping, use the `ps' program to get its
  1511. process ID.  Then tell GDB (a new invocation of GDB if you are also
  1512. debugging the parent process) to attach to the child process (see *Note
  1513. Attach::).  From that point on you can debug the child process just
  1514. like any other process which you attached to.
  1515.  
  1516. 
  1517. File: gdb,  Node: Stopping,  Next: Stack,  Prev: Running,  Up: Top
  1518.  
  1519. Stopping and Continuing
  1520. ***********************
  1521.  
  1522.    The principal purposes of using a debugger are so that you can stop
  1523. your program before it terminates; or so that, if your program runs into
  1524. trouble, you can investigate and find out why.
  1525.  
  1526.    Inside GDB, your program may stop for any of several reasons, such as
  1527. a signal, a breakpoint, or reaching a new line after a GDB command such
  1528. as `step'.  You may then examine and change variables, set new
  1529. breakpoints or remove old ones, and then continue execution.  Usually,
  1530. the messages shown by GDB provide ample explanation of the status of
  1531. your program--but you can also explicitly request this information at
  1532. any time.
  1533.  
  1534. `info program'
  1535.      Display information about the status of your program: whether it is
  1536.      running or not, what process it is, and why it stopped.
  1537.  
  1538. * Menu:
  1539.  
  1540.  
  1541. * Breakpoints::                 Breakpoints, watchpoints, and exceptions
  1542.  
  1543. * Continuing and Stepping::     Resuming execution
  1544.  
  1545. * Signals::                     Signals
  1546.  
  1547. * Thread Stops::        Stopping and starting multi-thread programs
  1548.  
  1549. 
  1550. File: gdb,  Node: Breakpoints,  Next: Continuing and Stepping,  Up: Stopping
  1551.  
  1552. Breakpoints, watchpoints, and exceptions
  1553. ========================================
  1554.  
  1555.    A "breakpoint" makes your program stop whenever a certain point in
  1556. the program is reached.  For each breakpoint, you can add conditions to
  1557. control in finer detail whether your program stops.  You can set
  1558. breakpoints with the `break' command and its variants (*note Setting
  1559. breakpoints: Set Breaks.), to specify the place where your program
  1560. should stop by line number, function name or exact address in the
  1561. program.  In languages with exception handling (such as GNU C++), you
  1562. can also set breakpoints where an exception is raised (*note
  1563. Breakpoints and exceptions: Exception Handling.).
  1564.  
  1565.    In SunOS 4.x, SVR4, and Alpha OSF/1 configurations, you can now set
  1566. breakpoints in shared libraries before the executable is run.
  1567.  
  1568.    A "watchpoint" is a special breakpoint that stops your program when
  1569. the value of an expression changes.  You must use a different command
  1570. to set watchpoints (*note Setting watchpoints: Set Watchpoints.), but
  1571. aside from that, you can manage a watchpoint like any other breakpoint:
  1572. you enable, disable, and delete both breakpoints and watchpoints using
  1573. the same commands.
  1574.  
  1575.    You can arrange to have values from your program displayed
  1576. automatically whenever GDB stops at a breakpoint.  *Note Automatic
  1577. display: Auto Display.
  1578.  
  1579.    GDB assigns a number to each breakpoint or watchpoint when you
  1580. create it; these numbers are successive integers starting with one.  In
  1581. many of the commands for controlling various features of breakpoints you
  1582. use the breakpoint number to say which breakpoint you want to change.
  1583. Each breakpoint may be "enabled" or "disabled"; if disabled, it has no
  1584. effect on your program until you enable it again.
  1585.  
  1586. * Menu:
  1587.  
  1588. * Set Breaks::                  Setting breakpoints
  1589. * Set Watchpoints::             Setting watchpoints
  1590.  
  1591. * Exception Handling::          Breakpoints and exceptions
  1592.  
  1593. * Delete Breaks::               Deleting breakpoints
  1594. * Disabling::                   Disabling breakpoints
  1595. * Conditions::                  Break conditions
  1596. * Break Commands::              Breakpoint command lists
  1597.  
  1598. * Breakpoint Menus::            Breakpoint menus
  1599.  
  1600. 
  1601. File: gdb,  Node: Set Breaks,  Next: Set Watchpoints,  Up: Breakpoints
  1602.  
  1603. Setting breakpoints
  1604. -------------------
  1605.  
  1606.    Breakpoints are set with the `break' command (abbreviated `b').  The
  1607. debugger convenience variable `$bpnum' records the number of the
  1608. breakpoints you've set most recently; see *Note Convenience variables:
  1609. Convenience Vars, for a discussion of what you can do with convenience
  1610. variables.
  1611.  
  1612.    You have several ways to say where the breakpoint should go.
  1613.  
  1614. `break FUNCTION'
  1615.      Set a breakpoint at entry to function FUNCTION.  When using source
  1616.      languages that permit overloading of symbols, such as C++,
  1617.      FUNCTION may refer to more than one possible place to break.
  1618.      *Note Breakpoint menus: Breakpoint Menus, for a discussion of that
  1619.      situation.
  1620.  
  1621. `break +OFFSET'
  1622. `break -OFFSET'
  1623.      Set a breakpoint some number of lines forward or back from the
  1624.      position at which execution stopped in the currently selected
  1625.      frame.
  1626.  
  1627. `break LINENUM'
  1628.      Set a breakpoint at line LINENUM in the current source file.  That
  1629.      file is the last file whose source text was printed.  This
  1630.      breakpoint stops your program just before it executes any of the
  1631.      code on that line.
  1632.  
  1633. `break FILENAME:LINENUM'
  1634.      Set a breakpoint at line LINENUM in source file FILENAME.
  1635.  
  1636. `break FILENAME:FUNCTION'
  1637.      Set a breakpoint at entry to function FUNCTION found in file
  1638.      FILENAME.  Specifying a file name as well as a function name is
  1639.      superfluous except when multiple files contain similarly named
  1640.      functions.
  1641.  
  1642. `break *ADDRESS'
  1643.      Set a breakpoint at address ADDRESS.  You can use this to set
  1644.      breakpoints in parts of your program which do not have debugging
  1645.      information or source files.
  1646.  
  1647. `break'
  1648.      When called without any arguments, `break' sets a breakpoint at
  1649.      the next instruction to be executed in the selected stack frame
  1650.      (*note Examining the Stack: Stack.).  In any selected frame but the
  1651.      innermost, this makes your program stop as soon as control returns
  1652.      to that frame.  This is similar to the effect of a `finish'
  1653.      command in the frame inside the selected frame--except that
  1654.      `finish' does not leave an active breakpoint.  If you use `break'
  1655.      without an argument in the innermost frame, GDB stops the next
  1656.      time it reaches the current location; this may be useful inside
  1657.      loops.
  1658.  
  1659.      GDB normally ignores breakpoints when it resumes execution, until
  1660.      at least one instruction has been executed.  If it did not do
  1661.      this, you would be unable to proceed past a breakpoint without
  1662.      first disabling the breakpoint.  This rule applies whether or not
  1663.      the breakpoint already existed when your program stopped.
  1664.  
  1665. `break ... if COND'
  1666.      Set a breakpoint with condition COND; evaluate the expression COND
  1667.      each time the breakpoint is reached, and stop only if the value is
  1668.      nonzero--that is, if COND evaluates as true.  `...' stands for one
  1669.      of the possible arguments described above (or no argument)
  1670.      specifying where to break.  *Note Break conditions: Conditions,
  1671.      for more information on breakpoint conditions.
  1672.  
  1673. `tbreak ARGS'
  1674.      Set a breakpoint enabled only for one stop.  ARGS are the same as
  1675.      for the `break' command, and the breakpoint is set in the same
  1676.      way, but the breakpoint is automatically deleted after the first
  1677.      time your program stops there.  *Note Disabling breakpoints:
  1678.      Disabling.
  1679.  
  1680. `hbreak ARGS'
  1681.      Set a hardware-assisted breakpoint.  ARGS are the same as for the
  1682.      `break' command and the breakpoint is set in the same way, but the
  1683.      breakpoint requires hardware support and some target hardware may
  1684.      not have this support.  The main purpose of this is EPROM/ROM code
  1685.      debugging, so you can set a breakpoint at an instruction without
  1686.      changing the instruction.  This can be used with the new
  1687.      trap-generation provided by SPARClite DSU.  DSU will generate
  1688.      traps when a program accesses some date or instruction address
  1689.      that is assigned to the debug registers.  However the hardware
  1690.      breakpoint registers can only take two data breakpoints, and GDB
  1691.      will reject this command if more than two are used.  Delete or
  1692.      disable usused hardware breakpoints before setting new ones.
  1693.      *Note Break conditions: Conditions.
  1694.  
  1695. `thbreak ARGS'
  1696.      Set a hardware-assisted breakpoint enabled only for one stop.  ARGS
  1697.      are the same as for the `hbreak' command and the breakpoint is set
  1698.      in the same way.  However, like the `tbreak' command, the
  1699.      breakpoint is automatically deleted after the first time your
  1700.      program stops there.  Also, like the `hbreak' command, the
  1701.      breakpoint requires hardware support and some target hardware may
  1702.      not have this support.  *Note Disabling breakpoints: Disabling.
  1703.      Also *Note Break conditions: Conditions.
  1704.  
  1705. `rbreak REGEX'
  1706.      Set breakpoints on all functions matching the regular expression
  1707.      REGEX.  This command sets an unconditional breakpoint on all
  1708.      matches, printing a list of all breakpoints it set.  Once these
  1709.      breakpoints are set, they are treated just like the breakpoints
  1710.      set with the `break' command.  You can delete them, disable them,
  1711.      or make them conditional the same way as any other breakpoint.
  1712.  
  1713.      When debugging C++ programs, `rbreak' is useful for setting
  1714.      breakpoints on overloaded functions that are not members of any
  1715.      special classes.
  1716.  
  1717. `info breakpoints [N]'
  1718. `info break [N]'
  1719. `info watchpoints [N]'
  1720.      Print a table of all breakpoints and watchpoints set and not
  1721.      deleted, with the following columns for each breakpoint:
  1722.  
  1723.     *Breakpoint Numbers*
  1724.     *Type*
  1725.           Breakpoint or watchpoint.
  1726.  
  1727.     *Disposition*
  1728.           Whether the breakpoint is marked to be disabled or deleted
  1729.           when hit.
  1730.  
  1731.     *Enabled or Disabled*
  1732.           Enabled breakpoints are marked with `y'.  `n' marks
  1733.           breakpoints that are not enabled.
  1734.  
  1735.     *Address*
  1736.           Where the breakpoint is in your program, as a memory address
  1737.  
  1738.     *What*
  1739.           Where the breakpoint is in the source for your program, as a
  1740.           file and line number.
  1741.  
  1742.      If a breakpoint is conditional, `info break' shows the condition on
  1743.      the line following the affected breakpoint; breakpoint commands,
  1744.      if any, are listed after that.
  1745.  
  1746.      `info break' with a breakpoint number N as argument lists only
  1747.      that breakpoint.  The convenience variable `$_' and the default
  1748.      examining-address for the `x' command are set to the address of
  1749.      the last breakpoint listed (*note Examining memory: Memory.).
  1750.  
  1751.      `info break' now displays a count of the number of times the
  1752.      breakpoint has been hit.  This is especially useful in conjunction
  1753.      with the `ignore' command.  You can ignore a large number of
  1754.      breakpoint hits, look at the breakpoint info to see how many times
  1755.      the breakpoint was hit, and then run again, ignoring one less than
  1756.      that number.  This will get you quickly to the last hit of that
  1757.      breakpoint.
  1758.  
  1759.    GDB allows you to set any number of breakpoints at the same place in
  1760. your program.  There is nothing silly or meaningless about this.  When
  1761. the breakpoints are conditional, this is even useful (*note Break
  1762. conditions: Conditions.).
  1763.  
  1764.    GDB itself sometimes sets breakpoints in your program for special
  1765. purposes, such as proper handling of `longjmp' (in C programs).  These
  1766. internal breakpoints are assigned negative numbers, starting with `-1';
  1767. `info breakpoints' does not display them.
  1768.  
  1769.    You can see these breakpoints with the GDB maintenance command
  1770. `maint info breakpoints'.
  1771.  
  1772. `maint info breakpoints'
  1773.      Using the same format as `info breakpoints', display both the
  1774.      breakpoints you've set explicitly, and those GDB is using for
  1775.      internal purposes.  Internal breakpoints are shown with negative
  1776.      breakpoint numbers.  The type column identifies what kind of
  1777.      breakpoint is shown:
  1778.  
  1779.     `breakpoint'
  1780.           Normal, explicitly set breakpoint.
  1781.  
  1782.     `watchpoint'
  1783.           Normal, explicitly set watchpoint.
  1784.  
  1785.     `longjmp'
  1786.           Internal breakpoint, used to handle correctly stepping through
  1787.           `longjmp' calls.
  1788.  
  1789.     `longjmp resume'
  1790.           Internal breakpoint at the target of a `longjmp'.
  1791.  
  1792.     `until'
  1793.           Temporary internal breakpoint used by the GDB `until' command.
  1794.  
  1795.     `finish'
  1796.           Temporary internal breakpoint used by the GDB `finish'
  1797.           command.
  1798.  
  1799. 
  1800. File: gdb,  Node: Set Watchpoints,  Next: Exception Handling,  Prev: Set Breaks,  Up: Breakpoints
  1801.  
  1802. Setting watchpoints
  1803. -------------------
  1804.  
  1805.    You can use a watchpoint to stop execution whenever the value of an
  1806. expression changes, without having to predict a particular place where
  1807. this may happen.
  1808.  
  1809.    Watchpoints currently execute two orders of magnitude more slowly
  1810. than other breakpoints, but this can be well worth it to catch errors
  1811. where you have no clue what part of your program is the culprit.
  1812.  
  1813. `watch EXPR'
  1814.      Set a watchpoint for an expression.  GDB will break when EXPR is
  1815.      written into by the program and its value changes.  This can be
  1816.      used with the new trap-generation provided by SPARClite DSU.  DSU
  1817.      will generate traps when a program accesses some date or
  1818.      instruction address that is assigned to the debug registers.  For
  1819.      the data addresses, DSU facilitates the `watch' command.  However
  1820.      the hardware breakpoint registers can only take two data
  1821.      watchpoints, and both watchpoints must be the same kind.  For
  1822.      example, you can set two watchpoints with `watch' commands, two
  1823.      with `rwatch' commands, *or* two with `awatch' commands, but you
  1824.      cannot set one watchpoint with one command and the other with a
  1825.      different command.  {No Value For "GBDN"} will reject the command
  1826.      if you try to mix watchpoints.  Delete or disable unused
  1827.      watchpoint commands before setting new ones.
  1828.  
  1829. `rwatch EXPR'
  1830.      Set a watchpoint that will break when watch ARGS is read by the
  1831.      program.  If you use both watchpoints, both must be set with the
  1832.      `rwatch' command.
  1833.  
  1834. `awatch EXPR'
  1835.      Set a watchpoint that will break when ARGS is read and written into
  1836.      by the program.  If you use both watchpoints, both must be set
  1837.      with the `awatch' command.
  1838.  
  1839. `info watchpoints'
  1840.      This command prints a list of watchpoints and breakpoints; it is
  1841.      the same as `info break'.
  1842.  
  1843.      *Warning:* in multi-thread programs, watchpoints have only limited
  1844.      usefulness.  With the current watchpoint implementation, GDB can
  1845.      only watch the value of an expression *in a single thread*.  If
  1846.      you are confident that the expression can only change due to the
  1847.      current thread's activity (and if you are also confident that no
  1848.      other thread can become current), then you can use watchpoints as
  1849.      usual.  However, GDB may not notice when a non-current thread's
  1850.      activity changes the expression.
  1851.  
  1852. 
  1853. File: gdb,  Node: Exception Handling,  Next: Delete Breaks,  Prev: Set Watchpoints,  Up: Breakpoints
  1854.  
  1855. Breakpoints and exceptions
  1856. --------------------------
  1857.  
  1858.    Some languages, such as GNU C++, implement exception handling.  You
  1859. can use GDB to examine what caused your program to raise an exception,
  1860. and to list the exceptions your program is prepared to handle at a
  1861. given point in time.
  1862.  
  1863. `catch EXCEPTIONS'
  1864.      You can set breakpoints at active exception handlers by using the
  1865.      `catch' command.  EXCEPTIONS is a list of names of exceptions to
  1866.      catch.
  1867.  
  1868.    You can use `info catch' to list active exception handlers.  *Note
  1869. Information about a frame: Frame Info.
  1870.  
  1871.    There are currently some limitations to exception handling in GDB:
  1872.  
  1873.    * If you call a function interactively, GDB normally returns control
  1874.      to you when the function has finished executing.  If the call
  1875.      raises an exception, however, the call may bypass the mechanism
  1876.      that returns control to you and cause your program to simply
  1877.      continue running until it hits a breakpoint, catches a signal that
  1878.      GDB is listening for, or exits.
  1879.  
  1880.    * You cannot raise an exception interactively.
  1881.  
  1882.    * You cannot install an exception handler interactively.
  1883.  
  1884.    Sometimes `catch' is not the best way to debug exception handling:
  1885. if you need to know exactly where an exception is raised, it is better
  1886. to stop *before* the exception handler is called, since that way you
  1887. can see the stack before any unwinding takes place.  If you set a
  1888. breakpoint in an exception handler instead, it may not be easy to find
  1889. out where the exception was raised.
  1890.  
  1891.    To stop just before an exception handler is called, you need some
  1892. knowledge of the implementation.  In the case of GNU C++, exceptions are
  1893. raised by calling a library function named `__raise_exception' which
  1894. has the following ANSI C interface:
  1895.  
  1896.          /* ADDR is where the exception identifier is stored.
  1897.             ID is the exception identifier.  */
  1898.          void __raise_exception (void **ADDR, void *ID);
  1899.  
  1900. To make the debugger catch all exceptions before any stack unwinding
  1901. takes place, set a breakpoint on `__raise_exception' (*note
  1902. Breakpoints; watchpoints; and exceptions: Breakpoints.).
  1903.  
  1904.    With a conditional breakpoint (*note Break conditions: Conditions.)
  1905. that depends on the value of ID, you can stop your program when a
  1906. specific exception is raised.  You can use multiple conditional
  1907. breakpoints to stop your program when any of a number of exceptions are
  1908. raised.
  1909.  
  1910. 
  1911. File: gdb,  Node: Delete Breaks,  Next: Disabling,  Prev: Exception Handling,  Up: Breakpoints
  1912.  
  1913. Deleting breakpoints
  1914. --------------------
  1915.  
  1916.    It is often necessary to eliminate a breakpoint or watchpoint once it
  1917. has done its job and you no longer want your program to stop there.
  1918. This is called "deleting" the breakpoint.  A breakpoint that has been
  1919. deleted no longer exists; it is forgotten.
  1920.  
  1921.    With the `clear' command you can delete breakpoints according to
  1922. where they are in your program.  With the `delete' command you can
  1923. delete individual breakpoints or watchpoints by specifying their
  1924. breakpoint numbers.
  1925.  
  1926.    It is not necessary to delete a breakpoint to proceed past it.  GDB
  1927. automatically ignores breakpoints on the first instruction to be
  1928. executed when you continue execution without changing the execution
  1929. address.
  1930.  
  1931. `clear'
  1932.      Delete any breakpoints at the next instruction to be executed in
  1933.      the selected stack frame (*note Selecting a frame: Selection.).
  1934.      When the innermost frame is selected, this is a good way to delete
  1935.      a breakpoint where your program just stopped.
  1936.  
  1937. `clear FUNCTION'
  1938. `clear FILENAME:FUNCTION'
  1939.      Delete any breakpoints set at entry to the function FUNCTION.
  1940.  
  1941. `clear LINENUM'
  1942. `clear FILENAME:LINENUM'
  1943.      Delete any breakpoints set at or within the code of the specified
  1944.      line.
  1945.  
  1946. `delete [breakpoints] [BNUMS...]'
  1947.      Delete the breakpoints or watchpoints of the numbers specified as
  1948.      arguments.  If no argument is specified, delete all breakpoints
  1949.      (GDB asks confirmation, unless you have `set confirm off').  You
  1950.      can abbreviate this command as `d'.
  1951.  
  1952. 
  1953. File: gdb,  Node: Disabling,  Next: Conditions,  Prev: Delete Breaks,  Up: Breakpoints
  1954.  
  1955. Disabling breakpoints
  1956. ---------------------
  1957.  
  1958.    Rather than deleting a breakpoint or watchpoint, you might prefer to
  1959. "disable" it.  This makes the breakpoint inoperative as if it had been
  1960. deleted, but remembers the information on the breakpoint so that you
  1961. can "enable" it again later.
  1962.  
  1963.    You disable and enable breakpoints and watchpoints with the `enable'
  1964. and `disable' commands, optionally specifying one or more breakpoint
  1965. numbers as arguments.  Use `info break' or `info watch' to print a list
  1966. of breakpoints or watchpoints if you do not know which numbers to use.
  1967.  
  1968.    A breakpoint or watchpoint can have any of four different states of
  1969. enablement:
  1970.  
  1971.    * Enabled.  The breakpoint stops your program.  A breakpoint set
  1972.      with the `break' command starts out in this state.
  1973.  
  1974.    * Disabled.  The breakpoint has no effect on your program.
  1975.  
  1976.    * Enabled once.  The breakpoint stops your program, but then becomes
  1977.      disabled.  A breakpoint set with the `tbreak' command starts out in
  1978.      this state.
  1979.  
  1980.    * Enabled for deletion.  The breakpoint stops your program, but
  1981.      immediately after it does so it is deleted permanently.
  1982.  
  1983.    You can use the following commands to enable or disable breakpoints
  1984. and watchpoints:
  1985.  
  1986. `disable [breakpoints] [BNUMS...]'
  1987.      Disable the specified breakpoints--or all breakpoints, if none are
  1988.      listed.  A disabled breakpoint has no effect but is not forgotten.
  1989.      All options such as ignore-counts, conditions and commands are
  1990.      remembered in case the breakpoint is enabled again later.  You may
  1991.      abbreviate `disable' as `dis'.
  1992.  
  1993. `enable [breakpoints] [BNUMS...]'
  1994.      Enable the specified breakpoints (or all defined breakpoints).
  1995.      They become effective once again in stopping your program.
  1996.  
  1997. `enable [breakpoints] once BNUMS...'
  1998.      Enable the specified breakpoints temporarily.  GDB disables any of
  1999.      these breakpoints immediately after stopping your program.
  2000.  
  2001. `enable [breakpoints] delete BNUMS...'
  2002.      Enable the specified breakpoints to work once, then die.  GDB
  2003.      deletes any of these breakpoints as soon as your program stops
  2004.      there.
  2005.  
  2006.    Except for a breakpoint set with `tbreak' (*note Setting
  2007. breakpoints: Set Breaks.), breakpoints that you set are initially
  2008. enabled; subsequently, they become disabled or enabled only when you
  2009. use one of the commands above.  (The command `until' can set and delete
  2010. a breakpoint of its own, but it does not change the state of your other
  2011. breakpoints; see *Note Continuing and stepping: Continuing and
  2012. Stepping.)
  2013.  
  2014. 
  2015. File: gdb,  Node: Conditions,  Next: Break Commands,  Prev: Disabling,  Up: Breakpoints
  2016.  
  2017. Break conditions
  2018. ----------------
  2019.  
  2020.    The simplest sort of breakpoint breaks every time your program
  2021. reaches a specified place.  You can also specify a "condition" for a
  2022. breakpoint.  A condition is just a Boolean expression in your
  2023. programming language (*note Expressions: Expressions.).  A breakpoint
  2024. with a condition evaluates the expression each time your program
  2025. reaches it, and your program stops only if the condition is *true*.
  2026.  
  2027.    This is the converse of using assertions for program validation; in
  2028. that situation, you want to stop when the assertion is violated--that
  2029. is, when the condition is false.  In C, if you want to test an
  2030. assertion expressed by the condition ASSERT, you should set the
  2031. condition `! ASSERT' on the appropriate breakpoint.
  2032.  
  2033.    Conditions are also accepted for watchpoints; you may not need them,
  2034. since a watchpoint is inspecting the value of an expression anyhow--but
  2035. it might be simpler, say, to just set a watchpoint on a variable name,
  2036. and specify a condition that tests whether the new value is an
  2037. interesting one.
  2038.  
  2039.    Break conditions can have side effects, and may even call functions
  2040. in your program.  This can be useful, for example, to activate functions
  2041. that log program progress, or to use your own print functions to format
  2042. special data structures. The effects are completely predictable unless
  2043. there is another enabled breakpoint at the same address.  (In that
  2044. case, GDB might see the other breakpoint first and stop your program
  2045. without checking the condition of this one.)  Note that breakpoint
  2046. commands are usually more convenient and flexible for the purpose of
  2047. performing side effects when a breakpoint is reached (*note Breakpoint
  2048. command lists: Break Commands.).
  2049.  
  2050.    Break conditions can be specified when a breakpoint is set, by using
  2051. `if' in the arguments to the `break' command.  *Note Setting
  2052. breakpoints: Set Breaks.  They can also be changed at any time with the
  2053. `condition' command.  The `watch' command does not recognize the `if'
  2054. keyword; `condition' is the only way to impose a further condition on a
  2055. watchpoint.
  2056.  
  2057. `condition BNUM EXPRESSION'
  2058.      Specify EXPRESSION as the break condition for breakpoint or
  2059.      watchpoint number BNUM.  After you set a condition, breakpoint
  2060.      BNUM stops your program only if the value of EXPRESSION is true
  2061.      (nonzero, in C).  When you use `condition', GDB checks EXPRESSION
  2062.      immediately for syntactic correctness, and to determine whether
  2063.      symbols in it have referents in the context of your breakpoint.
  2064.      GDB does not actually evaluate EXPRESSION at the time the
  2065.      `condition' command is given, however.  *Note Expressions:
  2066.      Expressions.
  2067.  
  2068. `condition BNUM'
  2069.      Remove the condition from breakpoint number BNUM.  It becomes an
  2070.      ordinary unconditional breakpoint.
  2071.  
  2072.    A special case of a breakpoint condition is to stop only when the
  2073. breakpoint has been reached a certain number of times.  This is so
  2074. useful that there is a special way to do it, using the "ignore count"
  2075. of the breakpoint.  Every breakpoint has an ignore count, which is an
  2076. integer.  Most of the time, the ignore count is zero, and therefore has
  2077. no effect.  But if your program reaches a breakpoint whose ignore count
  2078. is positive, then instead of stopping, it just decrements the ignore
  2079. count by one and continues.  As a result, if the ignore count value is
  2080. N, the breakpoint does not stop the next N times your program reaches
  2081. it.
  2082.  
  2083. `ignore BNUM COUNT'
  2084.      Set the ignore count of breakpoint number BNUM to COUNT.  The next
  2085.      COUNT times the breakpoint is reached, your program's execution
  2086.      does not stop; other than to decrement the ignore count, GDB takes
  2087.      no action.
  2088.  
  2089.      To make the breakpoint stop the next time it is reached, specify a
  2090.      count of zero.
  2091.  
  2092.      When you use `continue' to resume execution of your program from a
  2093.      breakpoint, you can specify an ignore count directly as an
  2094.      argument to `continue', rather than using `ignore'.  *Note
  2095.      Continuing and stepping: Continuing and Stepping.
  2096.  
  2097.      If a breakpoint has a positive ignore count and a condition, the
  2098.      condition is not checked.  Once the ignore count reaches zero, GDB
  2099.      resumes checking the condition.
  2100.  
  2101.      You could achieve the effect of the ignore count with a condition
  2102.      such as `$foo-- <= 0' using a debugger convenience variable that
  2103.      is decremented each time.  *Note Convenience variables:
  2104.      Convenience Vars.
  2105.  
  2106. 
  2107. File: gdb,  Node: Break Commands,  Next: Breakpoint Menus,  Prev: Conditions,  Up: Breakpoints
  2108.  
  2109. Breakpoint command lists
  2110. ------------------------
  2111.  
  2112.    You can give any breakpoint (or watchpoint) a series of commands to
  2113. execute when your program stops due to that breakpoint.  For example,
  2114. you might want to print the values of certain expressions, or enable
  2115. other breakpoints.
  2116.  
  2117. `commands [BNUM]'
  2118. `... COMMAND-LIST ...'
  2119. `end'
  2120.      Specify a list of commands for breakpoint number BNUM.  The
  2121.      commands themselves appear on the following lines.  Type a line
  2122.      containing just `end' to terminate the commands.
  2123.  
  2124.      To remove all commands from a breakpoint, type `commands' and
  2125.      follow it immediately with `end'; that is, give no commands.
  2126.  
  2127.      With no BNUM argument, `commands' refers to the last breakpoint or
  2128.      watchpoint set (not to the breakpoint most recently encountered).
  2129.  
  2130.    Pressing RET as a means of repeating the last GDB command is
  2131. disabled within a COMMAND-LIST.
  2132.  
  2133.    You can use breakpoint commands to start your program up again.
  2134. Simply use the `continue' command, or `step', or any other command that
  2135. resumes execution.
  2136.  
  2137.    Any other commands in the command list, after a command that resumes
  2138. execution, are ignored.  This is because any time you resume execution
  2139. (even with a simple `next' or `step'), you may encounter another
  2140. breakpoint--which could have its own command list, leading to
  2141. ambiguities about which list to execute.
  2142.  
  2143.    If the first command you specify in a command list is `silent', the
  2144. usual message about stopping at a breakpoint is not printed.  This may
  2145. be desirable for breakpoints that are to print a specific message and
  2146. then continue.  If none of the remaining commands print anything, you
  2147. see no sign that the breakpoint was reached.  `silent' is meaningful
  2148. only at the beginning of a breakpoint command list.
  2149.  
  2150.    The commands `echo', `output', and `printf' allow you to print
  2151. precisely controlled output, and are often useful in silent
  2152. breakpoints.  *Note Commands for controlled output: Output.
  2153.  
  2154.    For example, here is how you could use breakpoint commands to print
  2155. the value of `x' at entry to `foo' whenever `x' is positive.
  2156.  
  2157.      break foo if x>0
  2158.      commands
  2159.      silent
  2160.      printf "x is %d\n",x
  2161.      cont
  2162.      end
  2163.  
  2164.    One application for breakpoint commands is to compensate for one bug
  2165. so you can test for another.  Put a breakpoint just after the erroneous
  2166. line of code, give it a condition to detect the case in which something
  2167. erroneous has been done, and give it commands to assign correct values
  2168. to any variables that need them.  End with the `continue' command so
  2169. that your program does not stop, and start with the `silent' command so
  2170. that no output is produced.  Here is an example:
  2171.  
  2172.      break 403
  2173.      commands
  2174.      silent
  2175.      set x = y + 4
  2176.      cont
  2177.      end
  2178.  
  2179. 
  2180. File: gdb,  Node: Breakpoint Menus,  Prev: Break Commands,  Up: Breakpoints
  2181.  
  2182. Breakpoint menus
  2183. ----------------
  2184.  
  2185.    Some programming languages (notably C++) permit a single function
  2186. name to be defined several times, for application in different contexts.
  2187. This is called "overloading".  When a function name is overloaded,
  2188. `break FUNCTION' is not enough to tell GDB where you want a breakpoint.
  2189. If you realize this is a problem, you can use something like `break
  2190. FUNCTION(TYPES)' to specify which particular version of the function
  2191. you want.  Otherwise, GDB offers you a menu of numbered choices for
  2192. different possible breakpoints, and waits for your selection with the
  2193. prompt `>'.  The first two options are always `[0] cancel' and `[1]
  2194. all'.  Typing `1' sets a breakpoint at each definition of FUNCTION, and
  2195. typing `0' aborts the `break' command without setting any new
  2196. breakpoints.
  2197.  
  2198.    For example, the following session excerpt shows an attempt to set a
  2199. breakpoint at the overloaded symbol `String::after'.  We choose three
  2200. particular definitions of that function name:
  2201.  
  2202.      (gdb) b String::after
  2203.      [0] cancel
  2204.      [1] all
  2205.      [2] file:String.cc; line number:867
  2206.      [3] file:String.cc; line number:860
  2207.      [4] file:String.cc; line number:875
  2208.      [5] file:String.cc; line number:853
  2209.      [6] file:String.cc; line number:846
  2210.      [7] file:String.cc; line number:735
  2211.      > 2 4 6
  2212.      Breakpoint 1 at 0xb26c: file String.cc, line 867.
  2213.      Breakpoint 2 at 0xb344: file String.cc, line 875.
  2214.      Breakpoint 3 at 0xafcc: file String.cc, line 846.
  2215.      Multiple breakpoints were set.
  2216.      Use the "delete" command to delete unwanted
  2217.       breakpoints.
  2218.      (gdb)
  2219.  
  2220. 
  2221. File: gdb,  Node: Continuing and Stepping,  Next: Signals,  Prev: Breakpoints,  Up: Stopping
  2222.  
  2223. Continuing and stepping
  2224. =======================
  2225.  
  2226.    "Continuing" means resuming program execution until your program
  2227. completes normally.  In contrast, "stepping" means executing just one
  2228. more "step" of your program, where "step" may mean either one line of
  2229. source code, or one machine instruction (depending on what particular
  2230. command you use).  Either when continuing or when stepping, your
  2231. program may stop even sooner, due to a breakpoint or a signal.  (If due
  2232. to a signal, you may want to use `handle', or use `signal 0' to resume
  2233. execution.  *Note Signals: Signals.)
  2234.  
  2235. `continue [IGNORE-COUNT]'
  2236. `c [IGNORE-COUNT]'
  2237. `fg [IGNORE-COUNT]'
  2238.      Resume program execution, at the address where your program last
  2239.      stopped; any breakpoints set at that address are bypassed.  The
  2240.      optional argument IGNORE-COUNT allows you to specify a further
  2241.      number of times to ignore a breakpoint at this location; its
  2242.      effect is like that of `ignore' (*note Break conditions:
  2243.      Conditions.).
  2244.  
  2245.      The argument IGNORE-COUNT is meaningful only when your program
  2246.      stopped due to a breakpoint.  At other times, the argument to
  2247.      `continue' is ignored.
  2248.  
  2249.      The synonyms `c' and `fg' are provided purely for convenience, and
  2250.      have exactly the same behavior as `continue'.
  2251.  
  2252.    To resume execution at a different place, you can use `return'
  2253. (*note Returning from a function: Returning.) to go back to the calling
  2254. function; or `jump' (*note Continuing at a different address: Jumping.)
  2255. to go to an arbitrary location in your program.
  2256.  
  2257.    A typical technique for using stepping is to set a breakpoint (*note
  2258. Breakpoints; watchpoints; and exceptions: Breakpoints.) at the
  2259. beginning of the function or the section of your program where a
  2260. problem is believed to lie, run your program until it stops at that
  2261. breakpoint, and then step through the suspect area, examining the
  2262. variables that are interesting, until you see the problem happen.
  2263.  
  2264. `step'
  2265.      Continue running your program until control reaches a different
  2266.      source line, then stop it and return control to GDB.  This command
  2267.      is abbreviated `s'.
  2268.  
  2269.           *Warning:* If you use the `step' command while control is
  2270.           within a function that was compiled without debugging
  2271.           information, execution proceeds until control reaches a
  2272.           function that does have debugging information.  Likewise, it
  2273.           will not step into a function which is compiled without
  2274.           debugging information.  To step through functions without
  2275.           debugging information, use the `stepi' command, described
  2276.           below.
  2277.  
  2278.      The `step' command now only stops at the first instruction of a
  2279.      source line.  This prevents the multiple stops that used to occur
  2280.      in switch statements, for loops, etc.  `step' continues to stop if
  2281.      a function that has debugging information is called within the
  2282.      line.
  2283.  
  2284.      Also, the `step' command now only enters a subroutine if there is
  2285.      line number information for the subroutine.  Otherwise it acts
  2286.      like the `next' command.  This avoids problems when using `cc -gl'
  2287.      on MIPS machines.  Previously, `step' entered subroutines if there
  2288.      was any debugging information about the routine.
  2289.  
  2290. `step COUNT'
  2291.      Continue running as in `step', but do so COUNT times.  If a
  2292.      breakpoint is reached, or a signal not related to stepping occurs
  2293.      before COUNT steps, stepping stops right away.
  2294.  
  2295. `next [COUNT]'
  2296.      Continue to the next source line in the current (innermost) stack
  2297.      frame.  This is similar to `step', but function calls that appear
  2298.      within the line of code are executed without stopping.  Execution
  2299.      stops when control reaches a different line of code at the
  2300.      original stack level that was executing when you gave the `next'
  2301.      command.  This command is abbreviated `n'.
  2302.  
  2303.      An argument COUNT is a repeat count, as for `step'.
  2304.  
  2305.      The `next' command now only stops at the first instruction of a
  2306.      source line.  This prevents the multiple stops that used to occur
  2307.      in swtch statements, for loops, etc.
  2308.  
  2309. `finish'
  2310.      Continue running until just after function in the selected stack
  2311.      frame returns.  Print the returned value (if any).
  2312.  
  2313.      Contrast this with the `return' command (*note Returning from a
  2314.      function: Returning.).
  2315.  
  2316. `u'
  2317. `until'
  2318.      Continue running until a source line past the current line, in the
  2319.      current stack frame, is reached.  This command is used to avoid
  2320.      single stepping through a loop more than once.  It is like the
  2321.      `next' command, except that when `until' encounters a jump, it
  2322.      automatically continues execution until the program counter is
  2323.      greater than the address of the jump.
  2324.  
  2325.      This means that when you reach the end of a loop after single
  2326.      stepping though it, `until' makes your program continue execution
  2327.      until it exits the loop.  In contrast, a `next' command at the end
  2328.      of a loop simply steps back to the beginning of the loop, which
  2329.      forces you to step through the next iteration.
  2330.  
  2331.      `until' always stops your program if it attempts to exit the
  2332.      current stack frame.
  2333.  
  2334.      `until' may produce somewhat counterintuitive results if the order
  2335.      of machine code does not match the order of the source lines.  For
  2336.      example, in the following excerpt from a debugging session, the `f'
  2337.      (`frame') command shows that execution is stopped at line `206';
  2338.      yet when we use `until', we get to line `195':
  2339.  
  2340.           (gdb) f
  2341.           #0  main (argc=4, argv=0xf7fffae8) at m4.c:206
  2342.           206                 expand_input();
  2343.           (gdb) until
  2344.           195             for ( ; argc > 0; NEXTARG) {
  2345.  
  2346.      This happened because, for execution efficiency, the compiler had
  2347.      generated code for the loop closure test at the end, rather than
  2348.      the start, of the loop--even though the test in a C `for'-loop is
  2349.      written before the body of the loop.  The `until' command appeared
  2350.      to step back to the beginning of the loop when it advanced to this
  2351.      expression; however, it has not really gone to an earlier
  2352.      statement--not in terms of the actual machine code.
  2353.  
  2354.      `until' with no argument works by means of single instruction
  2355.      stepping, and hence is slower than `until' with an argument.
  2356.  
  2357. `until LOCATION'
  2358. `u LOCATION'
  2359.      Continue running your program until either the specified location
  2360.      is reached, or the current stack frame returns.  LOCATION is any of
  2361.      the forms of argument acceptable to `break' (*note Setting
  2362.      breakpoints: Set Breaks.).  This form of the command uses
  2363.      breakpoints, and hence is quicker than `until' without an argument.
  2364.  
  2365. `stepi'
  2366. `si'
  2367.      Execute one machine instruction, then stop and return to the
  2368.      debugger.
  2369.  
  2370.      It is often useful to do `display/i $pc' when stepping by machine
  2371.      instructions.  This makes GDB automatically display the next
  2372.      instruction to be executed, each time your program stops.  *Note
  2373.      Automatic display: Auto Display.
  2374.  
  2375.      An argument is a repeat count, as in `step'.
  2376.  
  2377. `nexti'
  2378. `ni'
  2379.      Execute one machine instruction, but if it is a function call,
  2380.      proceed until the function returns.
  2381.  
  2382.      An argument is a repeat count, as in `next'.
  2383.  
  2384. 
  2385. File: gdb,  Node: Signals,  Next: Thread Stops,  Prev: Continuing and Stepping,  Up: Stopping
  2386.  
  2387. Signals
  2388. =======
  2389.  
  2390.    A signal is an asynchronous event that can happen in a program.  The
  2391. operating system defines the possible kinds of signals, and gives each
  2392. kind a name and a number.  For example, in Unix `SIGINT' is the signal
  2393. a program gets when you type an interrupt (often `C-c'); `SIGSEGV' is
  2394. the signal a program gets from referencing a place in memory far away
  2395. from all the areas in use; `SIGALRM' occurs when the alarm clock timer
  2396. goes off (which happens only if your program has requested an alarm).
  2397.  
  2398.    Some signals, including `SIGALRM', are a normal part of the
  2399. functioning of your program.  Others, such as `SIGSEGV', indicate
  2400. errors; these signals are "fatal" (kill your program immediately) if the
  2401. program has not specified in advance some other way to handle the
  2402. signal.  `SIGINT' does not indicate an error in your program, but it is
  2403. normally fatal so it can carry out the purpose of the interrupt: to
  2404. kill the program.
  2405.  
  2406.    GDB has the ability to detect any occurrence of a signal in your
  2407. program.  You can tell GDB in advance what to do for each kind of
  2408. signal.
  2409.  
  2410.    Normally, GDB is set up to ignore non-erroneous signals like
  2411. `SIGALRM' (so as not to interfere with their role in the functioning of
  2412. your program) but to stop your program immediately whenever an error
  2413. signal happens.  You can change these settings with the `handle'
  2414. command.
  2415.  
  2416. `info signals'
  2417.      Print a table of all the kinds of signals and how GDB has been
  2418.      told to handle each one.  You can use this to see the signal
  2419.      numbers of all the defined types of signals.
  2420.  
  2421.      `info handle' is the new alias for `info signals'.
  2422.  
  2423. `handle SIGNAL KEYWORDS...'
  2424.      Change the way GDB handles signal SIGNAL.  SIGNAL can be the
  2425.      number of a signal or its name (with or without the `SIG' at the
  2426.      beginning).  The KEYWORDS say what change to make.
  2427.  
  2428.    The keywords allowed by the `handle' command can be abbreviated.
  2429. Their full names are:
  2430.  
  2431. `nostop'
  2432.      GDB should not stop your program when this signal happens.  It may
  2433.      still print a message telling you that the signal has come in.
  2434.  
  2435. `stop'
  2436.      GDB should stop your program when this signal happens.  This
  2437.      implies the `print' keyword as well.
  2438.  
  2439. `print'
  2440.      GDB should print a message when this signal happens.
  2441.  
  2442. `noprint'
  2443.      GDB should not mention the occurrence of the signal at all.  This
  2444.      implies the `nostop' keyword as well.
  2445.  
  2446. `pass'
  2447.      GDB should allow your program to see this signal; your program can
  2448.      handle the signal, or else it may terminate if the signal is fatal
  2449.      and not handled.
  2450.  
  2451. `nopass'
  2452.      GDB should not allow your program to see this signal.
  2453.  
  2454.    When a signal stops your program, the signal is not visible until you
  2455. continue.  Your program sees the signal then, if `pass' is in effect
  2456. for the signal in question *at that time*.  In other words, after GDB
  2457. reports a signal, you can use the `handle' command with `pass' or
  2458. `nopass' to control whether your program sees that signal when you
  2459. continue.
  2460.  
  2461.    You can also use the `signal' command to prevent your program from
  2462. seeing a signal, or cause it to see a signal it normally would not see,
  2463. or to give it any signal at any time.  For example, if your program
  2464. stopped due to some sort of memory reference error, you might store
  2465. correct values into the erroneous variables and continue, hoping to see
  2466. more execution; but your program would probably terminate immediately as
  2467. a result of the fatal signal once it saw the signal.  To prevent this,
  2468. you can continue with `signal 0'.  *Note Giving your program a signal:
  2469. Signaling.
  2470.  
  2471. 
  2472. File: gdb,  Node: Thread Stops,  Prev: Signals,  Up: Stopping
  2473.  
  2474. Stopping and starting multi-thread programs
  2475. ===========================================
  2476.  
  2477.    When your program has multiple threads (*note Debugging programs
  2478. with multiple threads: Threads.), you can choose whether to set
  2479. breakpoints on all threads, or on a particular thread.
  2480.  
  2481. `break LINESPEC thread THREADNO'
  2482. `break LINESPEC thread THREADNO if ...'
  2483.      LINESPEC specifies source lines; there are several ways of writing
  2484.      them, but the effect is always to specify some source line.
  2485.  
  2486.      Use the qualifier `thread THREADNO' with a breakpoint command to
  2487.      specify that you only want GDB to stop the program when a
  2488.      particular thread reaches this breakpoint.  THREADNO is one of the
  2489.      numeric thread identifiers assigned by GDB, shown in the first
  2490.      column of the `info threads' display.
  2491.  
  2492.      If you do not specify `thread THREADNO' when you set a breakpoint,
  2493.      the breakpoint applies to *all* threads of your program.
  2494.  
  2495.      You can use the `thread' qualifier on conditional breakpoints as
  2496.      well; in this case, place `thread THREADNO' before the breakpoint
  2497.      condition, like this:
  2498.  
  2499.           (gdb) break frik.c:13 thread 28 if bartab > lim
  2500.  
  2501.    Whenever your program stops under GDB for any reason, *all* threads
  2502. of execution stop, not just the current thread.  This allows you to
  2503. examine the overall state of the program, including switching between
  2504. threads, without worrying that things may change underfoot.
  2505.  
  2506.    Conversely, whenever you restart the program, *all* threads start
  2507. executing.  *This is true even when single-stepping* with commands like
  2508. `step' or `next'.
  2509.  
  2510.    In particular, GDB cannot single-step all threads in lockstep.
  2511. Since thread scheduling is up to your debugging target's operating
  2512. system (not controlled by GDB), other threads may execute more than one
  2513. statement while the current thread completes a single step.  Moreover,
  2514. in general other threads stop in the middle of a statement, rather than
  2515. at a clean statement boundary, when the program stops.
  2516.  
  2517.    You might even find your program stopped in another thread after
  2518. continuing or even single-stepping.  This happens whenever some other
  2519. thread runs into a breakpoint, a signal, or an exception before the
  2520. first thread completes whatever you requested.
  2521.  
  2522. 
  2523. File: gdb,  Node: Stack,  Next: Source,  Prev: Stopping,  Up: Top
  2524.  
  2525. Examining the Stack
  2526. *******************
  2527.  
  2528.    When your program has stopped, the first thing you need to know is
  2529. where it stopped and how it got there.
  2530.  
  2531.    Each time your program performs a function call, information about
  2532. the call is generated.  That information includes the location of the
  2533. call in your program, the arguments of the call, and the local
  2534. variables of the function being called.  The information is saved in a
  2535. block of data called a "stack frame".  The stack frames are allocated
  2536. in a region of memory called the "call stack".
  2537.  
  2538.    When your program stops, the GDB commands for examining the stack
  2539. allow you to see all of this information.
  2540.  
  2541.    One of the stack frames is "selected" by GDB and many GDB commands
  2542. refer implicitly to the selected frame.  In particular, whenever you
  2543. ask GDB for the value of a variable in your program, the value is found
  2544. in the selected frame.  There are special GDB commands to select
  2545. whichever frame you are interested in. *Note Selecting a frame:
  2546. Selection.
  2547.  
  2548.    When your program stops, GDB automatically selects the currently
  2549. executing frame and describes it briefly, similar to the `frame'
  2550. command (*note Information about a frame: Frame Info.).
  2551.  
  2552. * Menu:
  2553.  
  2554. * Frames::                      Stack frames
  2555. * Backtrace::                   Backtraces
  2556. * Selection::                   Selecting a frame
  2557. * Frame Info::                  Information on a frame
  2558.  
  2559. * MIPS Stack::                  MIPS machines and the function stack
  2560.  
  2561. 
  2562. File: gdb,  Node: Frames,  Next: Backtrace,  Up: Stack
  2563.  
  2564. Stack frames
  2565. ============
  2566.  
  2567.    The call stack is divided up into contiguous pieces called "stack
  2568. frames", or "frames" for short; each frame is the data associated with
  2569. one call to one function.  The frame contains the arguments given to
  2570. the function, the function's local variables, and the address at which
  2571. the function is executing.
  2572.  
  2573.    When your program is started, the stack has only one frame, that of
  2574. the function `main'.  This is called the "initial" frame or the
  2575. "outermost" frame.  Each time a function is called, a new frame is
  2576. made.  Each time a function returns, the frame for that function
  2577. invocation is eliminated.  If a function is recursive, there can be
  2578. many frames for the same function.  The frame for the function in which
  2579. execution is actually occurring is called the "innermost" frame.  This
  2580. is the most recently created of all the stack frames that still exist.
  2581.  
  2582.    Inside your program, stack frames are identified by their addresses.
  2583. A stack frame consists of many bytes, each of which has its own
  2584. address; each kind of computer has a convention for choosing one byte
  2585. whose address serves as the address of the frame.  Usually this address
  2586. is kept in a register called the "frame pointer register" while
  2587. execution is going on in that frame.
  2588.  
  2589.    GDB assigns numbers to all existing stack frames, starting with zero
  2590. for the innermost frame, one for the frame that called it, and so on
  2591. upward.  These numbers do not really exist in your program; they are
  2592. assigned by GDB to give you a way of designating stack frames in GDB
  2593. commands.
  2594.  
  2595.    Some compilers provide a way to compile functions so that they
  2596. operate without stack frames.  (For example, the `gcc' option
  2597. `-fomit-frame-pointer' generates functions without a frame.) This is
  2598. occasionally done with heavily used library functions to save the frame
  2599. setup time.  GDB has limited facilities for dealing with these function
  2600. invocations.  If the innermost function invocation has no stack frame,
  2601. GDB nevertheless regards it as though it had a separate frame, which is
  2602. numbered zero as usual, allowing correct tracing of the function call
  2603. chain.  However, GDB has no provision for frameless functions elsewhere
  2604. in the stack.
  2605.  
  2606. `frame ARGS'
  2607.      The `frame' command allows you to move from one stack frame to
  2608.      another, and to print the stack frame you select.  ARGS may be
  2609.      either the address of the frame of the stack frame number.
  2610.      Without an argument, `frame' prints the current stack frame.
  2611.  
  2612. `select-frame'
  2613.      The `select-frame' command allows you to move from one stack frame
  2614.      to another without printing the frame.  This is the silent version
  2615.      of `frame'.
  2616.  
  2617. 
  2618. File: gdb,  Node: Backtrace,  Next: Selection,  Prev: Frames,  Up: Stack
  2619.  
  2620. Backtraces
  2621. ==========
  2622.  
  2623.    A backtrace is a summary of how your program got where it is.  It
  2624. shows one line per frame, for many frames, starting with the currently
  2625. executing frame (frame zero), followed by its caller (frame one), and
  2626. on up the stack.
  2627.  
  2628. `backtrace'
  2629. `bt'
  2630.      Print a backtrace of the entire stack: one line per frame for all
  2631.      frames in the stack.
  2632.  
  2633.      You can stop the backtrace at any time by typing the system
  2634.      interrupt character, normally `C-c'.
  2635.  
  2636. `backtrace N'
  2637. `bt N'
  2638.      Similar, but print only the innermost N frames.
  2639.  
  2640. `backtrace -N'
  2641. `bt -N'
  2642.      Similar, but print only the outermost N frames.
  2643.  
  2644.    The names `where' and `info stack' (abbreviated `info s') are
  2645. additional aliases for `backtrace'.
  2646.  
  2647.    Each line in the backtrace shows the frame number and the function
  2648. name.  The program counter value is also shown--unless you use `set
  2649. print address off'.  The backtrace also shows the source file name and
  2650. line number, as well as the arguments to the function.  The program
  2651. counter value is omitted if it is at the beginning of the code for that
  2652. line number.
  2653.  
  2654.    Here is an example of a backtrace.  It was made with the command `bt
  2655. 3', so it shows the innermost three frames.
  2656.  
  2657.      #0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  2658.          at builtin.c:993
  2659.      #1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
  2660.      #2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  2661.          at macro.c:71
  2662.      (More stack frames follow...)
  2663.  
  2664. The display for frame zero does not begin with a program counter value,
  2665. indicating that your program has stopped at the beginning of the code
  2666. for line `993' of `builtin.c'.
  2667.  
  2668. 
  2669. File: gdb,  Node: Selection,  Next: Frame Info,  Prev: Backtrace,  Up: Stack
  2670.  
  2671. Selecting a frame
  2672. =================
  2673.  
  2674.    Most commands for examining the stack and other data in your program
  2675. work on whichever stack frame is selected at the moment.  Here are the
  2676. commands for selecting a stack frame; all of them finish by printing a
  2677. brief description of the stack frame just selected.
  2678.  
  2679. `frame N'
  2680. `f N'
  2681.      Select frame number N.  Recall that frame zero is the innermost
  2682.      (currently executing) frame, frame one is the frame that called the
  2683.      innermost one, and so on.  The highest-numbered frame is the one
  2684.      for `main'.
  2685.  
  2686. `frame ADDR'
  2687. `f ADDR'
  2688.      Select the frame at address ADDR.  This is useful mainly if the
  2689.      chaining of stack frames has been damaged by a bug, making it
  2690.      impossible for GDB to assign numbers properly to all frames.  In
  2691.      addition, this can be useful when your program has multiple stacks
  2692.      and switches between them.
  2693.  
  2694.      On the SPARC architecture, `frame' needs two addresses to select
  2695.      an arbitrary frame: a frame pointer and a stack pointer.
  2696.  
  2697.      On the MIPS and Alpha architecture, it needs two addresses: a stack
  2698.      pointer and a program counter.
  2699.  
  2700.      On the 29k architecture, it needs three addresses: a register stack
  2701.      pointer, a program counter, and a memory stack pointer.
  2702.  
  2703. `up N'
  2704.      Move N frames up the stack.  For positive numbers N, this advances
  2705.      toward the outermost frame, to higher frame numbers, to frames
  2706.      that have existed longer.  N defaults to one.
  2707.  
  2708. `down N'
  2709.      Move N frames down the stack.  For positive numbers N, this
  2710.      advances toward the innermost frame, to lower frame numbers, to
  2711.      frames that were created more recently.  N defaults to one.  You
  2712.      may abbreviate `down' as `do'.
  2713.  
  2714.    All of these commands end by printing two lines of output describing
  2715. the frame.  The first line shows the frame number, the function name,
  2716. the arguments, and the source file and line number of execution in that
  2717. frame.  The second line shows the text of that source line.
  2718.  
  2719.    For example:
  2720.  
  2721.      (gdb) up
  2722.      #1  0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc)
  2723.          at env.c:10
  2724.      10              read_input_file (argv[i]);
  2725.  
  2726.    After such a printout, the `list' command with no arguments prints
  2727. ten lines centered on the point of execution in the frame.  *Note
  2728. Printing source lines: List.
  2729.  
  2730. `up-silently N'
  2731. `down-silently N'
  2732.      These two commands are variants of `up' and `down', respectively;
  2733.      they differ in that they do their work silently, without causing
  2734.      display of the new frame.  They are intended primarily for use in
  2735.      GDB command scripts, where the output might be unnecessary and
  2736.      distracting.
  2737.  
  2738. 
  2739. File: gdb,  Node: Frame Info,  Next: MIPS Stack,  Prev: Selection,  Up: Stack
  2740.  
  2741. Information about a frame
  2742. =========================
  2743.  
  2744.    There are several other commands to print information about the
  2745. selected stack frame.
  2746.  
  2747. `frame'
  2748. `f'
  2749.      When used without any argument, this command does not change which
  2750.      frame is selected, but prints a brief description of the currently
  2751.      selected stack frame.  It can be abbreviated `f'.  With an
  2752.      argument, this command is used to select a stack frame.  *Note
  2753.      Selecting a frame: Selection.
  2754.  
  2755. `info frame'
  2756. `info f'
  2757.      This command prints a verbose description of the selected stack
  2758.      frame, including:
  2759.  
  2760.         * the address of the frame
  2761.  
  2762.         * the address of the next frame down (called by this frame)
  2763.  
  2764.         * the address of the next frame up (caller of this frame)
  2765.  
  2766.         * the language in which the source code corresponding to this
  2767.           frame is written
  2768.  
  2769.         * the address of the frame's arguments
  2770.  
  2771.         * the program counter saved in it (the address of execution in
  2772.           the caller frame)
  2773.  
  2774.         * which registers were saved in the frame
  2775.  
  2776.      The verbose description is useful when something has gone wrong
  2777.      that has made the stack format fail to fit the usual conventions.
  2778.  
  2779. `info frame ADDR'
  2780. `info f ADDR'
  2781.      Print a verbose description of the frame at address ADDR, without
  2782.      selecting that frame.  The selected frame remains unchanged by this
  2783.      command.  This requires the same kind of address (more than one
  2784.      for some architectures) that you specify in the `frame' command.
  2785.      *Note Selecting a frame: Selection.
  2786.  
  2787. `info args'
  2788.      Print the arguments of the selected frame, each on a separate line.
  2789.  
  2790. `info locals'
  2791.      Print the local variables of the selected frame, each on a separate
  2792.      line.  These are all variables (declared either static or
  2793.      automatic) accessible at the point of execution of the selected
  2794.      frame.
  2795.  
  2796. `info catch'
  2797.      Print a list of all the exception handlers that are active in the
  2798.      current stack frame at the current point of execution.  To see
  2799.      other exception handlers, visit the associated frame (using the
  2800.      `up', `down', or `frame' commands); then type `info catch'.  *Note
  2801.      Breakpoints and exceptions: Exception Handling.
  2802.  
  2803. 
  2804. File: gdb,  Node: MIPS Stack,  Prev: Frame Info,  Up: Stack
  2805.  
  2806. MIPS machines and the function stack
  2807. ====================================
  2808.  
  2809.    MIPS based computers use an unusual stack frame, which sometimes
  2810. requires GDB to search backward in the object code to find the
  2811. beginning of a function.
  2812.  
  2813.    To improve response time (especially for embedded applications, where
  2814. GDB may be restricted to a slow serial line for this search) you may
  2815. want to limit the size of this search, using one of these commands:
  2816.  
  2817. `set heuristic-fence-post LIMIT'
  2818.      Restrict GDB to examining at most LIMIT bytes in its search for
  2819.      the beginning of a function.  A value of 0 (the default) means
  2820.      there is no limit.  However, except for 0, the larger the limit
  2821.      the more bytes `heuristic-fence-post' must search and therefore
  2822.      the longer it takes to run.
  2823.  
  2824. `show heuristic-fence-post'
  2825.      Display the current limit.
  2826.  
  2827. These commands are available *only* when GDB is configured for
  2828. debugging programs on MIPS processors.
  2829.  
  2830. 
  2831. File: gdb,  Node: Source,  Next: Data,  Prev: Stack,  Up: Top
  2832.  
  2833. Examining Source Files
  2834. **********************
  2835.  
  2836.    GDB can print parts of your program's source, since the debugging
  2837. information recorded in the program tells GDB what source files were
  2838. used to build it.  When your program stops, GDB spontaneously prints
  2839. the line where it stopped.  Likewise, when you select a stack frame
  2840. (*note Selecting a frame: Selection.), GDB prints the line where
  2841. execution in that frame has stopped.  You can print other portions of
  2842. source files by explicit command.
  2843.  
  2844.    If you use GDB through its GNU Emacs interface, you may prefer to use
  2845. Emacs facilities to view source; *note Using GDB under GNU Emacs:
  2846. Emacs..
  2847.  
  2848. * Menu:
  2849.  
  2850. * List::                        Printing source lines
  2851.  
  2852. * Search::                      Searching source files
  2853.  
  2854. * Source Path::                 Specifying source directories
  2855. * Machine Code::                Source and machine code
  2856.  
  2857. 
  2858. File: gdb,  Node: List,  Next: Search,  Up: Source
  2859.  
  2860. Printing source lines
  2861. =====================
  2862.  
  2863.    To print lines from a source file, use the `list' command
  2864. (abbreviated `l').  By default, ten lines are printed.  There are
  2865. several ways to specify what part of the file you want to print.
  2866.  
  2867.    Here are the forms of the `list' command most commonly used:
  2868.  
  2869. `list LINENUM'
  2870.      Print lines centered around line number LINENUM in the current
  2871.      source file.
  2872.  
  2873. `list FUNCTION'
  2874.      Print lines centered around the beginning of function FUNCTION.
  2875.  
  2876. `list'
  2877.      Print more lines.  If the last lines printed were printed with a
  2878.      `list' command, this prints lines following the last lines
  2879.      printed; however, if the last line printed was a solitary line
  2880.      printed as part of displaying a stack frame (*note Examining the
  2881.      Stack: Stack.), this prints lines centered around that line.
  2882.  
  2883. `list -'
  2884.      Print lines just before the lines last printed.
  2885.  
  2886.    By default, GDB prints ten source lines with any of these forms of
  2887. the `list' command.  You can change this using `set listsize':
  2888.  
  2889. `set listsize COUNT'
  2890.      Make the `list' command display COUNT source lines (unless the
  2891.      `list' argument explicitly specifies some other number).
  2892.  
  2893. `show listsize'
  2894.      Display the number of lines that `list' prints.
  2895.  
  2896.    Repeating a `list' command with RET discards the argument, so it is
  2897. equivalent to typing just `list'.  This is more useful than listing the
  2898. same lines again.  An exception is made for an argument of `-'; that
  2899. argument is preserved in repetition so that each repetition moves up in
  2900. the source file.
  2901.  
  2902.    In general, the `list' command expects you to supply zero, one or two
  2903. "linespecs".  Linespecs specify source lines; there are several ways of
  2904. writing them but the effect is always to specify some source line.
  2905. Here is a complete description of the possible arguments for `list':
  2906.  
  2907. `list LINESPEC'
  2908.      Print lines centered around the line specified by LINESPEC.
  2909.  
  2910. `list FIRST,LAST'
  2911.      Print lines from FIRST to LAST.  Both arguments are linespecs.
  2912.  
  2913. `list ,LAST'
  2914.      Print lines ending with LAST.
  2915.  
  2916. `list FIRST,'
  2917.      Print lines starting with FIRST.
  2918.  
  2919. `list +'
  2920.      Print lines just after the lines last printed.
  2921.  
  2922. `list -'
  2923.      Print lines just before the lines last printed.
  2924.  
  2925. `list'
  2926.      As described in the preceding table.
  2927.  
  2928.    Here are the ways of specifying a single source line--all the kinds
  2929. of linespec.
  2930.  
  2931. `NUMBER'
  2932.      Specifies line NUMBER of the current source file.  When a `list'
  2933.      command has two linespecs, this refers to the same source file as
  2934.      the first linespec.
  2935.  
  2936. `+OFFSET'
  2937.      Specifies the line OFFSET lines after the last line printed.  When
  2938.      used as the second linespec in a `list' command that has two, this
  2939.      specifies the line OFFSET lines down from the first linespec.
  2940.  
  2941. `-OFFSET'
  2942.      Specifies the line OFFSET lines before the last line printed.
  2943.  
  2944. `FILENAME:NUMBER'
  2945.      Specifies line NUMBER in the source file FILENAME.
  2946.  
  2947. `FUNCTION'
  2948.      Specifies the line that begins the body of the function FUNCTION.
  2949.      For example: in C, this is the line with the open brace.
  2950.  
  2951. `FILENAME:FUNCTION'
  2952.      Specifies the line of the open-brace that begins the body of the
  2953.      function FUNCTION in the file FILENAME.  You only need the file
  2954.      name with a function name to avoid ambiguity when there are
  2955.      identically named functions in different source files.
  2956.  
  2957. `*ADDRESS'
  2958.      Specifies the line containing the program address ADDRESS.
  2959.      ADDRESS may be any expression.
  2960.  
  2961. 
  2962. File: gdb,  Node: Search,  Next: Source Path,  Prev: List,  Up: Source
  2963.  
  2964. Searching source files
  2965. ======================
  2966.  
  2967.    There are two commands for searching through the current source file
  2968. for a regular expression.
  2969.  
  2970. `forward-search REGEXP'
  2971. `search REGEXP'
  2972.      The command `forward-search REGEXP' checks each line, starting
  2973.      with the one following the last line listed, for a match for
  2974.      REGEXP.  It lists the line that is found.  You can use the synonym
  2975.      `search REGEXP' or abbreviate the command name as `fo'.
  2976.  
  2977. `reverse-search REGEXP'
  2978.      The command `reverse-search REGEXP' checks each line, starting
  2979.      with the one before the last line listed and going backward, for a
  2980.      match for REGEXP.  It lists the line that is found.  You can
  2981.      abbreviate this command as `rev'.
  2982.  
  2983. 
  2984. File: gdb,  Node: Source Path,  Next: Machine Code,  Prev: Search,  Up: Source
  2985.  
  2986. Specifying source directories
  2987. =============================
  2988.  
  2989.    Executable programs sometimes do not record the directories of the
  2990. source files from which they were compiled, just the names.  Even when
  2991. they do, the directories could be moved between the compilation and
  2992. your debugging session.  GDB has a list of directories to search for
  2993. source files; this is called the "source path".  Each time GDB wants a
  2994. source file, it tries all the directories in the list, in the order
  2995. they are present in the list, until it finds a file with the desired
  2996. name.  Note that the executable search path is *not* used for this
  2997. purpose.  Neither is the current working directory, unless it happens
  2998. to be in the source path.
  2999.  
  3000.    If GDB cannot find a source file in the source path, and the object
  3001. program records a directory, GDB tries that directory too.  If the
  3002. source path is empty, and there is no record of the compilation
  3003. directory, GDB looks in the current directory as a last resort.
  3004.  
  3005.    Whenever you reset or rearrange the source path, GDB clears out any
  3006. information it has cached about where source files are found and where
  3007. each line is in the file.
  3008.  
  3009.    When you start GDB, its source path is empty.  To add other
  3010. directories, use the `directory' command.
  3011.  
  3012. `directory DIRNAME ...'
  3013. `dir DIRNAME ...'
  3014.      Add directory DIRNAME to the front of the source path.  Several
  3015.      directory names may be given to this command, separated by `:' or
  3016.      whitespace.  You may specify a directory that is already in the
  3017.      source path; this moves it forward, so GDB searches it sooner.
  3018.  
  3019.      You can use the string `$cdir' to refer to the compilation
  3020.      directory (if one is recorded), and `$cwd' to refer to the current
  3021.      working directory.  `$cwd' is not the same as `.'--the former
  3022.      tracks the current working directory as it changes during your GDB
  3023.      session, while the latter is immediately expanded to the current
  3024.      directory at the time you add an entry to the source path.
  3025.  
  3026. `directory'
  3027.      Reset the source path to empty again.  This requires confirmation.
  3028.  
  3029. `show directories'
  3030.      Print the source path: show which directories it contains.
  3031.  
  3032.    If your source path is cluttered with directories that are no longer
  3033. of interest, GDB may sometimes cause confusion by finding the wrong
  3034. versions of source.  You can correct the situation as follows:
  3035.  
  3036.   1. Use `directory' with no argument to reset the source path to empty.
  3037.  
  3038.   2. Use `directory' with suitable arguments to reinstall the
  3039.      directories you want in the source path.  You can add all the
  3040.      directories in one command.
  3041.  
  3042. 
  3043. File: gdb,  Node: Machine Code,  Prev: Source Path,  Up: Source
  3044.  
  3045. Source and machine code
  3046. =======================
  3047.  
  3048.    You can use the command `info line' to map source lines to program
  3049. addresses (and vice versa), and the command `disassemble' to display a
  3050. range of addresses as machine instructions.  When run under GNU Emacs
  3051. mode, the `info line' command now causes the arrow to point to the line
  3052. specified.  Also, `info line' prints addresses in symbolic form as well
  3053. as hex.
  3054.  
  3055. `info line LINESPEC'
  3056.      Print the starting and ending addresses of the compiled code for
  3057.      source line LINESPEC.  You can specify source lines in any of the
  3058.      ways understood by the `list' command (*note Printing source
  3059.      lines: List.).
  3060.  
  3061.    For example, we can use `info line' to discover the location of the
  3062. object code for the first line of function `m4_changequote':
  3063.  
  3064.      (gdb) info line m4_changecom
  3065.      Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350.
  3066.  
  3067. We can also inquire (using `*ADDR' as the form for LINESPEC) what
  3068. source line covers a particular address:
  3069.      (gdb) info line *0x63ff
  3070.      Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404.
  3071.  
  3072.    After `info line', the default address for the `x' command is
  3073. changed to the starting address of the line, so that `x/i' is
  3074. sufficient to begin examining the machine code (*note Examining memory:
  3075. Memory.).  Also, this address is saved as the value of the convenience
  3076. variable `$_' (*note Convenience variables: Convenience Vars.).
  3077.  
  3078. `disassemble'
  3079.      This specialized command dumps a range of memory as machine
  3080.      instructions.  The default memory range is the function
  3081.      surrounding the program counter of the selected frame.  A single
  3082.      argument to this command is a program counter value; GDB dumps the
  3083.      function surrounding this value.  Two arguments specify a range of
  3084.      addresses (first inclusive, second exclusive) to dump.
  3085.  
  3086.    We can use `disassemble' to inspect the object code range shown in
  3087. the last `info line' example (the example shows SPARC machine
  3088. instructions):
  3089.  
  3090.      (gdb) disas 0x63e4 0x6404
  3091.      Dump of assembler code from 0x63e4 to 0x6404:
  3092.      0x63e4 <builtin_init+5340>:     ble 0x63f8 <builtin_init+5360>
  3093.      0x63e8 <builtin_init+5344>:     sethi %hi(0x4c00), %o0
  3094.      0x63ec <builtin_init+5348>:     ld [%i1+4], %o0
  3095.      0x63f0 <builtin_init+5352>:     b 0x63fc <builtin_init+5364>
  3096.      0x63f4 <builtin_init+5356>:     ld [%o0+4], %o0
  3097.      0x63f8 <builtin_init+5360>:     or %o0, 0x1a4, %o0
  3098.      0x63fc <builtin_init+5364>:     call 0x9288 <path_search>
  3099.      0x6400 <builtin_init+5368>:     nop
  3100.      End of assembler dump.
  3101.  
  3102. 
  3103. File: gdb,  Node: Data,  Next: Languages,  Prev: Source,  Up: Top
  3104.  
  3105. Examining Data
  3106. **************
  3107.  
  3108.    The usual way to examine data in your program is with the `print'
  3109. command (abbreviated `p'), or its synonym `inspect'.  It evaluates and
  3110. prints the value of an expression of the language your program is
  3111. written in (*note Using GDB with Different Languages: Languages.).
  3112.  
  3113. `print EXP'
  3114. `print /F EXP'
  3115.      EXP is an expression (in the source language).  By default the
  3116.      value of EXP is printed in a format appropriate to its data type;
  3117.      you can choose a different format by specifying `/F', where F is a
  3118.      letter specifying the format; *note Output formats: Output
  3119.      Formats..
  3120.  
  3121. `print'
  3122. `print /F'
  3123.      If you omit EXP, GDB displays the last value again (from the
  3124.      "value history"; *note Value history: Value History.).  This
  3125.      allows you to conveniently inspect the same value in an
  3126.      alternative format.
  3127.  
  3128.    A more low-level way of examining data is with the `x' command.  It
  3129. examines data in memory at a specified address and prints it in a
  3130. specified format.  *Note Examining memory: Memory.
  3131.  
  3132.    If you are interested in information about types, or about how the
  3133. fields of a struct or class are declared, use the `ptype EXP' command
  3134. rather than `print'. *Note Examining the Symbol Table: Symbols.
  3135.  
  3136. * Menu:
  3137.  
  3138. * Expressions::                 Expressions
  3139. * Variables::                   Program variables
  3140. * Arrays::                      Artificial arrays
  3141. * Output Formats::              Output formats
  3142. * Memory::                      Examining memory
  3143. * Auto Display::                Automatic display
  3144. * Print Settings::              Print settings
  3145. * Value History::               Value history
  3146. * Convenience Vars::            Convenience variables
  3147. * Registers::                   Registers
  3148.  
  3149. * Floating Point Hardware::     Floating point hardware
  3150.  
  3151. 
  3152. File: gdb,  Node: Expressions,  Next: Variables,  Up: Data
  3153.  
  3154. Expressions
  3155. ===========
  3156.  
  3157.    `print' and many other GDB commands accept an expression and compute
  3158. its value.  Any kind of constant, variable or operator defined by the
  3159. programming language you are using is valid in an expression in GDB.
  3160. This includes conditional expressions, function calls, casts and string
  3161. constants.  It unfortunately does not include symbols defined by
  3162. preprocessor `#define' commands.
  3163.  
  3164.    GDB now supports array constants in expressions input by the user.
  3165. The syntax is {ELEMENT, ELEMENT...}.  For example, you can now use the
  3166. command `print {1, 2, 3}' to build up an array in memory that is
  3167. malloc'd in the target program.
  3168.  
  3169.    Because C is so widespread, most of the expressions shown in
  3170. examples in this manual are in C.  *Note Using GDB with Different
  3171. Languages: Languages, for information on how to use expressions in other
  3172. languages.
  3173.  
  3174.    In this section, we discuss operators that you can use in GDB
  3175. expressions regardless of your programming language.
  3176.  
  3177.    Casts are supported in all languages, not just in C, because it is so
  3178. useful to cast a number into a pointer in order to examine a structure
  3179. at that address in memory.
  3180.  
  3181.    GDB supports these operators, in addition to those common to
  3182. programming languages:
  3183.  
  3184. `@'
  3185.      `@' is a binary operator for treating parts of memory as arrays.
  3186.      *Note Artificial arrays: Arrays, for more information.
  3187.  
  3188. `::'
  3189.      `::' allows you to specify a variable in terms of the file or
  3190.      function where it is defined.  *Note Program variables: Variables.
  3191.  
  3192. `{TYPE} ADDR'
  3193.      Refers to an object of type TYPE stored at address ADDR in memory.
  3194.      ADDR may be any expression whose value is an integer or pointer
  3195.      (but parentheses are required around binary operators, just as in
  3196.      a cast).  This construct is allowed regardless of what kind of
  3197.      data is normally supposed to reside at ADDR.
  3198.  
  3199. 
  3200. File: gdb,  Node: Variables,  Next: Arrays,  Prev: Expressions,  Up: Data
  3201.  
  3202. Program variables
  3203. =================
  3204.  
  3205.    The most common kind of expression to use is the name of a variable
  3206. in your program.
  3207.  
  3208.    Variables in expressions are understood in the selected stack frame
  3209. (*note Selecting a frame: Selection.); they must be either:
  3210.  
  3211.    * global (or static)
  3212.  
  3213. or
  3214.  
  3215.    * visible according to the scope rules of the programming language
  3216.      from the point of execution in that frame
  3217.  
  3218. This means that in the function
  3219.  
  3220.      foo (a)
  3221.           int a;
  3222.      {
  3223.        bar (a);
  3224.        {
  3225.          int b = test ();
  3226.          bar (b);
  3227.        }
  3228.      }
  3229.  
  3230. you can examine and use the variable `a' whenever your program is
  3231. executing within the function `foo', but you can only use or examine
  3232. the variable `b' while your program is executing inside the block where
  3233. `b' is declared.
  3234.  
  3235.    There is an exception: you can refer to a variable or function whose
  3236. scope is a single source file even if the current execution point is not
  3237. in this file.  But it is possible to have more than one such variable or
  3238. function with the same name (in different source files).  If that
  3239. happens, referring to that name has unpredictable effects.  If you wish,
  3240. you can specify a static variable in a particular function or file,
  3241. using the colon-colon notation:
  3242.  
  3243.      FILE::VARIABLE
  3244.      FUNCTION::VARIABLE
  3245.  
  3246. Here FILE or FUNCTION is the name of the context for the static
  3247. VARIABLE.  In the case of file names, you can use quotes to make sure
  3248. GDB parses the file name as a single word--for example, to print a
  3249. global value of `x' defined in `f2.c':
  3250.  
  3251.      (gdb) p 'f2.c'::x
  3252.  
  3253.    This use of `::' is very rarely in conflict with the very similar
  3254. use of the same notation in C++.  GDB also supports use of the C++
  3255. scope resolution operator in GDB expressions.
  3256.  
  3257.      *Warning:* Occasionally, a local variable may appear to have the
  3258.      wrong value at certain points in a function--just after entry to a
  3259.      new scope, and just before exit.
  3260.    You may see this problem when you are stepping by machine
  3261. instructions.  This is because, on most machines, it takes more than
  3262. one instruction to set up a stack frame (including local variable
  3263. definitions); if you are stepping by machine instructions, variables
  3264. may appear to have the wrong values until the stack frame is completely
  3265. built.  On exit, it usually also takes more than one machine
  3266. instruction to destroy a stack frame; after you begin stepping through
  3267. that group of instructions, local variable definitions may be gone.
  3268.  
  3269. 
  3270. File: gdb,  Node: Arrays,  Next: Output Formats,  Prev: Variables,  Up: Data
  3271.  
  3272. Artificial arrays
  3273. =================
  3274.  
  3275.    It is often useful to print out several successive objects of the
  3276. same type in memory; a section of an array, or an array of dynamically
  3277. determined size for which only a pointer exists in the program.
  3278.  
  3279.    You can do this by referring to a contiguous span of memory as an
  3280. "artificial array", using the binary operator `@'.  The left operand of
  3281. `@' should be the first element of the desired array and be an
  3282. individual object.  The right operand should be the desired length of
  3283. the array.  The result is an array value whose elements are all of the
  3284. type of the left argument.  The first element is actually the left
  3285. argument; the second element comes from bytes of memory immediately
  3286. following those that hold the first element, and so on.  Here is an
  3287. example.  If a program says
  3288.  
  3289.      int *array = (int *) malloc (len * sizeof (int));
  3290.  
  3291. you can print the contents of `array' with
  3292.  
  3293.      p *array@len
  3294.  
  3295.    The left operand of `@' must reside in memory.  Array values made
  3296. with `@' in this way behave just like other arrays in terms of
  3297. subscripting, and are coerced to pointers when used in expressions.
  3298. Artificial arrays most often appear in expressions via the value history
  3299. (*note Value history: Value History.), after printing one out.
  3300.  
  3301.    Another way to create an artificial array is to use a cast.  This
  3302. re-interprets a value as if it were an array.  The value need not be in
  3303. memory:
  3304.      (gdb) p/x (short[2])0x12345678
  3305.      $1 = {0x1234, 0x5678}
  3306.  
  3307.    As a convenience, if you leave the array length out (as in
  3308. `(TYPE)[])VALUE') gdb calculates the size to fill the value (as
  3309. `sizeof(VALUE)/sizeof(TYPE)':
  3310.      (gdb) p/x (short[])0x12345678
  3311.      $2 = {0x1234, 0x5678}
  3312.  
  3313.    Sometimes the artificial array mechanism is not quite enough; in
  3314. moderately complex data structures, the elements of interest may not
  3315. actually be adjacent--for example, if you are interested in the values
  3316. of pointers in an array.  One useful work-around in this situation is
  3317. to use a convenience variable (*note Convenience variables: Convenience
  3318. Vars.) as a counter in an expression that prints the first interesting
  3319. value, and then repeat that expression via RET.  For instance, suppose
  3320. you have an array `dtab' of pointers to structures, and you are
  3321. interested in the values of a field `fv' in each structure.  Here is an
  3322. example of what you might type:
  3323.  
  3324.      set $i = 0
  3325.      p dtab[$i++]->fv
  3326.      RET
  3327.      RET
  3328.      ...
  3329.  
  3330. 
  3331. File: gdb,  Node: Output Formats,  Next: Memory,  Prev: Arrays,  Up: Data
  3332.  
  3333. Output formats
  3334. ==============
  3335.  
  3336.    By default, GDB prints a value according to its data type.  Sometimes
  3337. this is not what you want.  For example, you might want to print a
  3338. number in hex, or a pointer in decimal.  Or you might want to view data
  3339. in memory at a certain address as a character string or as an
  3340. instruction.  To do these things, specify an "output format" when you
  3341. print a value.
  3342.  
  3343.    The simplest use of output formats is to say how to print a value
  3344. already computed.  This is done by starting the arguments of the
  3345. `print' command with a slash and a format letter.  The format letters
  3346. supported are:
  3347.  
  3348. `x'
  3349.      Regard the bits of the value as an integer, and print the integer
  3350.      in hexadecimal.
  3351.  
  3352. `d'
  3353.      Print as integer in signed decimal.
  3354.  
  3355. `u'
  3356.      Print as integer in unsigned decimal.
  3357.  
  3358. `o'
  3359.      Print as integer in octal.
  3360.  
  3361. `t'
  3362.      Print as integer in binary.  The letter `t' stands for "two".  (1)
  3363.  
  3364. `a'
  3365.      Print as an address, both absolute in hexadecimal and as an offset
  3366.      from the nearest preceding symbol.  You can use this format used
  3367.      to discover where (in what function) an unknown address is located:
  3368.  
  3369.           (gdb) p/a 0x54320
  3370.           $3 = 0x54320 <_initialize_vx+396>
  3371.  
  3372. `c'
  3373.      Regard as an integer and print it as a character constant.
  3374.  
  3375. `f'
  3376.      Regard the bits of the value as a floating point number and print
  3377.      using typical floating point syntax.
  3378.  
  3379.    For example, to print the program counter in hex (*note
  3380. Registers::.), type
  3381.  
  3382.      p/x $pc
  3383.  
  3384. Note that no space is required before the slash; this is because command
  3385. names in GDB cannot contain a slash.
  3386.  
  3387.    To reprint the last value in the value history with a different
  3388. format, you can use the `print' command with just a format and no
  3389. expression.  For example, `p/x' reprints the last value in hex.
  3390.  
  3391.    ---------- Footnotes ----------
  3392.  
  3393.    (1)  `b' cannot be used because these format letters are also used
  3394. with the `x' command, where `b' stands for "byte"; *note Examining
  3395. memory: Memory..
  3396.  
  3397. 
  3398. File: gdb,  Node: Memory,  Next: Auto Display,  Prev: Output Formats,  Up: Data
  3399.  
  3400. Examining memory
  3401. ================
  3402.  
  3403.    You can use the command `x' (for "examine") to examine memory in any
  3404. of several formats, independently of your program's data types.
  3405.  
  3406. `x/NFU ADDR'
  3407. `x ADDR'
  3408. `x'
  3409.      Use the `x' command to examine memory.
  3410.  
  3411.    N, F, and U are all optional parameters that specify how much memory
  3412. to display and how to format it; ADDR is an expression giving the
  3413. address where you want to start displaying memory.  If you use defaults
  3414. for NFU, you need not type the slash `/'.  Several commands set
  3415. convenient defaults for ADDR.
  3416.  
  3417. N, the repeat count
  3418.      The repeat count is a decimal integer; the default is 1.  It
  3419.      specifies how much memory (counting by units U) to display.
  3420.  
  3421. F, the display format
  3422.      The display format is one of the formats used by `print', `s'
  3423.      (null-terminated string), or `i' (machine instruction).  The
  3424.      default is `x' (hexadecimal) initially.  The default changes each
  3425.      time you use either `x' or `print'.
  3426.  
  3427. U, the unit size
  3428.      The unit size is any of
  3429.  
  3430.     `b'
  3431.           Bytes.
  3432.  
  3433.     `h'
  3434.           Halfwords (two bytes).
  3435.  
  3436.     `w'
  3437.           Words (four bytes).  This is the initial default.
  3438.  
  3439.     `g'
  3440.           Giant words (eight bytes).
  3441.  
  3442.      Each time you specify a unit size with `x', that size becomes the
  3443.      default unit the next time you use `x'.  (For the `s' and `i'
  3444.      formats, the unit size is ignored and is normally not written.)
  3445.  
  3446. ADDR, starting display address
  3447.      ADDR is the address where you want GDB to begin displaying memory.
  3448.      The expression need not have a pointer value (though it may); it
  3449.      is always interpreted as an integer address of a byte of memory.
  3450.      *Note Expressions: Expressions, for more information on
  3451.      expressions.  The default for ADDR is usually just after the last
  3452.      address examined--but several other commands also set the default
  3453.      address: `info breakpoints' (to the address of the last breakpoint
  3454.      listed), `info line' (to the starting address of a line), and
  3455.      `print' (if you use it to display a value from memory).
  3456.  
  3457.    For example, `x/3uh 0x54320' is a request to display three halfwords
  3458. (`h') of memory, formatted as unsigned decimal integers (`u'), starting
  3459. at address `0x54320'.  `x/4xw $sp' prints the four words (`w') of
  3460. memory above the stack pointer (here, `$sp'; *note Registers::.) in
  3461. hexadecimal (`x').
  3462.  
  3463.    Since the letters indicating unit sizes are all distinct from the
  3464. letters specifying output formats, you do not have to remember whether
  3465. unit size or format comes first; either order works.  The output
  3466. specifications `4xw' and `4wx' mean exactly the same thing.  (However,
  3467. the count N must come first; `wx4' does not work.)
  3468.  
  3469.    Even though the unit size U is ignored for the formats `s' and `i',
  3470. you might still want to use a count N; for example, `3i' specifies that
  3471. you want to see three machine instructions, including any operands.
  3472. The command `disassemble' gives an alternative way of inspecting
  3473. machine instructions; *note Source and machine code: Machine Code..
  3474.  
  3475.    All the defaults for the arguments to `x' are designed to make it
  3476. easy to continue scanning memory with minimal specifications each time
  3477. you use `x'.  For example, after you have inspected three machine
  3478. instructions with `x/3i ADDR', you can inspect the next seven with just
  3479. `x/7'.  If you use RET to repeat the `x' command, the repeat count N is
  3480. used again; the other arguments default as for successive uses of `x'.
  3481.  
  3482.    The addresses and contents printed by the `x' command are not saved
  3483. in the value history because there is often too much of them and they
  3484. would get in the way.  Instead, GDB makes these values available for
  3485. subsequent use in expressions as values of the convenience variables
  3486. `$_' and `$__'.  After an `x' command, the last address examined is
  3487. available for use in expressions in the convenience variable `$_'.  The
  3488. contents of that address, as examined, are available in the convenience
  3489. variable `$__'.
  3490.  
  3491.    If the `x' command has a repeat count, the address and contents saved
  3492. are from the last memory unit printed; this is not the same as the last
  3493. address printed if several units were printed on the last line of
  3494. output.
  3495.  
  3496. 
  3497. File: gdb,  Node: Auto Display,  Next: Print Settings,  Prev: Memory,  Up: Data
  3498.  
  3499. Automatic display
  3500. =================
  3501.  
  3502.    If you find that you want to print the value of an expression
  3503. frequently (to see how it changes), you might want to add it to the
  3504. "automatic display list" so that GDB prints its value each time your
  3505. program stops.  Each expression added to the list is given a number to
  3506. identify it; to remove an expression from the list, you specify that
  3507. number.  The automatic display looks like this:
  3508.  
  3509.      2: foo = 38
  3510.      3: bar[5] = (struct hack *) 0x3804
  3511.  
  3512. This display shows item numbers, expressions and their current values.
  3513. As with displays you request manually using `x' or `print', you can
  3514. specify the output format you prefer; in fact, `display' decides
  3515. whether to use `print' or `x' depending on how elaborate your format
  3516. specification is--it uses `x' if you specify a unit size, or one of the
  3517. two formats (`i' and `s') that are only supported by `x'; otherwise it
  3518. uses `print'.
  3519.  
  3520. `display EXP'
  3521.      Add the expression EXP to the list of expressions to display each
  3522.      time your program stops.  *Note Expressions: Expressions.
  3523.  
  3524.      `display' does not repeat if you press RET again after using it.
  3525.  
  3526. `display/FMT EXP'
  3527.      For FMT specifying only a display format and not a size or count,
  3528.      add the expression EXP to the auto-display list but arrange to
  3529.      display it each time in the specified format FMT.  *Note Output
  3530.      formats: Output Formats.
  3531.  
  3532. `display/FMT ADDR'
  3533.      For FMT `i' or `s', or including a unit-size or a number of units,
  3534.      add the expression ADDR as a memory address to be examined each
  3535.      time your program stops.  Examining means in effect doing `x/FMT
  3536.      ADDR'.  *Note Examining memory: Memory.
  3537.  
  3538.    For example, `display/i $pc' can be helpful, to see the machine
  3539. instruction about to be executed each time execution stops (`$pc' is a
  3540. common name for the program counter; *note Registers::.).
  3541.  
  3542. `undisplay DNUMS...'
  3543. `delete display DNUMS...'
  3544.      Remove item numbers DNUMS from the list of expressions to display.
  3545.  
  3546.      `undisplay' does not repeat if you press RET after using it.
  3547.      (Otherwise you would just get the error `No display number ...'.)
  3548.  
  3549. `disable display DNUMS...'
  3550.      Disable the display of item numbers DNUMS.  A disabled display
  3551.      item is not printed automatically, but is not forgotten.  It may be
  3552.      enabled again later.
  3553.  
  3554. `enable display DNUMS...'
  3555.      Enable display of item numbers DNUMS.  It becomes effective once
  3556.      again in auto display of its expression, until you specify
  3557.      otherwise.
  3558.  
  3559. `display'
  3560.      Display the current values of the expressions on the list, just as
  3561.      is done when your program stops.
  3562.  
  3563. `info display'
  3564.      Print the list of expressions previously set up to display
  3565.      automatically, each one with its item number, but without showing
  3566.      the values.  This includes disabled expressions, which are marked
  3567.      as such.  It also includes expressions which would not be
  3568.      displayed right now because they refer to automatic variables not
  3569.      currently available.
  3570.  
  3571.    If a display expression refers to local variables, then it does not
  3572. make sense outside the lexical context for which it was set up.  Such an
  3573. expression is disabled when execution enters a context where one of its
  3574. variables is not defined.  For example, if you give the command
  3575. `display last_char' while inside a function with an argument
  3576. `last_char', GDB displays this argument while your program continues to
  3577. stop inside that function.  When it stops elsewhere--where there is no
  3578. variable `last_char'--the display is disabled automatically.  The next
  3579. time your program stops where `last_char' is meaningful, you can enable
  3580. the display expression once again.
  3581.  
  3582. 
  3583. File: gdb,  Node: Print Settings,  Next: Value History,  Prev: Auto Display,  Up: Data
  3584.  
  3585. Print settings
  3586. ==============
  3587.  
  3588.    GDB provides the following ways to control how arrays, structures,
  3589. and symbols are printed.
  3590.  
  3591. These settings are useful for debugging programs in any language:
  3592.  
  3593. `set print address'
  3594. `set print address on'
  3595.      GDB prints memory addresses showing the location of stack traces,
  3596.      structure values, pointer values, breakpoints, and so forth, even
  3597.      when it also displays the contents of those addresses.  The default
  3598.      is `on'.  For example, this is what a stack frame display looks
  3599.      like with `set print address on':
  3600.  
  3601.           (gdb) f
  3602.           #0  set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
  3603.               at input.c:530
  3604.           530         if (lquote != def_lquote)
  3605.  
  3606. `set print address off'
  3607.      Do not print addresses when displaying their contents.  For
  3608.      example, this is the same stack frame displayed with `set print
  3609.      address off':
  3610.  
  3611.           (gdb) set print addr off
  3612.           (gdb) f
  3613.           #0  set_quotes (lq="<<", rq=">>") at input.c:530
  3614.           530         if (lquote != def_lquote)
  3615.  
  3616.      You can use `set print address off' to eliminate all machine
  3617.      dependent displays from the GDB interface.  For example, with
  3618.      `print address off', you should get the same text for backtraces on
  3619.      all machines--whether or not they involve pointer arguments.
  3620.  
  3621. `show print address'
  3622.      Show whether or not addresses are to be printed.
  3623.  
  3624.    When GDB prints a symbolic address, it normally prints the closest
  3625. earlier symbol plus an offset.  If that symbol does not uniquely
  3626. identify the address (for example, it is a name whose scope is a single
  3627. source file), you may need to clarify.  One way to do this is with
  3628. `info line', for example `info line *0x4537'.  Alternately, you can set
  3629. GDB to print the source file and line number when it prints a symbolic
  3630. address:
  3631.  
  3632. `set print symbol-filename on'
  3633.      Tell GDB to print the source file name and line number of a symbol
  3634.      in the symbolic form of an address.
  3635.  
  3636. `set print symbol-filename off'
  3637.      Do not print source file name and line number of a symbol.  This
  3638.      is the default.
  3639.  
  3640. `show print symbol-filename'
  3641.      Show whether or not GDB will print the source file name and line
  3642.      number of a symbol in the symbolic form of an address.
  3643.  
  3644.    Another situation where it is helpful to show symbol filenames and
  3645. line numbers is when disassembling code; GDB shows you the line number
  3646. and source file that corresponds to each instruction.
  3647.  
  3648.    Also, you may wish to see the symbolic form only if the address being
  3649. printed is reasonably close to the closest earlier symbol:
  3650.  
  3651. `set print max-symbolic-offset MAX-OFFSET'
  3652.      Tell GDB to only display the symbolic form of an address if the
  3653.      offset between the closest earlier symbol and the address is less
  3654.      than MAX-OFFSET.  The default is 0, which tells GDB to always
  3655.      print the symbolic form of an address if any symbol precedes it.
  3656.  
  3657. `show print max-symbolic-offset'
  3658.      Ask how large the maximum offset is that GDB prints in a symbolic
  3659.      address.
  3660.  
  3661.    If you have a pointer and you are not sure where it points, try `set
  3662. print symbol-filename on'.  Then you can determine the name and source
  3663. file location of the variable where it points, using `p/a POINTER'.
  3664. This interprets the address in symbolic form.  For example, here GDB
  3665. shows that a variable `ptt' points at another variable `t', defined in
  3666. `hi2.c':
  3667.  
  3668.      (gdb) set print symbol-filename on
  3669.      (gdb) p/a ptt
  3670.      $4 = 0xe008 <t in hi2.c>
  3671.  
  3672.      *Warning:* For pointers that point to a local variable, `p/a' does
  3673.      not show the symbol name and filename of the referent, even with
  3674.      the appropriate `set print' options turned on.
  3675.  
  3676.    Other settings control how different kinds of objects are printed:
  3677.  
  3678. `set print array'
  3679. `set print array on'
  3680.      Pretty print arrays.  This format is more convenient to read, but
  3681.      uses more space.  The default is off.
  3682.  
  3683. `set print array off'
  3684.      Return to compressed format for arrays.
  3685.  
  3686. `show print array'
  3687.      Show whether compressed or pretty format is selected for displaying
  3688.      arrays.
  3689.  
  3690. `set print elements NUMBER-OF-ELEMENTS'
  3691.      Set a limit on how many elements of an array GDB will print.  If
  3692.      GDB is printing a large array, it stops printing after it has
  3693.      printed the number of elements set by the `set print elements'
  3694.      command.  This limit also applies to the display of strings.
  3695.      Setting  NUMBER-OF-ELEMENTS to zero means that the printing is
  3696.      unlimited.
  3697.  
  3698. `show print elements'
  3699.      Display the number of elements of a large array that GDB will
  3700.      print.  If the number is 0, then the printing is unlimited.
  3701.  
  3702. `set print null-stop'
  3703.      Cause GDB to stop printing the characters of an array when the
  3704.      first NULL is encountered.  This is useful when large arrays
  3705.      actually contain only short strings.
  3706.  
  3707. `set print pretty on'
  3708.      Cause GDB to print structures in an indented format with one member
  3709.      per line, like this:
  3710.  
  3711.           $1 = {
  3712.             next = 0x0,
  3713.             flags = {
  3714.               sweet = 1,
  3715.               sour = 1
  3716.             },
  3717.             meat = 0x54 "Pork"
  3718.           }
  3719.  
  3720. `set print pretty off'
  3721.      Cause GDB to print structures in a compact format, like this:
  3722.  
  3723.           $1 = {next = 0x0, flags = {sweet = 1, sour = 1}, \
  3724.           meat = 0x54 "Pork"}
  3725.  
  3726.      This is the default format.
  3727.  
  3728. `show print pretty'
  3729.      Show which format GDB is using to print structures.
  3730.  
  3731. `set print sevenbit-strings on'
  3732.      Print using only seven-bit characters; if this option is set, GDB
  3733.      displays any eight-bit characters (in strings or character values)
  3734.      using the notation `\'NNN.  This setting is best if you are
  3735.      working in English (ASCII) and you use the high-order bit of
  3736.      characters as a marker or "meta" bit.
  3737.  
  3738. `set print sevenbit-strings off'
  3739.      Print full eight-bit characters.  This allows the use of more
  3740.      international character sets, and is the default.
  3741.  
  3742. `show print sevenbit-strings'
  3743.      Show whether or not GDB is printing only seven-bit characters.
  3744.  
  3745. `set print union on'
  3746.      Tell GDB to print unions which are contained in structures.  This
  3747.      is the default setting.
  3748.  
  3749. `set print union off'
  3750.      Tell GDB not to print unions which are contained in structures.
  3751.  
  3752. `show print union'
  3753.      Ask GDB whether or not it will print unions which are contained in
  3754.      structures.
  3755.  
  3756.      For example, given the declarations
  3757.  
  3758.           typedef enum {Tree, Bug} Species;
  3759.           typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
  3760.           typedef enum {Caterpillar, Cocoon, Butterfly}
  3761.                         Bug_forms;
  3762.           
  3763.           struct thing {
  3764.             Species it;
  3765.             union {
  3766.               Tree_forms tree;
  3767.               Bug_forms bug;
  3768.             } form;
  3769.           };
  3770.           
  3771.           struct thing foo = {Tree, {Acorn}};
  3772.  
  3773.      with `set print union on' in effect `p foo' would print
  3774.  
  3775.           $1 = {it = Tree, form = {tree = Acorn, bug = Cocoon}}
  3776.  
  3777.      and with `set print union off' in effect it would print
  3778.  
  3779.           $1 = {it = Tree, form = {...}}
  3780.  
  3781. These settings are of interest when debugging C++ programs:
  3782.  
  3783. `set print demangle'
  3784. `set print demangle on'
  3785.      Print C++ names in their source form rather than in the encoded
  3786.      ("mangled") form passed to the assembler and linker for type-safe
  3787.      linkage.  The default is `on'.
  3788.  
  3789. `show print demangle'
  3790.      Show whether C++ names are printed in mangled or demangled form.
  3791.  
  3792. `set print asm-demangle'
  3793. `set print asm-demangle on'
  3794.      Print C++ names in their source form rather than their mangled
  3795.      form, even in assembler code printouts such as instruction
  3796.      disassemblies.  The default is off.
  3797.  
  3798. `show print asm-demangle'
  3799.      Show whether C++ names in assembly listings are printed in mangled
  3800.      or demangled form.
  3801.  
  3802. `set demangle-style STYLE'
  3803.      Choose among several encoding schemes used by different compilers
  3804.      to represent C++ names.  The choices for STYLE are currently:
  3805.  
  3806.     `auto'
  3807.           Allow GDB to choose a decoding style by inspecting your
  3808.           program.
  3809.  
  3810.     `gnu'
  3811.           Decode based on the GNU C++ compiler (`g++') encoding
  3812.           algorithm.  This is the default.
  3813.  
  3814.     `lucid'
  3815.           Decode based on the Lucid C++ compiler (`lcc') encoding
  3816.           algorithm.
  3817.  
  3818.     `arm'
  3819.           Decode using the algorithm in the `C++ Annotated Reference
  3820.           Manual'.  *Warning:* this setting alone is not sufficient to
  3821.           allow debugging `cfront'-generated executables.  GDB would
  3822.           require further enhancement to permit that.
  3823.  
  3824.     `foo'
  3825.           Show the list of formats.
  3826.  
  3827. `show demangle-style'
  3828.      Display the encoding style currently in use for decoding C++
  3829.      symbols.
  3830.  
  3831. `set print object'
  3832. `set print object on'
  3833.      When displaying a pointer to an object, identify the *actual*
  3834.      (derived) type of the object rather than the *declared* type, using
  3835.      the virtual function table.
  3836.  
  3837. `set print object off'
  3838.      Display only the declared type of objects, without reference to the
  3839.      virtual function table.  This is the default setting.
  3840.  
  3841. `show print object'
  3842.      Show whether actual, or declared, object types are displayed.
  3843.  
  3844. `set print static-members'
  3845. `set print static-members on'
  3846.      Print static members when displaying a C++ object.  The default is
  3847.      on.
  3848.  
  3849. `set print static-members off'
  3850.      Do not print static members when displaying a C++ object.
  3851.  
  3852. `show print static-members'
  3853.      Show whether C++ static members are printed, or not.
  3854.  
  3855. `set print vtbl'
  3856. `set print vtbl on'
  3857.      Pretty print C++ virtual function tables.  The default is off.
  3858.  
  3859. `set print vtbl off'
  3860.      Do not pretty print C++ virtual function tables.
  3861.  
  3862. `show print vtbl'
  3863.      Show whether C++ virtual function tables are pretty printed, or
  3864.      not.
  3865.  
  3866. 
  3867. File: gdb,  Node: Value History,  Next: Convenience Vars,  Prev: Print Settings,  Up: Data
  3868.  
  3869. Value history
  3870. =============
  3871.  
  3872.    Values printed by the `print' command are saved in the GDB "value
  3873. history".  This allows you to refer to them in other expressions.
  3874. Values are kept until the symbol table is re-read or discarded (for
  3875. example with the `file' or `symbol-file' commands).  When the symbol
  3876. table changes, the value history is discarded, since the values may
  3877. contain pointers back to the types defined in the symbol table.
  3878.  
  3879.    The values printed are given "history numbers" by which you can
  3880. refer to them.  These are successive integers starting with one.
  3881. `print' shows you the history number assigned to a value by printing
  3882. `$NUM = ' before the value; here NUM is the history number.
  3883.  
  3884.    To refer to any previous value, use `$' followed by the value's
  3885. history number.  The way `print' labels its output is designed to
  3886. remind you of this.  Just `$' refers to the most recent value in the
  3887. history, and `$$' refers to the value before that.  `$$N' refers to the
  3888. Nth value from the end; `$$2' is the value just prior to `$$', `$$1' is
  3889. equivalent to `$$', and `$$0' is equivalent to `$'.
  3890.  
  3891.    For example, suppose you have just printed a pointer to a structure
  3892. and want to see the contents of the structure.  It suffices to type
  3893.  
  3894.      p *$
  3895.  
  3896.    If you have a chain of structures where the component `next' points
  3897. to the next one, you can print the contents of the next one with this:
  3898.  
  3899.      p *$.next
  3900.  
  3901. You can print successive links in the chain by repeating this
  3902. command--which you can do by just typing RET.
  3903.  
  3904.    Note that the history records values, not expressions.  If the value
  3905. of `x' is 4 and you type these commands:
  3906.  
  3907.      print x
  3908.      set x=5
  3909.  
  3910. then the value recorded in the value history by the `print' command
  3911. remains 4 even though the value of `x' has changed.
  3912.  
  3913. `show values'
  3914.      Print the last ten values in the value history, with their item
  3915.      numbers.  This is like `p $$9' repeated ten times, except that
  3916.      `show values' does not change the history.
  3917.  
  3918. `show values N'
  3919.      Print ten history values centered on history item number N.
  3920.  
  3921. `show values +'
  3922.      Print ten history values just after the values last printed.  If
  3923.      no more values are available, `show values +' produces no display.
  3924.  
  3925.    Pressing RET to repeat `show values N' has exactly the same effect
  3926. as `show values +'.
  3927.  
  3928. 
  3929. File: gdb,  Node: Convenience Vars,  Next: Registers,  Prev: Value History,  Up: Data
  3930.  
  3931. Convenience variables
  3932. =====================
  3933.  
  3934.    GDB provides "convenience variables" that you can use within GDB to
  3935. hold on to a value and refer to it later.  These variables exist
  3936. entirely within GDB; they are not part of your program, and setting a
  3937. convenience variable has no direct effect on further execution of your
  3938. program.  That is why you can use them freely.
  3939.  
  3940.    Convenience variables are prefixed with `$'.  Any name preceded by
  3941. `$' can be used for a convenience variable, unless it is one of the
  3942. predefined machine-specific register names (*note Registers::.).
  3943. (Value history references, in contrast, are *numbers* preceded by `$'.
  3944. *Note Value history: Value History.)
  3945.  
  3946.    You can save a value in a convenience variable with an assignment
  3947. expression, just as you would set a variable in your program.  For
  3948. example:
  3949.  
  3950.      set $foo = *object_ptr
  3951.  
  3952. would save in `$foo' the value contained in the object pointed to by
  3953. `object_ptr'.
  3954.  
  3955.    Using a convenience variable for the first time creates it, but its
  3956. value is `void' until you assign a new value.  You can alter the value
  3957. with another assignment at any time.
  3958.  
  3959.    Convenience variables have no fixed types.  You can assign a
  3960. convenience variable any type of value, including structures and
  3961. arrays, even if that variable already has a value of a different type.
  3962. The convenience variable, when used as an expression, has the type of
  3963. its current value.
  3964.  
  3965. `show convenience'
  3966.      Print a list of convenience variables used so far, and their
  3967.      values.  Abbreviated `show con'.
  3968.  
  3969.    One of the ways to use a convenience variable is as a counter to be
  3970. incremented or a pointer to be advanced.  For example, to print a field
  3971. from successive elements of an array of structures:
  3972.  
  3973.      set $i = 0
  3974.      print bar[$i++]->contents
  3975.  
  3976. Repeat that command by typing RET.
  3977.  
  3978.    Some convenience variables are created automatically by GDB and given
  3979. values likely to be useful.
  3980.  
  3981. `$_'
  3982.      The variable `$_' is automatically set by the `x' command to the
  3983.      last address examined (*note Examining memory: Memory.).  Other
  3984.      commands which provide a default address for `x' to examine also
  3985.      set `$_' to that address; these commands include `info line' and
  3986.      `info breakpoint'.  The type of `$_' is `void *' except when set
  3987.      by the `x' command, in which case it is a pointer to the type of
  3988.      `$__'.
  3989.  
  3990. `$__'
  3991.      The variable `$__' is automatically set by the `x' command to the
  3992.      value found in the last address examined.  Its type is chosen to
  3993.      match the format in which the data was printed.
  3994.  
  3995. `$_exitcode'
  3996.      The variable `$_exitcode' is automatically set to the exit code
  3997.      when the program being debugged terminates.
  3998.  
  3999. 
  4000. File: gdb,  Node: Registers,  Next: Floating Point Hardware,  Prev: Convenience Vars,  Up: Data
  4001.  
  4002. Registers
  4003. =========
  4004.  
  4005.    You can refer to machine register contents, in expressions, as
  4006. variables with names starting with `$'.  The names of registers are
  4007. different for each machine; use `info registers' to see the names used
  4008. on your machine.
  4009.  
  4010. `info registers'
  4011.      Print the names and values of all registers except floating-point
  4012.      registers (in the selected stack frame).
  4013.  
  4014. `info all-registers'
  4015.      Print the names and values of all registers, including
  4016.      floating-point registers.
  4017.  
  4018. `info registers REGNAME ...'
  4019.      Print the "relativized" value of each specified register REGNAME.
  4020.      As discussed in detail below, register values are normally
  4021.      relative to the selected stack frame.  REGNAME may be any register
  4022.      name valid on the machine you are using, with or without the
  4023.      initial `$'.
  4024.  
  4025.    GDB has four "standard" register names that are available (in
  4026. expressions) on most machines--whenever they do not conflict with an
  4027. architecture's canonical mnemonics for registers.  The register names
  4028. `$pc' and `$sp' are used for the program counter register and the stack
  4029. pointer.  `$fp' is used for a register that contains a pointer to the
  4030. current stack frame, and `$ps' is used for a register that contains the
  4031. processor status.  For example, you could print the program counter in
  4032. hex with
  4033.  
  4034.      p/x $pc
  4035.  
  4036. or print the instruction to be executed next with
  4037.  
  4038.      x/i $pc
  4039.  
  4040. or add four to the stack pointer(1) with
  4041.  
  4042.      set $sp += 4
  4043.  
  4044.    Whenever possible, these four standard register names are available
  4045. on your machine even though the machine has different canonical
  4046. mnemonics, so long as there is no conflict.  The `info registers'
  4047. command shows the canonical names.  For example, on the SPARC, `info
  4048. registers' displays the processor status register as `$psr' but you can
  4049. also refer to it as `$ps'.
  4050.  
  4051.    GDB always considers the contents of an ordinary register as an
  4052. integer when the register is examined in this way.  Some machines have
  4053. special registers which can hold nothing but floating point; these
  4054. registers are considered to have floating point values.  There is no way
  4055. to refer to the contents of an ordinary register as floating point value
  4056. (although you can *print* it as a floating point value with `print/f
  4057. $REGNAME').
  4058.  
  4059.    Some registers have distinct "raw" and "virtual" data formats.  This
  4060. means that the data format in which the register contents are saved by
  4061. the operating system is not the same one that your program normally
  4062. sees.  For example, the registers of the 68881 floating point
  4063. coprocessor are always saved in "extended" (raw) format, but all C
  4064. programs expect to work with "double" (virtual) format.  In such cases,
  4065. GDB normally works with the virtual format only (the format that makes
  4066. sense for your program), but the `info registers' command prints the
  4067. data in both formats.
  4068.  
  4069.    Normally, register values are relative to the selected stack frame
  4070. (*note Selecting a frame: Selection.).  This means that you get the
  4071. value that the register would contain if all stack frames farther in
  4072. were exited and their saved registers restored.  In order to see the
  4073. true contents of hardware registers, you must select the innermost
  4074. frame (with `frame 0').
  4075.  
  4076.    However, GDB must deduce where registers are saved, from the machine
  4077. code generated by your compiler.  If some registers are not saved, or if
  4078. GDB is unable to locate the saved registers, the selected stack frame
  4079. makes no difference.
  4080.  
  4081. `set rstack_high_address ADDRESS'
  4082.      On AMD 29000 family processors, registers are saved in a separate
  4083.      "register stack".  There is no way for GDB to determine the extent
  4084.      of this stack.  Normally, GDB just assumes that the stack is "large
  4085.      enough".  This may result in GDB referencing memory locations that
  4086.      do not exist.  If necessary, you can get around this problem by
  4087.      specifying the ending address of the register stack with the `set
  4088.      rstack_high_address' command.  The argument should be an address,
  4089.      which you probably want to precede with `0x' to specify in
  4090.      hexadecimal.
  4091.  
  4092. `show rstack_high_address'
  4093.      Display the current limit of the register stack, on AMD 29000
  4094.      family processors.
  4095.  
  4096.    ---------- Footnotes ----------
  4097.  
  4098.    (1)  This is a way of removing one word from the stack, on machines
  4099. where stacks grow downward in memory (most machines, nowadays).  This
  4100. assumes that the innermost stack frame is selected; setting `$sp' is
  4101. not allowed when other stack frames are selected.  To pop entire frames
  4102. off the stack, regardless of machine architecture, use `return'; *note
  4103. Returning from a function: Returning..
  4104.  
  4105. 
  4106. File: gdb,  Node: Floating Point Hardware,  Prev: Registers,  Up: Data
  4107.  
  4108. Floating point hardware
  4109. =======================
  4110.  
  4111.    Depending on the configuration, GDB may be able to give you more
  4112. information about the status of the floating point hardware.
  4113.  
  4114. `info float'
  4115.      Display hardware-dependent information about the floating point
  4116.      unit.  The exact contents and layout vary depending on the
  4117.      floating point chip.  Currently, `info float' is supported on the
  4118.      ARM and x86 machines.
  4119.  
  4120. 
  4121. File: gdb,  Node: Languages,  Next: Symbols,  Prev: Data,  Up: Top
  4122.  
  4123. Using GDB with Different Languages
  4124. **********************************
  4125.  
  4126.    Although programming languages generally have common aspects, they
  4127. are rarely expressed in the same manner.  For instance, in ANSI C,
  4128. dereferencing a pointer `p' is accomplished by `*p', but in Modula-2,
  4129. it is accomplished by `p^'.  Values can also be represented (and
  4130. displayed) differently.  Hex numbers in C appear as `0x1ae', while in
  4131. Modula-2 they appear as `1AEH'.
  4132.  
  4133.    Language-specific information is built into GDB for some languages,
  4134. allowing you to express operations like the above in your program's
  4135. native language, and allowing GDB to output values in a manner
  4136. consistent with the syntax of your program's native language.  The
  4137. language you use to build expressions is called the "working language".
  4138.  
  4139. * Menu:
  4140.  
  4141. * Setting::                     Switching between source languages
  4142. * Show::                        Displaying the language
  4143.  
  4144. * Checks::                      Type and range checks
  4145.  
  4146. * Support::                     Supported languages
  4147.  
  4148. 
  4149. File: gdb,  Node: Setting,  Next: Show,  Up: Languages
  4150.  
  4151. Switching between source languages
  4152. ==================================
  4153.  
  4154.    There are two ways to control the working language--either have GDB
  4155. set it automatically, or select it manually yourself.  You can use the
  4156. `set language' command for either purpose.  On startup, GDB defaults to
  4157. setting the language automatically.  The working language is used to
  4158. determine how expressions you type are interpreted, how values are
  4159. printed, etc.
  4160.  
  4161.    In addition to the working language, every source file that GDB
  4162. knows about has its own working language.  For some object file
  4163. formats, the compiler might indicate which language a particular source
  4164. file is in.  However, most of the time GDB infers the language from the
  4165. name of the file.  The language of a source file controls whether C++
  4166. names are demangled--this way `backtrace' can show each frame
  4167. appropriately for its own language.  There is no way to set the
  4168. language of a source file from within GDB.
  4169.  
  4170.    This is most commonly a problem when you use a program, such as
  4171. `cfront' or `f2c', that generates C but is written in another language.
  4172. In that case, make the program use `#line' directives in its C output;
  4173. that way GDB will know the correct language of the source code of the
  4174. original program, and will display that source code, not the generated
  4175. C code.
  4176.  
  4177. * Menu:
  4178.  
  4179. * Filenames::                   Filename extensions and languages.
  4180. * Manually::                    Setting the working language manually
  4181. * Automatically::               Having GDB infer the source language
  4182.  
  4183. 
  4184. File: gdb,  Node: Filenames,  Next: Manually,  Up: Setting
  4185.  
  4186. List of filename extensions and languages
  4187. -----------------------------------------
  4188.  
  4189.    If a source file name ends in one of the following extensions, then
  4190. GDB infers that its language is the one indicated.
  4191.  
  4192. `.mod'
  4193.      Modula-2 source file
  4194.  
  4195. `.c'
  4196.      C source file
  4197.  
  4198. `.C'
  4199. `.cc'
  4200. `.cxx'
  4201. `.cpp'
  4202. `.cp'
  4203. `.c++'
  4204.      C++ source file
  4205.  
  4206. `.ch'
  4207. `.c186'
  4208. `.c286'
  4209.      CHILL source file.
  4210.  
  4211. `.s'
  4212. `.S'
  4213.      Assembler source file.  This actually behaves almost like C, but
  4214.      GDB does not skip over function prologues when stepping.
  4215.  
  4216. 
  4217. File: gdb,  Node: Manually,  Next: Automatically,  Prev: Filenames,  Up: Setting
  4218.  
  4219. Setting the working language
  4220. ----------------------------
  4221.  
  4222.    If you allow GDB to set the language automatically, expressions are
  4223. interpreted the same way in your debugging session and your program.
  4224.  
  4225.    If you wish, you may set the language manually.  To do this, issue
  4226. the command `set language LANG', where LANG is the name of a language,
  4227. such as `c' or `modula-2'.  For a list of the supported languages, type
  4228. `set language'.
  4229.  
  4230.    Setting the language manually prevents GDB from updating the working
  4231. language automatically.  This can lead to confusion if you try to debug
  4232. a program when the working language is not the same as the source
  4233. language, when an expression is acceptable to both languages--but means
  4234. different things.  For instance, if the current source file were
  4235. written in C, and GDB was parsing Modula-2, a command such as:
  4236.  
  4237.      print a = b + c
  4238.  
  4239. might not have the effect you intended.  In C, this means to add `b'
  4240. and `c' and place the result in `a'.  The result printed would be the
  4241. value of `a'.  In Modula-2, this means to compare `a' to the result of
  4242. `b+c', yielding a `BOOLEAN' value.
  4243.  
  4244. 
  4245. File: gdb,  Node: Automatically,  Prev: Manually,  Up: Setting
  4246.  
  4247. Having GDB infer the source language
  4248. ------------------------------------
  4249.  
  4250.    To have GDB set the working language automatically, use `set
  4251. language local' or `set language auto'.  GDB then infers the working
  4252. language.  That is, when your program stops in a frame (usually by
  4253. encountering a breakpoint), GDB sets the working language to the
  4254. language recorded for the function in that frame.  If the language for
  4255. a frame is unknown (that is, if the function or block corresponding to
  4256. the frame was defined in a source file that does not have a recognized
  4257. extension), the current working language is not changed, and GDB issues
  4258. a warning.
  4259.  
  4260.    This may not seem necessary for most programs, which are written
  4261. entirely in one source language.  However, program modules and libraries
  4262. written in one source language can be used by a main program written in
  4263. a different source language.  Using `set language auto' in this case
  4264. frees you from having to set the working language manually.
  4265.  
  4266. 
  4267. File: gdb,  Node: Show,  Next: Checks,  Prev: Setting,  Up: Languages
  4268.  
  4269. Displaying the language
  4270. =======================
  4271.  
  4272.    The following commands help you find out which language is the
  4273. working language, and also what language source files were written in.
  4274.  
  4275. `show language'
  4276.      Display the current working language.  This is the language you
  4277.      can use with commands such as `print' to build and compute
  4278.      expressions that may involve variables in your program.
  4279.  
  4280. `info frame'
  4281.      Display the source language for this frame.  This language becomes
  4282.      the working language if you use an identifier from this frame.
  4283.      *Note Information about a frame: Frame Info, to identify the other
  4284.      information listed here.
  4285.  
  4286. `info source'
  4287.      Display the source language of this source file.  *Note Examining
  4288.      the Symbol Table: Symbols, to identify the other information
  4289.      listed here.
  4290.  
  4291. 
  4292. File: gdb,  Node: Checks,  Next: Support,  Prev: Show,  Up: Languages
  4293.  
  4294. Type and range checking
  4295. =======================
  4296.  
  4297.      *Warning:* In this release, the GDB commands for type and range
  4298.      checking are included, but they do not yet have any effect.  This
  4299.      section documents the intended facilities.
  4300.  
  4301.    Some languages are designed to guard you against making seemingly
  4302. common errors through a series of compile- and run-time checks.  These
  4303. include checking the type of arguments to functions and operators, and
  4304. making sure mathematical overflows are caught at run time.  Checks such
  4305. as these help to ensure a program's correctness once it has been
  4306. compiled by eliminating type mismatches, and providing active checks
  4307. for range errors when your program is running.
  4308.  
  4309.    GDB can check for conditions like the above if you wish.  Although
  4310. GDB does not check the statements in your program, it can check
  4311. expressions entered directly into GDB for evaluation via the `print'
  4312. command, for example.  As with the working language, GDB can also
  4313. decide whether or not to check automatically based on your program's
  4314. source language.  *Note Supported languages: Support, for the default
  4315. settings of supported languages.
  4316.  
  4317. * Menu:
  4318.  
  4319. * Type Checking::               An overview of type checking
  4320. * Range Checking::              An overview of range checking
  4321.  
  4322. 
  4323. File: gdb,  Node: Type Checking,  Next: Range Checking,  Up: Checks
  4324.  
  4325. An overview of type checking
  4326. ----------------------------
  4327.  
  4328.    Some languages, such as Modula-2, are strongly typed, meaning that
  4329. the arguments to operators and functions have to be of the correct type,
  4330. otherwise an error occurs.  These checks prevent type mismatch errors
  4331. from ever causing any run-time problems.  For example,
  4332.  
  4333.      1 + 2 => 3
  4334. but
  4335.      error--> 1 + 2.3
  4336.  
  4337.    The second example fails because the `CARDINAL' 1 is not
  4338. type-compatible with the `REAL' 2.3.
  4339.  
  4340.    For the expressions you use in GDB commands, you can tell the GDB
  4341. type checker to skip checking; to treat any mismatches as errors and
  4342. abandon the expression; or to only issue warnings when type mismatches
  4343. occur, but evaluate the expression anyway.  When you choose the last of
  4344. these, GDB evaluates expressions like the second example above, but
  4345. also issues a warning.
  4346.  
  4347.    Even if you turn type checking off, there may be other reasons
  4348. related to type that prevent GDB from evaluating an expression.  For
  4349. instance, GDB does not know how to add an `int' and a `struct foo'.
  4350. These particular type errors have nothing to do with the language in
  4351. use, and usually arise from expressions, such as the one described
  4352. above, which make little sense to evaluate anyway.
  4353.  
  4354.    Each language defines to what degree it is strict about type.  For
  4355. instance, both Modula-2 and C require the arguments to arithmetical
  4356. operators to be numbers.  In C, enumerated types and pointers can be
  4357. represented as numbers, so that they are valid arguments to mathematical
  4358. operators.  *Note Supported languages: Support, for further details on
  4359. specific languages.
  4360.  
  4361.    GDB provides some additional commands for controlling the type
  4362. checker:
  4363.  
  4364. `set check type auto'
  4365.      Set type checking on or off based on the current working language.
  4366.      *Note Supported languages: Support, for the default settings for
  4367.      each language.
  4368.  
  4369. `set check type on'
  4370. `set check type off'
  4371.      Set type checking on or off, overriding the default setting for the
  4372.      current working language.  Issue a warning if the setting does not
  4373.      match the language default.  If any type mismatches occur in
  4374.      evaluating an expression while typechecking is on, GDB prints a
  4375.      message and aborts evaluation of the expression.
  4376.  
  4377. `set check type warn'
  4378.      Cause the type checker to issue warnings, but to always attempt to
  4379.      evaluate the expression.  Evaluating the expression may still be
  4380.      impossible for other reasons.  For example, GDB cannot add numbers
  4381.      and structures.
  4382.  
  4383. `show type'
  4384.      Show the current setting of the type checker, and whether or not
  4385.      GDB is setting it automatically.
  4386.  
  4387. 
  4388. File: gdb,  Node: Range Checking,  Prev: Type Checking,  Up: Checks
  4389.  
  4390. An overview of range checking
  4391. -----------------------------
  4392.  
  4393.    In some languages (such as Modula-2), it is an error to exceed the
  4394. bounds of a type; this is enforced with run-time checks.  Such range
  4395. checking is meant to ensure program correctness by making sure
  4396. computations do not overflow, or indices on an array element access do
  4397. not exceed the bounds of the array.
  4398.  
  4399.    For expressions you use in GDB commands, you can tell GDB to treat
  4400. range errors in one of three ways: ignore them, always treat them as
  4401. errors and abandon the expression, or issue warnings but evaluate the
  4402. expression anyway.
  4403.  
  4404.    A range error can result from numerical overflow, from exceeding an
  4405. array index bound, or when you type a constant that is not a member of
  4406. any type.  Some languages, however, do not treat overflows as an error.
  4407. In many implementations of C, mathematical overflow causes the result
  4408. to "wrap around" to lower values--for example, if M is the largest
  4409. integer value, and S is the smallest, then
  4410.  
  4411.      M + 1 => S
  4412.  
  4413.    This, too, is specific to individual languages, and in some cases
  4414. specific to individual compilers or machines.  *Note Supported
  4415. languages: Support, for further details on specific languages.
  4416.  
  4417.    GDB provides some additional commands for controlling the range
  4418. checker:
  4419.  
  4420. `set check range auto'
  4421.      Set range checking on or off based on the current working language.
  4422.      *Note Supported languages: Support, for the default settings for
  4423.      each language.
  4424.  
  4425. `set check range on'
  4426. `set check range off'
  4427.      Set range checking on or off, overriding the default setting for
  4428.      the current working language.  A warning is issued if the setting
  4429.      does not match the language default.  If a range error occurs,
  4430.      then a message is printed and evaluation of the expression is
  4431.      aborted.
  4432.  
  4433. `set check range warn'
  4434.      Output messages when the GDB range checker detects a range error,
  4435.      but attempt to evaluate the expression anyway.  Evaluating the
  4436.      expression may still be impossible for other reasons, such as
  4437.      accessing memory that the process does not own (a typical example
  4438.      from many Unix systems).
  4439.  
  4440. `show range'
  4441.      Show the current setting of the range checker, and whether or not
  4442.      it is being set automatically by GDB.
  4443.  
  4444. 
  4445. File: gdb,  Node: Support,  Prev: Checks,  Up: Languages
  4446.  
  4447. Supported languages
  4448. ===================
  4449.  
  4450.    GDB 4 supports C, C++, and Modula-2.  Some GDB features may be used
  4451. in expressions regardless of the language you use: the GDB `@' and `::'
  4452. operators, and the `{type}addr' construct (*note Expressions:
  4453. Expressions.) can be used with the constructs of any supported language.
  4454.  
  4455.    The following sections detail to what degree each source language is
  4456. supported by GDB.  These sections are not meant to be language
  4457. tutorials or references, but serve only as a reference guide to what the
  4458. GDB expression parser accepts, and what input and output formats should
  4459. look like for different languages.  There are many good books written
  4460. on each of these languages; please look to these for a language
  4461. reference or tutorial.
  4462.  
  4463. * Menu:
  4464.  
  4465. * C::                           C and C++
  4466. * Modula-2::                    Modula-2
  4467.  
  4468. 
  4469. File: gdb,  Node: C,  Next: Modula-2,  Up: Support
  4470.  
  4471. C and C++
  4472. ---------
  4473.  
  4474.    Since C and C++ are so closely related, many features of GDB apply
  4475. to both languages.  Whenever this is the case, we discuss those
  4476. languages together.
  4477.  
  4478.    The C++ debugging facilities are jointly implemented by the GNU C++
  4479. compiler and GDB.  Therefore, to debug your C++ code effectively, you
  4480. must compile your C++ programs with the GNU C++ compiler, `g++'.
  4481.  
  4482.    For best results when debugging C++ programs, use the stabs debugging
  4483. format.  You can select that format explicitly with the `g++'
  4484. command-line options `-gstabs' or `-gstabs+'.  See *Note Options for
  4485. Debugging Your Program or GNU CC: (gcc.info)Debugging Options, for more
  4486. information.
  4487.  
  4488. * Menu:
  4489.  
  4490. * C Operators::                 C and C++ operators
  4491. * C Constants::                 C and C++ constants
  4492. * Cplus expressions::           C++ expressions
  4493. * C Defaults::                  Default settings for C and C++
  4494.  
  4495. * C Checks::                    C and C++ type and range checks
  4496.  
  4497. * Debugging C::                 GDB and C
  4498. * Debugging C plus plus::       Special features for C++
  4499.  
  4500. 
  4501. File: gdb,  Node: C Operators,  Next: C Constants,  Up: C
  4502.  
  4503. C and C++ operators
  4504. ...................
  4505.  
  4506.    Operators must be defined on values of specific types.  For instance,
  4507. `+' is defined on numbers, but not on structures.  Operators are often
  4508. defined on groups of types.
  4509.  
  4510.    For the purposes of C and C++, the following definitions hold:
  4511.  
  4512.    * *Integral types* include `int' with any of its storage-class
  4513.      specifiers; `char'; and `enum'.
  4514.  
  4515.    * *Floating-point types* include `float' and `double'.
  4516.  
  4517.    * *Pointer types* include all types defined as `(TYPE *)'.
  4518.  
  4519.    * *Scalar types* include all of the above.
  4520.  
  4521. The following operators are supported.  They are listed here in order
  4522. of increasing precedence:
  4523.  
  4524. `,'
  4525.      The comma or sequencing operator.  Expressions in a
  4526.      comma-separated list are evaluated from left to right, with the
  4527.      result of the entire expression being the last expression
  4528.      evaluated.
  4529.  
  4530. `='
  4531.      Assignment.  The value of an assignment expression is the value
  4532.      assigned.  Defined on scalar types.
  4533.  
  4534. `OP='
  4535.      Used in an expression of the form `A OP= B', and translated to
  4536.      `A = A OP B'.  `OP=' and `=' have the same precendence.  OP is any
  4537.      one of the operators `|', `^', `&', `<<', `>>', `+', `-', `*',
  4538.      `/', `%'.
  4539.  
  4540. `?:'
  4541.      The ternary operator.  `A ? B : C' can be thought of as:  if A
  4542.      then B else C.  A should be of an integral type.
  4543.  
  4544. `||'
  4545.      Logical OR.  Defined on integral types.
  4546.  
  4547. `&&'
  4548.      Logical AND.  Defined on integral types.
  4549.  
  4550. `|'
  4551.      Bitwise OR.  Defined on integral types.
  4552.  
  4553. `^'
  4554.      Bitwise exclusive-OR.  Defined on integral types.
  4555.  
  4556. `&'
  4557.      Bitwise AND.  Defined on integral types.
  4558.  
  4559. `==, !='
  4560.      Equality and inequality.  Defined on scalar types.  The value of
  4561.      these expressions is 0 for false and non-zero for true.
  4562.  
  4563. `<, >, <=, >='
  4564.      Less than, greater than, less than or equal, greater than or equal.
  4565.      Defined on scalar types.  The value of these expressions is 0 for
  4566.      false and non-zero for true.
  4567.  
  4568. `<<, >>'
  4569.      left shift, and right shift.  Defined on integral types.
  4570.  
  4571. `@'
  4572.      The GDB "artificial array" operator (*note Expressions:
  4573.      Expressions.).
  4574.  
  4575. `+, -'
  4576.      Addition and subtraction.  Defined on integral types,
  4577.      floating-point types and pointer types.
  4578.  
  4579. `*, /, %'
  4580.      Multiplication, division, and modulus.  Multiplication and
  4581.      division are defined on integral and floating-point types.
  4582.      Modulus is defined on integral types.
  4583.  
  4584. `++, --'
  4585.      Increment and decrement.  When appearing before a variable, the
  4586.      operation is performed before the variable is used in an
  4587.      expression; when appearing after it, the variable's value is used
  4588.      before the operation takes place.
  4589.  
  4590. `*'
  4591.      Pointer dereferencing.  Defined on pointer types.  Same precedence
  4592.      as `++'.
  4593.  
  4594. `&'
  4595.      Address operator.  Defined on variables.  Same precedence as `++'.
  4596.  
  4597.      For debugging C++, GDB implements a use of `&' beyond what is
  4598.      allowed in the C++ language itself: you can use `&(&REF)' (or, if
  4599.      you prefer, simply `&&REF') to examine the address where a C++
  4600.      reference variable (declared with `&REF') is stored.
  4601.  
  4602. `-'
  4603.      Negative.  Defined on integral and floating-point types.  Same
  4604.      precedence as `++'.
  4605.  
  4606. `!'
  4607.      Logical negation.  Defined on integral types.  Same precedence as
  4608.      `++'.
  4609.  
  4610. `~'
  4611.      Bitwise complement operator.  Defined on integral types.  Same
  4612.      precedence as `++'.
  4613.  
  4614. `., ->'
  4615.      Structure member, and pointer-to-structure member.  For
  4616.      convenience, GDB regards the two as equivalent, choosing whether
  4617.      to dereference a pointer based on the stored type information.
  4618.      Defined on `struct' and `union' data.
  4619.  
  4620. `[]'
  4621.      Array indexing.  `A[I]' is defined as `*(A+I)'.  Same precedence
  4622.      as `->'.
  4623.  
  4624. `()'
  4625.      Function parameter list.  Same precedence as `->'.
  4626.  
  4627. `::'
  4628.      C++ scope resolution operator.  Defined on `struct', `union', and
  4629.      `class' types.
  4630.  
  4631. `::'
  4632.      Doubled colons also represent the GDB scope operator (*note
  4633.      Expressions: Expressions.).  Same precedence as `::', above.
  4634.  
  4635. 
  4636. File: gdb,  Node: C Constants,  Next: Cplus expressions,  Prev: C Operators,  Up: C
  4637.  
  4638. C and C++ constants
  4639. ...................
  4640.  
  4641.    GDB allows you to express the constants of C and C++ in the
  4642. following ways:
  4643.  
  4644.    * Integer constants are a sequence of digits.  Octal constants are
  4645.      specified by a leading `0' (i.e. zero), and hexadecimal constants
  4646.      by a leading `0x' or `0X'.  Constants may also end with a letter
  4647.      `l', specifying that the constant should be treated as a `long'
  4648.      value.
  4649.  
  4650.    * Floating point constants are a sequence of digits, followed by a
  4651.      decimal point, followed by a sequence of digits, and optionally
  4652.      followed by an exponent.  An exponent is of the form:
  4653.      `e[[+]|-]NNN', where NNN is another sequence of digits.  The `+'
  4654.      is optional for positive exponents.
  4655.  
  4656.    * Enumerated constants consist of enumerated identifiers, or their
  4657.      integral equivalents.
  4658.  
  4659.    * Character constants are a single character surrounded by single
  4660.      quotes (`''), or a number--the ordinal value of the corresponding
  4661.      character (usually its ASCII value).  Within quotes, the single
  4662.      character may be represented by a letter or by "escape sequences",
  4663.      which are of the form `\NNN', where NNN is the octal representation
  4664.      of the character's ordinal value; or of the form `\X', where `X'
  4665.      is a predefined special character--for example, `\n' for newline.
  4666.  
  4667.    * String constants are a sequence of character constants surrounded
  4668.      by double quotes (`"').
  4669.  
  4670.    * Pointer constants are an integral value.  You can also write
  4671.      pointers to constants using the C operator `&'.
  4672.  
  4673.    * Array constants are comma-separated lists surrounded by braces `{'
  4674.      and `}'; for example, `{1,2,3}' is a three-element array of
  4675.      integers, `{{1,2}, {3,4}, {5,6}}' is a three-by-two array, and
  4676.      `{&"hi", &"there", &"fred"}' is a three-element array of pointers.
  4677.  
  4678. 
  4679. File: gdb,  Node: Cplus expressions,  Next: C Defaults,  Prev: C Constants,  Up: C
  4680.  
  4681. C++ expressions
  4682. ...............
  4683.  
  4684.    GDB expression handling has a number of extensions to interpret a
  4685. significant subset of C++ expressions.
  4686.  
  4687.      *Warning:* GDB can only debug C++ code if you compile with the GNU
  4688.      C++ compiler.  Moreover, C++ debugging depends on the use of
  4689.      additional debugging information in the symbol table, and thus
  4690.      requires special support.  GDB has this support *only* with the
  4691.      stabs debug format.  In particular, if your compiler generates
  4692.      a.out, MIPS ECOFF, RS/6000 XCOFF, or ELF with stabs extensions to
  4693.      the symbol table, these facilities are all available.  (With GNU
  4694.      CC, you can use the `-gstabs' option to request stabs debugging
  4695.      extensions explicitly.)  Where the object code format is standard
  4696.      COFF or DWARF in ELF, on the other hand, most of the C++ support
  4697.      in GDB does *not* work.
  4698.  
  4699.   1. Member function calls are allowed; you can use expressions like
  4700.  
  4701.           count = aml->GetOriginal(x, y)
  4702.  
  4703.   2. While a member function is active (in the selected stack frame),
  4704.      your expressions have the same namespace available as the member
  4705.      function; that is, GDB allows implicit references to the class
  4706.      instance pointer `this' following the same rules as C++.
  4707.  
  4708.   3. You can call overloaded functions; GDB resolves the function call
  4709.      to the right definition, with one restriction--you must use
  4710.      arguments of the type required by the function that you want to
  4711.      call.  GDB does not perform conversions requiring constructors or
  4712.      user-defined type operators.
  4713.  
  4714.   4. GDB understands variables declared as C++ references; you can use
  4715.      them in expressions just as you do in C++ source--they are
  4716.      automatically dereferenced.
  4717.  
  4718.      In the parameter list shown when GDB displays a frame, the values
  4719.      of reference variables are not displayed (unlike other variables);
  4720.      this avoids clutter, since references are often used for large
  4721.      structures.  The *address* of a reference variable is always
  4722.      shown, unless you have specified `set print address off'.
  4723.  
  4724.   5. GDB supports the C++ name resolution operator `::'--your
  4725.      expressions can use it just as expressions in your program do.
  4726.      Since one scope may be defined in another, you can use `::'
  4727.      repeatedly if necessary, for example in an expression like
  4728.      `SCOPE1::SCOPE2::NAME'.  GDB also allows resolving name scope by
  4729.      reference to source files, in both C and C++ debugging (*note
  4730.      Program variables: Variables.).
  4731.  
  4732. 
  4733. File: gdb,  Node: C Defaults,  Next: C Checks,  Prev: Cplus expressions,  Up: C
  4734.  
  4735. C and C++ defaults
  4736. ..................
  4737.  
  4738.    If you allow GDB to set type and range checking automatically, they
  4739. both default to `off' whenever the working language changes to C or
  4740. C++.  This happens regardless of whether you or GDB selects the working
  4741. language.
  4742.  
  4743.    If you allow GDB to set the language automatically, it recognizes
  4744. source files whose names end with `.c', `.C', or `.cc', and when GDB
  4745. enters code compiled from one of these files, it sets the working
  4746. language to C or C++.  *Note Having GDB infer the source language:
  4747. Automatically, for further details.
  4748.  
  4749. 
  4750. File: gdb,  Node: C Checks,  Next: Debugging C,  Prev: C Defaults,  Up: C
  4751.  
  4752. C and C++ type and range checks
  4753. ...............................
  4754.  
  4755.    By default, when GDB parses C or C++ expressions, type checking is
  4756. not used.  However, if you turn type checking on, GDB considers two
  4757. variables type equivalent if:
  4758.  
  4759.    * The two variables are structured and have the same structure,
  4760.      union, or enumerated tag.
  4761.  
  4762.    * The two variables have the same type name, or types that have been
  4763.      declared equivalent through `typedef'.
  4764.  
  4765.    Range checking, if turned on, is done on mathematical operations.
  4766. Array indices are not checked, since they are often used to index a
  4767. pointer that is not itself an array.
  4768.  
  4769. 
  4770. File: gdb,  Node: Debugging C,  Next: Debugging C plus plus,  Prev: C Checks,  Up: C
  4771.  
  4772. GDB and C
  4773. .........
  4774.  
  4775.    The `set print union' and `show print union' commands apply to the
  4776. `union' type.  When set to `on', any `union' that is inside a `struct'
  4777. or `class' is also printed.  Otherwise, it appears as `{...}'.
  4778.  
  4779.    The `@' operator aids in the debugging of dynamic arrays, formed
  4780. with pointers and a memory allocation function.  *Note Expressions:
  4781. Expressions.
  4782.  
  4783. 
  4784. File: gdb,  Node: Debugging C plus plus,  Prev: Debugging C,  Up: C
  4785.  
  4786. GDB features for C++
  4787. ....................
  4788.  
  4789.    Some GDB commands are particularly useful with C++, and some are
  4790. designed specifically for use with C++.  Here is a summary:
  4791.  
  4792. `breakpoint menus'
  4793.      When you want a breakpoint in a function whose name is overloaded,
  4794.      GDB breakpoint menus help you specify which function definition
  4795.      you want.  *Note Breakpoint menus: Breakpoint Menus.
  4796.  
  4797. `rbreak REGEX'
  4798.      Setting breakpoints using regular expressions is helpful for
  4799.      setting breakpoints on overloaded functions that are not members
  4800.      of any special classes.  *Note Setting breakpoints: Set Breaks.
  4801.  
  4802. `catch EXCEPTIONS'
  4803. `info catch'
  4804.      Debug C++ exception handling using these commands.  *Note
  4805.      Breakpoints and exceptions: Exception Handling.
  4806.  
  4807. `ptype TYPENAME'
  4808.      Print inheritance relationships as well as other information for
  4809.      type TYPENAME.  *Note Examining the Symbol Table: Symbols.
  4810.  
  4811. `set print demangle'
  4812. `show print demangle'
  4813. `set print asm-demangle'
  4814. `show print asm-demangle'
  4815.      Control whether C++ symbols display in their source form, both when
  4816.      displaying code as C++ source and when displaying disassemblies.
  4817.      *Note Print settings: Print Settings.
  4818.  
  4819. `set print object'
  4820. `show print object'
  4821.      Choose whether to print derived (actual) or declared types of
  4822.      objects.  *Note Print settings: Print Settings.
  4823.  
  4824. `set print vtbl'
  4825. `show print vtbl'
  4826.      Control the format for printing virtual function tables.  *Note
  4827.      Print settings: Print Settings.
  4828.  
  4829. `Overloaded symbol names'
  4830.      You can specify a particular definition of an overloaded symbol,
  4831.      using the same notation that is used to declare such symbols in
  4832.      C++: type `SYMBOL(TYPES)' rather than just SYMBOL.  You can also
  4833.      use the GDB command-line word completion facilities to list the
  4834.      available choices, or to finish the type list for you.  *Note
  4835.      Command completion: Completion, for details on how to do this.
  4836.  
  4837. 
  4838. File: gdb,  Node: Modula-2,  Prev: C,  Up: Support
  4839.  
  4840. Modula-2
  4841. --------
  4842.  
  4843.    The extensions made to GDB to support Modula-2 only support output
  4844. from the GNU Modula-2 compiler (which is currently being developed).
  4845. Other Modula-2 compilers are not currently supported, and attempting to
  4846. debug executables produced by them is most likely to give an error as
  4847. GDB reads in the executable's symbol table.
  4848.  
  4849. * Menu:
  4850.  
  4851. * M2 Operators::                Built-in operators
  4852. * Built-In Func/Proc::           Built-in functions and procedures
  4853. * M2 Constants::                Modula-2 constants
  4854. * M2 Defaults::                 Default settings for Modula-2
  4855. * Deviations::                  Deviations from standard Modula-2
  4856. * M2 Checks::                   Modula-2 type and range checks
  4857. * M2 Scope::                    The scope operators `::' and `.'
  4858. * GDB/M2::                      GDB and Modula-2
  4859.  
  4860. 
  4861. File: gdb,  Node: M2 Operators,  Next: Built-In Func/Proc,  Up: Modula-2
  4862.  
  4863. Operators
  4864. .........
  4865.  
  4866.    Operators must be defined on values of specific types.  For instance,
  4867. `+' is defined on numbers, but not on structures.  Operators are often
  4868. defined on groups of types.  For the purposes of Modula-2, the
  4869. following definitions hold:
  4870.  
  4871.    * *Integral types* consist of `INTEGER', `CARDINAL', and their
  4872.      subranges.
  4873.  
  4874.    * *Character types* consist of `CHAR' and its subranges.
  4875.  
  4876.    * *Floating-point types* consist of `REAL'.
  4877.  
  4878.    * *Pointer types* consist of anything declared as `POINTER TO TYPE'.
  4879.  
  4880.    * *Scalar types* consist of all of the above.
  4881.  
  4882.    * *Set types* consist of `SET' and `BITSET' types.
  4883.  
  4884.    * *Boolean types* consist of `BOOLEAN'.
  4885.  
  4886. The following operators are supported, and appear in order of
  4887. increasing precedence:
  4888.  
  4889. `,'
  4890.      Function argument or array index separator.
  4891.  
  4892. `:='
  4893.      Assignment.  The value of VAR `:=' VALUE is VALUE.
  4894.  
  4895. `<, >'
  4896.      Less than, greater than on integral, floating-point, or enumerated
  4897.      types.
  4898.  
  4899. `<=, >='
  4900.      Less than, greater than, less than or equal to, greater than or
  4901.      equal to on integral, floating-point and enumerated types, or set
  4902.      inclusion on set types.  Same precedence as `<'.
  4903.  
  4904. `=, <>, #'
  4905.      Equality and two ways of expressing inequality, valid on scalar
  4906.      types.  Same precedence as `<'.  In GDB scripts, only `<>' is
  4907.      available for inequality, since `#' conflicts with the script
  4908.      comment character.
  4909.  
  4910. `IN'
  4911.      Set membership.  Defined on set types and the types of their
  4912.      members.  Same precedence as `<'.
  4913.  
  4914. `OR'
  4915.      Boolean disjunction.  Defined on boolean types.
  4916.  
  4917. `AND, &'
  4918.      Boolean conjuction.  Defined on boolean types.
  4919.  
  4920. `@'
  4921.      The GDB "artificial array" operator (*note Expressions:
  4922.      Expressions.).
  4923.  
  4924. `+, -'
  4925.      Addition and subtraction on integral and floating-point types, or
  4926.      union and difference on set types.
  4927.  
  4928. `*'
  4929.      Multiplication on integral and floating-point types, or set
  4930.      intersection on set types.
  4931.  
  4932. `/'
  4933.      Division on floating-point types, or symmetric set difference on
  4934.      set types.  Same precedence as `*'.
  4935.  
  4936. `DIV, MOD'
  4937.      Integer division and remainder.  Defined on integral types.  Same
  4938.      precedence as `*'.
  4939.  
  4940. `-'
  4941.      Negative. Defined on `INTEGER' and `REAL' data.
  4942.  
  4943. `^'
  4944.      Pointer dereferencing.  Defined on pointer types.
  4945.  
  4946. `NOT'
  4947.      Boolean negation.  Defined on boolean types.  Same precedence as
  4948.      `^'.
  4949.  
  4950. `.'
  4951.      `RECORD' field selector.  Defined on `RECORD' data.  Same
  4952.      precedence as `^'.
  4953.  
  4954. `[]'
  4955.      Array indexing.  Defined on `ARRAY' data.  Same precedence as `^'.
  4956.  
  4957. `()'
  4958.      Procedure argument list.  Defined on `PROCEDURE' objects.  Same
  4959.      precedence as `^'.
  4960.  
  4961. `::, .'
  4962.      GDB and Modula-2 scope operators.
  4963.  
  4964.      *Warning:* Sets and their operations are not yet supported, so GDB
  4965.      treats the use of the operator `IN', or the use of operators `+',
  4966.      `-', `*', `/', `=', , `<>', `#', `<=', and `>=' on sets as an
  4967.      error.
  4968.  
  4969. 
  4970. File: gdb,  Node: Built-In Func/Proc,  Next: M2 Constants,  Prev: M2 Operators,  Up: Modula-2
  4971.  
  4972. Built-in functions and procedures
  4973. .................................
  4974.  
  4975.    Modula-2 also makes available several built-in procedures and
  4976. functions.  In describing these, the following metavariables are used:
  4977.  
  4978. A
  4979.      represents an `ARRAY' variable.
  4980.  
  4981. C
  4982.      represents a `CHAR' constant or variable.
  4983.  
  4984. I
  4985.      represents a variable or constant of integral type.
  4986.  
  4987. M
  4988.      represents an identifier that belongs to a set.  Generally used in
  4989.      the same function with the metavariable S.  The type of S should
  4990.      be `SET OF MTYPE' (where MTYPE is the type of M).
  4991.  
  4992. N
  4993.      represents a variable or constant of integral or floating-point
  4994.      type.
  4995.  
  4996. R
  4997.      represents a variable or constant of floating-point type.
  4998.  
  4999. T
  5000.      represents a type.
  5001.  
  5002. V
  5003.      represents a variable.
  5004.  
  5005. X
  5006.      represents a variable or constant of one of many types.  See the
  5007.      explanation of the function for details.
  5008.  
  5009.    All Modula-2 built-in procedures also return a result, described
  5010. below.
  5011.  
  5012. `ABS(N)'
  5013.      Returns the absolute value of N.
  5014.  
  5015. `CAP(C)'
  5016.      If C is a lower case letter, it returns its upper case equivalent,
  5017.      otherwise it returns its argument
  5018.  
  5019. `CHR(I)'
  5020.      Returns the character whose ordinal value is I.
  5021.  
  5022. `DEC(V)'
  5023.      Decrements the value in the variable V.  Returns the new value.
  5024.  
  5025. `DEC(V,I)'
  5026.      Decrements the value in the variable V by I.  Returns the new
  5027.      value.
  5028.  
  5029. `EXCL(M,S)'
  5030.      Removes the element M from the set S.  Returns the new set.
  5031.  
  5032. `FLOAT(I)'
  5033.      Returns the floating point equivalent of the integer I.
  5034.  
  5035. `HIGH(A)'
  5036.      Returns the index of the last member of A.
  5037.  
  5038. `INC(V)'
  5039.      Increments the value in the variable V.  Returns the new value.
  5040.  
  5041. `INC(V,I)'
  5042.      Increments the value in the variable V by I.  Returns the new
  5043.      value.
  5044.  
  5045. `INCL(M,S)'
  5046.      Adds the element M to the set S if it is not already there.
  5047.      Returns the new set.
  5048.  
  5049. `MAX(T)'
  5050.      Returns the maximum value of the type T.
  5051.  
  5052. `MIN(T)'
  5053.      Returns the minimum value of the type T.
  5054.  
  5055. `ODD(I)'
  5056.      Returns boolean TRUE if I is an odd number.
  5057.  
  5058. `ORD(X)'
  5059.      Returns the ordinal value of its argument.  For example, the
  5060.      ordinal value of a character is its ASCII value (on machines
  5061.      supporting the ASCII character set).  X must be of an ordered
  5062.      type, which include integral, character and enumerated types.
  5063.  
  5064. `SIZE(X)'
  5065.      Returns the size of its argument.  X can be a variable or a type.
  5066.  
  5067. `TRUNC(R)'
  5068.      Returns the integral part of R.
  5069.  
  5070. `VAL(T,I)'
  5071.      Returns the member of the type T whose ordinal value is I.
  5072.  
  5073.      *Warning:*  Sets and their operations are not yet supported, so
  5074.      GDB treats the use of procedures `INCL' and `EXCL' as an error.
  5075.  
  5076. 
  5077. File: gdb,  Node: M2 Constants,  Next: M2 Defaults,  Prev: Built-In Func/Proc,  Up: Modula-2
  5078.  
  5079. Constants
  5080. .........
  5081.  
  5082.    GDB allows you to express the constants of Modula-2 in the following
  5083. ways:
  5084.  
  5085.    * Integer constants are simply a sequence of digits.  When used in an
  5086.      expression, a constant is interpreted to be type-compatible with
  5087.      the rest of the expression.  Hexadecimal integers are specified by
  5088.      a trailing `H', and octal integers by a trailing `B'.
  5089.  
  5090.    * Floating point constants appear as a sequence of digits, followed
  5091.      by a decimal point and another sequence of digits.  An optional
  5092.      exponent can then be specified, in the form `E[+|-]NNN', where
  5093.      `[+|-]NNN' is the desired exponent.  All of the digits of the
  5094.      floating point constant must be valid decimal (base 10) digits.
  5095.  
  5096.    * Character constants consist of a single character enclosed by a
  5097.      pair of like quotes, either single (`'') or double (`"').  They may
  5098.      also be expressed by their ordinal value (their ASCII value,
  5099.      usually) followed by a `C'.
  5100.  
  5101.    * String constants consist of a sequence of characters enclosed by a
  5102.      pair of like quotes, either single (`'') or double (`"').  Escape
  5103.      sequences in the style of C are also allowed.  *Note C and C++
  5104.      constants: C Constants, for a brief explanation of escape
  5105.      sequences.
  5106.  
  5107.    * Enumerated constants consist of an enumerated identifier.
  5108.  
  5109.    * Boolean constants consist of the identifiers `TRUE' and `FALSE'.
  5110.  
  5111.    * Pointer constants consist of integral values only.
  5112.  
  5113.    * Set constants are not yet supported.
  5114.  
  5115. 
  5116. File: gdb,  Node: M2 Defaults,  Next: Deviations,  Prev: M2 Constants,  Up: Modula-2
  5117.  
  5118. Modula-2 defaults
  5119. .................
  5120.  
  5121.    If type and range checking are set automatically by GDB, they both
  5122. default to `on' whenever the working language changes to Modula-2.
  5123. This happens regardless of whether you, or GDB, selected the working
  5124. language.
  5125.  
  5126.    If you allow GDB to set the language automatically, then entering
  5127. code compiled from a file whose name ends with `.mod' sets the working
  5128. language to Modula-2. *Note Having GDB set the language automatically:
  5129. Automatically, for further details.
  5130.  
  5131. 
  5132. File: gdb,  Node: Deviations,  Next: M2 Checks,  Prev: M2 Defaults,  Up: Modula-2
  5133.  
  5134. Deviations from standard Modula-2
  5135. .................................
  5136.  
  5137.    A few changes have been made to make Modula-2 programs easier to
  5138. debug.  This is done primarily via loosening its type strictness:
  5139.  
  5140.    * Unlike in standard Modula-2, pointer constants can be formed by
  5141.      integers.  This allows you to modify pointer variables during
  5142.      debugging.  (In standard Modula-2, the actual address contained in
  5143.      a pointer variable is hidden from you; it can only be modified
  5144.      through direct assignment to another pointer variable or
  5145.      expression that returned a pointer.)
  5146.  
  5147.    * C escape sequences can be used in strings and characters to
  5148.      represent non-printable characters.  GDB prints out strings with
  5149.      these escape sequences embedded.  Single non-printable characters
  5150.      are printed using the `CHR(NNN)' format.
  5151.  
  5152.    * The assignment operator (`:=') returns the value of its right-hand
  5153.      argument.
  5154.  
  5155.    * All built-in procedures both modify *and* return their argument.
  5156.  
  5157. 
  5158. File: gdb,  Node: M2 Checks,  Next: M2 Scope,  Prev: Deviations,  Up: Modula-2
  5159.  
  5160. Modula-2 type and range checks
  5161. ..............................
  5162.  
  5163.      *Warning:* in this release, GDB does not yet perform type or range
  5164.      checking.
  5165.  
  5166.    GDB considers two Modula-2 variables type equivalent if:
  5167.  
  5168.    * They are of types that have been declared equivalent via a `TYPE
  5169.      T1 = T2' statement
  5170.  
  5171.    * They have been declared on the same line.  (Note:  This is true of
  5172.      the GNU Modula-2 compiler, but it may not be true of other
  5173.      compilers.)
  5174.  
  5175.    As long as type checking is enabled, any attempt to combine variables
  5176. whose types are not equivalent is an error.
  5177.  
  5178.    Range checking is done on all mathematical operations, assignment,
  5179. array index bounds, and all built-in functions and procedures.
  5180.  
  5181. 
  5182. File: gdb,  Node: M2 Scope,  Next: GDB/M2,  Prev: M2 Checks,  Up: Modula-2
  5183.  
  5184. The scope operators `::' and `.'
  5185. ................................
  5186.  
  5187.    There are a few subtle differences between the Modula-2 scope
  5188. operator (`.') and the GDB scope operator (`::').  The two have similar
  5189. syntax:
  5190.  
  5191.  
  5192.      MODULE . ID
  5193.      SCOPE :: ID
  5194.  
  5195. where SCOPE is the name of a module or a procedure, MODULE the name of
  5196. a module, and ID is any declared identifier within your program, except
  5197. another module.
  5198.  
  5199.    Using the `::' operator makes GDB search the scope specified by
  5200. SCOPE for the identifier ID.  If it is not found in the specified
  5201. scope, then GDB searches all scopes enclosing the one specified by
  5202. SCOPE.
  5203.  
  5204.    Using the `.' operator makes GDB search the current scope for the
  5205. identifier specified by ID that was imported from the definition module
  5206. specified by MODULE.  With this operator, it is an error if the
  5207. identifier ID was not imported from definition module MODULE, or if ID
  5208. is not an identifier in MODULE.
  5209.  
  5210. 
  5211. File: gdb,  Node: GDB/M2,  Prev: M2 Scope,  Up: Modula-2
  5212.  
  5213. GDB and Modula-2
  5214. ................
  5215.  
  5216.    Some GDB commands have little use when debugging Modula-2 programs.
  5217. Five subcommands of `set print' and `show print' apply specifically to
  5218. C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'.
  5219. The first four apply to C++, and the last to the C `union' type, which
  5220. has no direct analogue in Modula-2.
  5221.  
  5222.    The `@' operator (*note Expressions: Expressions.), while available
  5223. while using any language, is not useful with Modula-2.  Its intent is
  5224. to aid the debugging of "dynamic arrays", which cannot be created in
  5225. Modula-2 as they can in C or C++.  However, because an address can be
  5226. specified by an integral constant, the construct `{TYPE}ADREXP' is
  5227. still useful.  (*note Expressions: Expressions.)
  5228.  
  5229.    In GDB scripts, the Modula-2 inequality operator `#' is interpreted
  5230. as the beginning of a comment.  Use `<>' instead.
  5231.  
  5232. 
  5233. File: gdb,  Node: Symbols,  Next: Altering,  Prev: Languages,  Up: Top
  5234.  
  5235. Examining the Symbol Table
  5236. **************************
  5237.  
  5238.    The commands described in this section allow you to inquire about the
  5239. symbols (names of variables, functions and types) defined in your
  5240. program.  This information is inherent in the text of your program and
  5241. does not change as your program executes.  GDB finds it in your
  5242. program's symbol table, in the file indicated when you started GDB
  5243. (*note Choosing files: File Options.), or by one of the file-management
  5244. commands (*note Commands to specify files: Files.).
  5245.  
  5246.    Occasionally, you may need to refer to symbols that contain unusual
  5247. characters, which GDB ordinarily treats as word delimiters.  The most
  5248. frequent case is in referring to static variables in other source files
  5249. (*note Program variables: Variables.).  File names are recorded in
  5250. object files as debugging symbols, but GDB would ordinarily parse a
  5251. typical file name, like `foo.c', as the three words `foo' `.' `c'.  To
  5252. allow GDB to recognize `foo.c' as a single symbol, enclose it in single
  5253. quotes; for example,
  5254.  
  5255.      p 'foo.c'::x
  5256.  
  5257. looks up the value of `x' in the scope of the file `foo.c'.
  5258.  
  5259. `info address SYMBOL'
  5260.      Describe where the data for SYMBOL is stored.  For a register
  5261.      variable, this says which register it is kept in.  For a
  5262.      non-register local variable, this prints the stack-frame offset at
  5263.      which the variable is always stored.
  5264.  
  5265.      Note the contrast with `print &SYMBOL', which does not work at all
  5266.      for a register variable, and for a stack local variable prints the
  5267.      exact address of the current instantiation of the variable.
  5268.  
  5269. `whatis EXP'
  5270.      Print the data type of expression EXP.  EXP is not actually
  5271.      evaluated, and any side-effecting operations (such as assignments
  5272.      or function calls) inside it do not take place.  *Note
  5273.      Expressions: Expressions.
  5274.  
  5275. `whatis'
  5276.      Print the data type of `$', the last value in the value history.
  5277.  
  5278. `ptype TYPENAME'
  5279.      Print a description of data type TYPENAME.  TYPENAME may be the
  5280.      name of a type, or for C code it may have the form `class
  5281.      CLASS-NAME', `struct STRUCT-TAG', `union UNION-TAG' or `enum
  5282.      ENUM-TAG'.
  5283.  
  5284. `ptype EXP'
  5285. `ptype'
  5286.      Print a description of the type of expression EXP.  `ptype'
  5287.      differs from `whatis' by printing a detailed description, instead
  5288.      of just the name of the type.
  5289.  
  5290.      For example, for this variable declaration:
  5291.  
  5292.           struct complex {double real; double imag;} v;
  5293.  
  5294.      the two commands give this output:
  5295.  
  5296.           (gdb) whatis v
  5297.           type = struct complex
  5298.           (gdb) ptype v
  5299.           type = struct complex {
  5300.               double real;
  5301.               double imag;
  5302.           }
  5303.  
  5304.      As with `whatis', using `ptype' without an argument refers to the
  5305.      type of `$', the last value in the value history.
  5306.  
  5307. `info types REGEXP'
  5308. `info types'
  5309.      Print a brief description of all types whose name matches REGEXP
  5310.      (or all types in your program, if you supply no argument).  Each
  5311.      complete typename is matched as though it were a complete line;
  5312.      thus, `i type value' gives information on all types in your
  5313.      program whose name includes the string `value', but `i type
  5314.      ^value$' gives information only on types whose complete name is
  5315.      `value'.
  5316.  
  5317.      This command differs from `ptype' in two ways: first, like
  5318.      `whatis', it does not print a detailed description; second, it
  5319.      lists all source files where a type is defined.
  5320.  
  5321. `info source'
  5322.      Show the name of the current source file--that is, the source file
  5323.      for the function containing the current point of execution--and
  5324.      the language it was written in.
  5325.  
  5326. `info sources'
  5327.      Print the names of all source files in your program for which
  5328.      there is debugging information, organized into two lists: files
  5329.      whose symbols have already been read, and files whose symbols will
  5330.      be read when needed.
  5331.  
  5332. `info functions'
  5333.      Print the names and data types of all defined functions.
  5334.  
  5335. `info functions REGEXP'
  5336.      Print the names and data types of all defined functions whose
  5337.      names contain a match for regular expression REGEXP.  Thus, `info
  5338.      fun step' finds all functions whose names include `step'; `info
  5339.      fun ^step' finds those whose names start with `step'.
  5340.  
  5341. `info variables'
  5342.      Print the names and data types of all variables that are declared
  5343.      outside of functions (i.e., excluding local variables).
  5344.  
  5345. `info variables REGEXP'
  5346.      Print the names and data types of all variables (except for local
  5347.      variables) whose names contain a match for regular expression
  5348.      REGEXP.
  5349.  
  5350.      Some systems allow individual object files that make up your
  5351.      program to be replaced without stopping and restarting your
  5352.      program.  For example, in VxWorks you can simply recompile a
  5353.      defective object file and keep on running.  If you are running on
  5354.      one of these systems, you can allow GDB to reload the symbols for
  5355.      automatically relinked modules:
  5356.  
  5357.     `set symbol-reloading on'
  5358.           Replace symbol definitions for the corresponding source file
  5359.           when an object file with a particular name is seen again.
  5360.  
  5361.     `set symbol-reloading off'
  5362.           Do not replace symbol definitions when re-encountering object
  5363.           files of the same name.  This is the default state; if you
  5364.           are not running on a system that permits automatically
  5365.           relinking modules, you should leave `symbol-reloading' off,
  5366.           since otherwise GDB may discard symbols when linking large
  5367.           programs, that may contain several modules (from different
  5368.           directories or libraries) with the same name.
  5369.  
  5370.     `show symbol-reloading'
  5371.           Show the current `on' or `off' setting.
  5372.  
  5373. `maint print symbols FILENAME'
  5374. `maint print psymbols FILENAME'
  5375. `maint print msymbols FILENAME'
  5376.      Write a dump of debugging symbol data into the file FILENAME.
  5377.      These commands are used to debug the GDB symbol-reading code.  Only
  5378.      symbols with debugging data are included.  If you use `maint print
  5379.      symbols', GDB includes all the symbols for which it has already
  5380.      collected full details: that is, FILENAME reflects symbols for
  5381.      only those files whose symbols GDB has read.  You can use the
  5382.      command `info sources' to find out which files these are.  If you
  5383.      use `maint print psymbols' instead, the dump shows information
  5384.      about symbols that GDB only knows partially--that is, symbols
  5385.      defined in files that GDB has skimmed, but not yet read
  5386.      completely.  Finally, `maint print msymbols' dumps just the
  5387.      minimal symbol information required for each object file from
  5388.      which GDB has read some symbols.  *Note Commands to specify files:
  5389.      Files, for a discussion of how GDB reads symbols (in the
  5390.      description of `symbol-file').
  5391.  
  5392. 
  5393. File: gdb,  Node: Altering,  Next: GDB Files,  Prev: Symbols,  Up: Top
  5394.  
  5395. Altering Execution
  5396. ******************
  5397.  
  5398.    Once you think you have found an error in your program, you might
  5399. want to find out for certain whether correcting the apparent error
  5400. would lead to correct results in the rest of the run.  You can find the
  5401. answer by experiment, using the GDB features for altering execution of
  5402. the program.
  5403.  
  5404.    For example, you can store new values into variables or memory
  5405. locations, give your program a signal, restart it at a different
  5406. address, or even return prematurely from a function.
  5407.  
  5408. * Menu:
  5409.  
  5410. * Assignment::                  Assignment to variables
  5411. * Jumping::                     Continuing at a different address
  5412.  
  5413. * Signaling::                   Giving your program a signal
  5414.  
  5415. * Returning::                   Returning from a function
  5416. * Calling::                     Calling your program's functions
  5417. * Patching::                    Patching your program
  5418.  
  5419. 
  5420. File: gdb,  Node: Assignment,  Next: Jumping,  Up: Altering
  5421.  
  5422. Assignment to variables
  5423. =======================
  5424.  
  5425.    To alter the value of a variable, evaluate an assignment expression.
  5426. *Note Expressions: Expressions.  For example,
  5427.  
  5428.      print x=4
  5429.  
  5430. stores the value 4 into the variable `x', and then prints the value of
  5431. the assignment expression (which is 4).  *Note Using GDB with Different
  5432. Languages: Languages, for more information on operators in supported
  5433. languages.
  5434.  
  5435.    If you are not interested in seeing the value of the assignment, use
  5436. the `set' command instead of the `print' command.  `set' is really the
  5437. same as `print' except that the expression's value is not printed and
  5438. is not put in the value history (*note Value history: Value History.).
  5439. The expression is evaluated only for its effects.
  5440.  
  5441.    If the beginning of the argument string of the `set' command appears
  5442. identical to a `set' subcommand, use the `set variable' command instead
  5443. of just `set'.  This command is identical to `set' except for its lack
  5444. of subcommands.  For example, if your program has a variable `width',
  5445. you get an error if you try to set a new value with just `set width=13',
  5446. because GDB has the command `set width':
  5447.  
  5448.      (gdb) whatis width
  5449.      type = double
  5450.      (gdb) p width
  5451.      $4 = 13
  5452.      (gdb) set width=47
  5453.      Invalid syntax in expression.
  5454.  
  5455. The invalid expression, of course, is `=47'.  In order to actually set
  5456. the program's variable `width', use
  5457.  
  5458.      (gdb) set var width=47
  5459.  
  5460.    GDB allows more implicit conversions in assignments than C; you can
  5461. freely store an integer value into a pointer variable or vice versa,
  5462. and you can convert any structure to any other structure that is the
  5463. same length or shorter.
  5464.  
  5465.    To store values into arbitrary places in memory, use the `{...}'
  5466. construct to generate a value of specified type at a specified address
  5467. (*note Expressions: Expressions.).  For example, `{int}0x83040' refers
  5468. to memory location `0x83040' as an integer (which implies a certain size
  5469. and representation in memory), and
  5470.  
  5471.      set {int}0x83040 = 4
  5472.  
  5473. stores the value 4 into that memory location.
  5474.  
  5475. 
  5476. File: gdb,  Node: Jumping,  Next: Signaling,  Prev: Assignment,  Up: Altering
  5477.  
  5478. Continuing at a different address
  5479. =================================
  5480.  
  5481.    Ordinarily, when you continue your program, you do so at the place
  5482. where it stopped, with the `continue' command.  You can instead
  5483. continue at an address of your own choosing, with the following
  5484. commands:
  5485.  
  5486. `jump LINESPEC'
  5487.      Resume execution at line LINESPEC.  Execution stops again
  5488.      immediately if there is a breakpoint there.  *Note Printing source
  5489.      lines: List, for a description of the different forms of LINESPEC.
  5490.  
  5491.      The `jump' command does not change the current stack frame, or the
  5492.      stack pointer, or the contents of any memory location or any
  5493.      register other than the program counter.  If line LINESPEC is in a
  5494.      different function from the one currently executing, the results
  5495.      may be bizarre if the two functions expect different patterns of
  5496.      arguments or of local variables.  For this reason, the `jump'
  5497.      command requests confirmation if the specified line is not in the
  5498.      function currently executing.  However, even bizarre results are
  5499.      predictable if you are well acquainted with the machine-language
  5500.      code of your program.
  5501.  
  5502. `jump *ADDRESS'
  5503.      Resume execution at the instruction at address ADDRESS.
  5504.  
  5505.    You can get much the same effect as the `jump' command by storing a
  5506. new value into the register `$pc'.  The difference is that this does
  5507. not start your program running; it only changes the address of where it
  5508. *will* run when you continue.  For example,
  5509.  
  5510.      set $pc = 0x485
  5511.  
  5512. makes the next `continue' command or stepping command execute at
  5513. address `0x485', rather than at the address where your program stopped.
  5514. *Note Continuing and stepping: Continuing and Stepping.
  5515.  
  5516.    The most common occasion to use the `jump' command is to back up-
  5517. perhaps with more breakpoints set-over a portion of a program that has
  5518. already executed, in order to examine its execution in more detail.
  5519.  
  5520. 
  5521. File: gdb,  Node: Signaling,  Next: Returning,  Prev: Jumping,  Up: Altering
  5522.  
  5523. Giving your program a signal
  5524. ============================
  5525.  
  5526. `signal SIGNAL'
  5527.      Resume execution where your program stopped, but immediately give
  5528.      it the signal SIGNAL.  SIGNAL can be the name or the number of a
  5529.      signal.  For example, on many systems `signal 2' and `signal
  5530.      SIGINT' are both ways of sending an interrupt signal.
  5531.  
  5532.      Alternatively, if SIGNAL is zero, continue execution without
  5533.      giving a signal.  This is useful when your program stopped on
  5534.      account of a signal and would ordinary see the signal when resumed
  5535.      with the `continue' command; `signal 0' causes it to resume
  5536.      without a signal.
  5537.  
  5538.      `signal' does not repeat when you press RET a second time after
  5539.      executing the command.
  5540.  
  5541.    Invoking the `signal' command is not the same as invoking the `kill'
  5542. utility from the shell.  Sending a signal with `kill' causes GDB to
  5543. decide what to do with the signal depending on the signal handling
  5544. tables (*note Signals::.).  The `signal' command passes the signal
  5545. directly to your program.
  5546.  
  5547. 
  5548. File: gdb,  Node: Returning,  Next: Calling,  Prev: Signaling,  Up: Altering
  5549.  
  5550. Returning from a function
  5551. =========================
  5552.  
  5553. `return'
  5554. `return EXPRESSION'
  5555.      You can cancel execution of a function call with the `return'
  5556.      command.  If you give an EXPRESSION argument, its value is used as
  5557.      the function's return value.
  5558.  
  5559.    When you use `return', GDB discards the selected stack frame (and
  5560. all frames within it).  You can think of this as making the discarded
  5561. frame return prematurely.  If you wish to specify a value to be
  5562. returned, give that value as the argument to `return'.
  5563.  
  5564.    This pops the selected stack frame (*note Selecting a frame:
  5565. Selection.), and any other frames inside of it, leaving its caller as
  5566. the innermost remaining frame.  That frame becomes selected.  The
  5567. specified value is stored in the registers used for returning values of
  5568. functions.
  5569.  
  5570.    The `return' command does not resume execution; it leaves the
  5571. program stopped in the state that would exist if the function had just
  5572. returned.  In contrast, the `finish' command (*note Continuing and
  5573. stepping: Continuing and Stepping.) resumes execution until the
  5574. selected stack frame returns naturally.
  5575.  
  5576. 
  5577. File: gdb,  Node: Calling,  Next: Patching,  Prev: Returning,  Up: Altering
  5578.  
  5579. Calling program functions
  5580. =========================
  5581.  
  5582. `call EXPR'
  5583.      Evaluate the expression EXPR without displaying `void' returned
  5584.      values.
  5585.  
  5586.    You can use this variant of the `print' command if you want to
  5587. execute a function from your program, but without cluttering the output
  5588. with `void' returned values.  If the result is not void, it is printed
  5589. and saved in the value history.
  5590.  
  5591.    A new user-controlled variable, CALL_SCRATCH_ADDRESS, specifies the
  5592. location of a scratch area to be used when GDB calls a function in the
  5593. target.  This is necessary because the usual method of putting the
  5594. scratch area on the stack does not work in systems that have separate
  5595. instruction and data spaces.
  5596.  
  5597. 
  5598. File: gdb,  Node: Patching,  Prev: Calling,  Up: Altering
  5599.  
  5600. Patching programs
  5601. =================
  5602.  
  5603.    By default, GDB opens the file containing your program's executable
  5604. code (or the corefile) read-only.  This prevents accidental alterations
  5605. to machine code; but it also prevents you from intentionally patching
  5606. your program's binary.
  5607.  
  5608.    If you'd like to be able to patch the binary, you can specify that
  5609. explicitly with the `set write' command.  For example, you might want
  5610. to turn on internal debugging flags, or even to make emergency repairs.
  5611.  
  5612. `set write on'
  5613. `set write off'
  5614.      If you specify `set write on', GDB opens executable and core files
  5615.      for both reading and writing; if you specify `set write off' (the
  5616.      default), GDB opens them read-only.
  5617.  
  5618.      If you have already loaded a file, you must load it again (using
  5619.      the `exec-file' or `core-file' command) after changing `set
  5620.      write', for your new setting to take effect.
  5621.  
  5622. `show write'
  5623.      Display whether executable files and core files are opened for
  5624.      writing as well as reading.
  5625.  
  5626. 
  5627. File: gdb,  Node: GDB Files,  Next: Targets,  Prev: Altering,  Up: Top
  5628.  
  5629. GDB Files
  5630. *********
  5631.  
  5632.    GDB needs to know the file name of the program to be debugged, both
  5633. in order to read its symbol table and in order to start your program.
  5634. To debug a core dump of a previous run, you must also tell GDB the name
  5635. of the core dump file.
  5636.  
  5637. * Menu:
  5638.  
  5639. * Files::                       Commands to specify files
  5640. * Symbol Errors::               Errors reading symbol files
  5641.  
  5642. 
  5643. File: gdb,  Node: Files,  Next: Symbol Errors,  Up: GDB Files
  5644.  
  5645. Commands to specify files
  5646. =========================
  5647.  
  5648.    You may want to specify executable and core dump file names.  The
  5649. usual way to do this is at start-up time, using the arguments to GDB's
  5650. start-up commands (*note Getting In and Out of GDB: Invocation.).
  5651.  
  5652.    Occasionally it is necessary to change to a different file during a
  5653. GDB session.  Or you may run GDB and forget to specify a file you want
  5654. to use.  In these situations the GDB commands to specify new files are
  5655. useful.
  5656.  
  5657. `file FILENAME'
  5658.      Use FILENAME as the program to be debugged.  It is read for its
  5659.      symbols and for the contents of pure memory.  It is also the
  5660.      program executed when you use the `run' command.  If you do not
  5661.      specify a directory and the file is not found in the GDB working
  5662.      directory, GDB uses the environment variable `PATH' as a list of
  5663.      directories to search, just as the shell does when looking for a
  5664.      program to run.  You can change the value of this variable, for
  5665.      both GDB and your program, using the `path' command.
  5666.  
  5667.      On systems with memory-mapped files, an auxiliary file
  5668.      `FILENAME.syms' may hold symbol table information for FILENAME.
  5669.      If so, GDB maps in the symbol table from `FILENAME.syms', starting
  5670.      up more quickly.  See the descriptions of the file options
  5671.      `-mapped' and `-readnow' (available on the command line, and with
  5672.      the commands `file', `symbol-file', or `add-symbol-file',
  5673.      described below), for more information.
  5674.  
  5675. `file'
  5676.      `file' with no argument makes GDB discard any information it has
  5677.      on both executable file and the symbol table.
  5678.  
  5679. `exec-file [ FILENAME ]'
  5680.      Specify that the program to be run (but not the symbol table) is
  5681.      found in FILENAME.  GDB searches the environment variable `PATH'
  5682.      if necessary to locate your program.  Omitting FILENAME means to
  5683.      discard information on the executable file.
  5684.  
  5685. `symbol-file [ FILENAME ]'
  5686.      Read symbol table information from file FILENAME.  `PATH' is
  5687.      searched when necessary.  Use the `file' command to get both symbol
  5688.      table and program to run from the same file.
  5689.  
  5690.      `symbol-file' with no argument clears out GDB information on your
  5691.      program's symbol table.
  5692.  
  5693.      The `symbol-file' command causes GDB to forget the contents of its
  5694.      convenience variables, the value history, and all breakpoints and
  5695.      auto-display expressions.  This is because they may contain
  5696.      pointers to the internal data recording symbols and data types,
  5697.      which are part of the old symbol table data being discarded inside
  5698.      GDB.
  5699.  
  5700.      `symbol-file' does not repeat if you press RET again after
  5701.      executing it once.
  5702.  
  5703.      When GDB is configured for a particular environment, it
  5704.      understands debugging information in whatever format is the
  5705.      standard generated for that environment; you may use either a GNU
  5706.      compiler, or other compilers that adhere to the local conventions.
  5707.      Best results are usually obtained from GNU compilers; for
  5708.      example, using `gcc' you can generate debugging information for
  5709.      optimized code.
  5710.  
  5711.      On some kinds of object files, the `symbol-file' command does not
  5712.      normally read the symbol table in full right away.  Instead, it
  5713.      scans the symbol table quickly to find which source files and
  5714.      which symbols are present.  The details are read later, one source
  5715.      file at a time, as they are needed.
  5716.  
  5717.      The purpose of this two-stage reading strategy is to make GDB
  5718.      start up faster.  For the most part, it is invisible except for
  5719.      occasional pauses while the symbol table details for a particular
  5720.      source file are being read.  (The `set verbose' command can turn
  5721.      these pauses into messages if desired.  *Note Optional warnings
  5722.      and messages: Messages/Warnings.)
  5723.  
  5724.      We have not implemented the two-stage strategy for COFF yet.  When
  5725.      the symbol table is stored in COFF format, `symbol-file' reads the
  5726.      symbol table data in full right away.
  5727.  
  5728. `symbol-file FILENAME [ -readnow ] [ -mapped ]'
  5729. `file FILENAME [ -readnow ] [ -mapped ]'
  5730.      You can override the GDB two-stage strategy for reading symbol
  5731.      tables by using the `-readnow' option with any of the commands that
  5732.      load symbol table information, if you want to be sure GDB has the
  5733.      entire symbol table available.
  5734.  
  5735.      If memory-mapped files are available on your system through the
  5736.      `mmap' system call, you can use another option, `-mapped', to
  5737.      cause GDB to write the symbols for your program into a reusable
  5738.      file.  Future GDB debugging sessions map in symbol information
  5739.      from this auxiliary symbol file (if the program has not changed),
  5740.      rather than spending time reading the symbol table from the
  5741.      executable program.  Using the `-mapped' option has the same
  5742.      effect as starting GDB with the `-mapped' command-line option.
  5743.  
  5744.      You can use both options together, to make sure the auxiliary
  5745.      symbol file has all the symbol information for your program.
  5746.  
  5747.      The auxiliary symbol file for a program called MYPROG is called
  5748.      `MYPROG.syms'.  Once this file exists (so long as it is newer than
  5749.      the corresponding executable), GDB always attempts to use it when
  5750.      you debug MYPROG; no special options or commands are needed.
  5751.  
  5752.      The `.syms' file is specific to the host machine where you run
  5753.      GDB.  It holds an exact image of the internal GDB symbol table.
  5754.      It cannot be shared across multiple host platforms.
  5755.  
  5756. `core-file [ FILENAME ]'
  5757.      Specify the whereabouts of a core dump file to be used as the
  5758.      "contents of memory".  Traditionally, core files contain only some
  5759.      parts of the address space of the process that generated them; GDB
  5760.      can access the executable file itself for other parts.
  5761.  
  5762.      `core-file' with no argument specifies that no core file is to be
  5763.      used.
  5764.  
  5765.      Note that the core file is ignored when your program is actually
  5766.      running under GDB.  So, if you have been running your program and
  5767.      you wish to debug a core file instead, you must kill the
  5768.      subprocess in which the program is running.  To do this, use the
  5769.      `kill' command (*note Killing the child process: Kill Process.).
  5770.  
  5771. `load FILENAME'
  5772.      Depending on what remote debugging facilities are configured into
  5773.      GDB, the `load' command may be available.  Where it exists, it is
  5774.      meant to make FILENAME (an executable) available for debugging on
  5775.      the remote system--by downloading, or dynamic linking, for example.
  5776.      `load' also records the FILENAME symbol table in GDB, like the
  5777.      `add-symbol-file' command.
  5778.  
  5779.      If your GDB does not have a `load' command, attempting to execute
  5780.      it gets the error message "`You can't do that when your target is
  5781.      ...'"
  5782.  
  5783.      The file is loaded at whatever address is specified in the
  5784.      executable.  For some object file formats, you can specify the
  5785.      load address when you link the program; for other formats, like
  5786.      a.out, the object file format specifies a fixed address.
  5787.  
  5788.      On VxWorks, `load' links FILENAME dynamically on the current
  5789.      target system as well as adding its symbols in GDB.
  5790.  
  5791.      With the Nindy interface to an Intel 960 board, `load' downloads
  5792.      FILENAME to the 960 as well as adding its symbols in GDB.
  5793.  
  5794.      When you select remote debugging to a Hitachi SH, H8/300, or
  5795.      H8/500 board (*note GDB and Hitachi Microprocessors: Hitachi
  5796.      Remote.), the `load' command downloads your program to the Hitachi
  5797.      board and also opens it as the current executable target for GDB
  5798.      on your host (like the `file' command).
  5799.  
  5800.      `load' does not repeat if you press RET again after using it.
  5801.  
  5802. `add-symbol-file FILENAME ADDRESS'
  5803. `add-symbol-file FILENAME ADDRESS [ -readnow ] [ -mapped ]'
  5804.      The `add-symbol-file' command reads additional symbol table
  5805.      information from the file FILENAME.  You would use this command
  5806.      when FILENAME has been dynamically loaded (by some other means)
  5807.      into the program that is running.  ADDRESS should be the memory
  5808.      address at which the file has been loaded; GDB cannot figure this
  5809.      out for itself.  You can specify ADDRESS as an expression.
  5810.  
  5811.      The symbol table of the file FILENAME is added to the symbol table
  5812.      originally read with the `symbol-file' command.  You can use the
  5813.      `add-symbol-file' command any number of times; the new symbol data
  5814.      thus read keeps adding to the old.  To discard all old symbol data
  5815.      instead, use the `symbol-file' command.
  5816.  
  5817.      `add-symbol-file' does not repeat if you press RET after using it.
  5818.  
  5819.      You can use the `-mapped' and `-readnow' options just as with the
  5820.      `symbol-file' command, to change how GDB manages the symbol table
  5821.      information for FILENAME.
  5822.  
  5823. `add-shared-symbol-file'
  5824.      The `add-shared-symbol-file' command can be used only under
  5825.      Harris' CXUX operating system for the Motorola 88k.  GDB
  5826.      automatically looks for shared libraries, however if GDB does not
  5827.      find yours, you can run `add-shared-symbol-file'.  It takes no
  5828.      arguments.
  5829.  
  5830. `section'
  5831.      The `section' command changes the base address of section SECTION
  5832.      of the exec file to ADDR.  This can be used if the exec file does
  5833.      not contain section addresses, (such as in the a.out format), or
  5834.      when the addresses specified in the file itself are wrong.  Each
  5835.      section must be changed separately.  The "info files" command
  5836.      lists all the sections and their addresses.
  5837.  
  5838. `info files'
  5839. `info target'
  5840.      `info files' and `info target' are synonymous; both print the
  5841.      current target (*note Specifying a Debugging Target: Targets.),
  5842.      including the names of the executable and core dump files
  5843.      currently in use by GDB, and the files from which symbols were
  5844.      loaded.  The command `help target' lists all possible targets
  5845.      rather than current ones.
  5846.  
  5847.    All file-specifying commands allow both absolute and relative file
  5848. names as arguments.  GDB always converts the file name to an absolute
  5849. file name and remembers it that way.
  5850.  
  5851.    GDB supports SunOS, SVr4, Irix 5, and IBM RS/6000 shared libraries.
  5852. GDB automatically loads symbol definitions from shared libraries when
  5853. you use the `run' command, or when you examine a core file.  (Before
  5854. you issue the `run' command, GDB does not understand references to a
  5855. function in a shared library, however--unless you are debugging a core
  5856. file).
  5857.  
  5858. `info share'
  5859. `info sharedlibrary'
  5860.      Print the names of the shared libraries which are currently loaded.
  5861.  
  5862. `sharedlibrary REGEX'
  5863. `share REGEX'
  5864.      Load shared object library symbols for files matching a Unix
  5865.      regular expression.  As with files loaded automatically, it only
  5866.      loads shared libraries required by your program for a core file or
  5867.      after typing `run'.  If REGEX is omitted all shared libraries
  5868.      required by your program are loaded.
  5869.  
  5870. 
  5871. File: gdb,  Node: Symbol Errors,  Prev: Files,  Up: GDB Files
  5872.  
  5873. Errors reading symbol files
  5874. ===========================
  5875.  
  5876.    While reading a symbol file, GDB occasionally encounters problems,
  5877. such as symbol types it does not recognize, or known bugs in compiler
  5878. output.  By default, GDB does not notify you of such problems, since
  5879. they are relatively common and primarily of interest to people
  5880. debugging compilers.  If you are interested in seeing information about
  5881. ill-constructed symbol tables, you can either ask GDB to print only one
  5882. message about each such type of problem, no matter how many times the
  5883. problem occurs; or you can ask GDB to print more messages, to see how
  5884. many times the problems occur, with the `set complaints' command (*note
  5885. Optional warnings and messages: Messages/Warnings.).
  5886.  
  5887.    The messages currently printed, and their meanings, include:
  5888.  
  5889. `inner block not inside outer block in SYMBOL'
  5890.      The symbol information shows where symbol scopes begin and end
  5891.      (such as at the start of a function or a block of statements).
  5892.      This error indicates that an inner scope block is not fully
  5893.      contained in its outer scope blocks.
  5894.  
  5895.      GDB circumvents the problem by treating the inner block as if it
  5896.      had the same scope as the outer block.  In the error message,
  5897.      SYMBOL may be shown as "`(don't know)'" if the outer block is not a
  5898.      function.
  5899.  
  5900. `block at ADDRESS out of order'
  5901.      The symbol information for symbol scope blocks should occur in
  5902.      order of increasing addresses.  This error indicates that it does
  5903.      not do so.
  5904.  
  5905.      GDB does not circumvent this problem, and has trouble locating
  5906.      symbols in the source file whose symbols it is reading.  (You can
  5907.      often determine what source file is affected by specifying `set
  5908.      verbose on'.  *Note Optional warnings and messages:
  5909.      Messages/Warnings.)
  5910.  
  5911. `bad block start address patched'
  5912.      The symbol information for a symbol scope block has a start address
  5913.      smaller than the address of the preceding source line.  This is
  5914.      known to occur in the SunOS 4.1.1 (and earlier) C compiler.
  5915.  
  5916.      GDB circumvents the problem by treating the symbol scope block as
  5917.      starting on the previous source line.
  5918.  
  5919. `bad string table offset in symbol N'
  5920.      Symbol number N contains a pointer into the string table which is
  5921.      larger than the size of the string table.
  5922.  
  5923.      GDB circumvents the problem by considering the symbol to have the
  5924.      name `foo', which may cause other problems if many symbols end up
  5925.      with this name.
  5926.  
  5927. `unknown symbol type `0xNN''
  5928.      The symbol information contains new data types that GDB does not
  5929.      yet know how to read.  `0xNN' is the symbol type of the
  5930.      misunderstood information, in hexadecimal.
  5931.  
  5932.      GDB circumvents the error by ignoring this symbol information.
  5933.      This usually allows you to debug your program, though certain
  5934.      symbols are not accessible.  If you encounter such a problem and
  5935.      feel like debugging it, you can debug `gdb' with itself,
  5936.      breakpoint on `complain', then go up to the function
  5937.      `read_dbx_symtab' and examine `*bufp' to see the symbol.
  5938.  
  5939. `stub type has NULL name'
  5940.      GDB could not find the full definition for a struct or class.
  5941.  
  5942. `const/volatile indicator missing (ok if using g++ v1.x), got...'
  5943.      The symbol information for a C++ member function is missing some
  5944.      information that recent versions of the compiler should have output
  5945.      for it.
  5946.  
  5947. `info mismatch between compiler and debugger'
  5948.      GDB could not parse a type specification output by the compiler.
  5949.  
  5950. 
  5951. File: gdb,  Node: Targets,  Next: Controlling GDB,  Prev: GDB Files,  Up: Top
  5952.  
  5953. Specifying a Debugging Target
  5954. *****************************
  5955.  
  5956.    A "target" is the execution environment occupied by your program.
  5957. Often, GDB runs in the same host environment as your program; in that
  5958. case, the debugging target is specified as a side effect when you use
  5959. the `file' or `core' commands.  When you need more flexibility--for
  5960. example, running GDB on a physically separate host, or controlling a
  5961. standalone system over a serial port or a realtime system over a TCP/IP
  5962. connection--you can use the `target' command to specify one of the
  5963. target types configured for GDB (*note Commands for managing targets:
  5964. Target Commands.).
  5965.  
  5966. * Menu:
  5967.  
  5968. * Active Targets::              Active targets
  5969. * Target Commands::             Commands for managing targets
  5970. * Remote::                      Remote debugging
  5971.  
  5972. 
  5973. File: gdb,  Node: Active Targets,  Next: Target Commands,  Up: Targets
  5974.  
  5975. Active targets
  5976. ==============
  5977.  
  5978.    There are three classes of targets: processes, core files, and
  5979. executable files.  GDB can work concurrently on up to three active
  5980. targets, one in each class.  This allows you to (for example) start a
  5981. process and inspect its activity without abandoning your work on a core
  5982. file.
  5983.  
  5984.    For example, if you execute `gdb a.out', then the executable file
  5985. `a.out' is the only active target.  If you designate a core file as
  5986. well--presumably from a prior run that crashed and coredumped--then GDB
  5987. has two active targets and uses them in tandem, looking first in the
  5988. corefile target, then in the executable file, to satisfy requests for
  5989. memory addresses.  (Typically, these two classes of target are
  5990. complementary, since core files contain only a program's read-write
  5991. memory--variables and so on--plus machine status, while executable
  5992. files contain only the program text and initialized data.)
  5993.  
  5994.    When you type `run', your executable file becomes an active process
  5995. target as well.  When a process target is active, all GDB commands
  5996. requesting memory addresses refer to that target; addresses in an
  5997. active core file or executable file target are obscured while the
  5998. process target is active.
  5999.  
  6000.    Use the `core-file' and `exec-file' commands to select a new core
  6001. file or executable target (*note Commands to specify files: Files.).
  6002. To specify as a target a process that is already running, use the
  6003. `attach' command (*note Debugging an already-running process: Attach.).
  6004.  
  6005. 
  6006. File: gdb,  Node: Target Commands,  Next: Remote,  Prev: Active Targets,  Up: Targets
  6007.  
  6008. Commands for managing targets
  6009. =============================
  6010.  
  6011. `target TYPE PARAMETERS'
  6012.      Connects the GDB host environment to a target machine or process.
  6013.      A target is typically a protocol for talking to debugging
  6014.      facilities.  You use the argument TYPE to specify the type or
  6015.      protocol of the target machine.
  6016.  
  6017.      Further PARAMETERS are interpreted by the target protocol, but
  6018.      typically include things like device names or host names to connect
  6019.      with, process numbers, and baud rates.
  6020.  
  6021.      The `target' command does not repeat if you press RET again after
  6022.      executing the command.
  6023.  
  6024. `help target'
  6025.      Displays the names of all targets available.  To display targets
  6026.      currently selected, use either `info target' or `info files'
  6027.      (*note Commands to specify files: Files.).
  6028.  
  6029. `help target NAME'
  6030.      Describe a particular target, including any parameters necessary to
  6031.      select it.
  6032.  
  6033. `set gnutarget ARGS'
  6034.      GDBuses its own library BFD to read your files.  GDB knows whether
  6035.      it is reading an "executable", a "core", or a ".o" file, however
  6036.      you can specify the file format with the `set gnutarget' command.
  6037.      Unlike most `target' commands, with `gnutarget' the `target'
  6038.      refers to a program, not a machine.
  6039.  
  6040.      *Warning:* To specify a file format with `set gnutarget', you must
  6041.      know the actual BFD name.
  6042.  
  6043.      *Note Commands to specify files: Files.
  6044.  
  6045. `show gnutarget'
  6046.      Use the `show gnutarget' command to display what file format
  6047.      `gnutarget' is set to read.  If you have not set `gnutarget', GDB
  6048.      will determine the file format for each file automatically and
  6049.      `show gnutarget' displays `The current BDF target is "auto"'.
  6050.  
  6051.    Here are some common targets (available, or not, depending on the GDB
  6052. configuration):
  6053.  
  6054. `target exec PROGRAM'
  6055.      An executable file.  `target exec PROGRAM' is the same as
  6056.      `exec-file PROGRAM'.
  6057.  
  6058. `target core FILENAME'
  6059.      A core dump file.  `target core FILENAME' is the same as
  6060.      `core-file FILENAME'.
  6061.  
  6062. `target remote DEV'
  6063.      Remote serial target in GDB-specific protocol.  The argument DEV
  6064.      specifies what serial device to use for the connection (e.g.
  6065.      `/dev/ttya'). *Note Remote debugging: Remote.  `target remote' now
  6066.      supports the `load' command.  This is only useful if you have some
  6067.      other way of getting the stub to the target system, and you can put
  6068.      it somewhere in memory where it won't get clobbered by the
  6069.      download.
  6070.  
  6071. `target sim'
  6072.      CPU simulator.  *Note Simulated CPU Target: Simulator.
  6073.  
  6074. `target udi KEYWORD'
  6075.      Remote AMD29K target, using the AMD UDI protocol.  The KEYWORD
  6076.      argument specifies which 29K board or simulator to use.  *Note The
  6077.      UDI protocol for AMD29K: UDI29K Remote.
  6078.  
  6079. `target amd-eb DEV SPEED PROG'
  6080.      Remote PC-resident AMD EB29K board, attached over serial lines.
  6081.      DEV is the serial device, as for `target remote'; SPEED allows you
  6082.      to specify the linespeed; and PROG is the name of the program to
  6083.      be debugged, as it appears to DOS on the PC.  *Note The EBMON
  6084.      protocol for AMD29K: EB29K Remote.
  6085.  
  6086. `target hms DEV'
  6087.      A Hitachi SH, H8/300, or H8/500 board, attached via serial line to
  6088.      your host.  Use special commands `device' and `speed' to control
  6089.      the serial line and the communications speed used.  *Note GDB and
  6090.      Hitachi Microprocessors: Hitachi Remote.
  6091.  
  6092. `target nindy DEVICENAME'
  6093.      An Intel 960 board controlled by a Nindy Monitor.  DEVICENAME is
  6094.      the name of the serial device to use for the connection, e.g.
  6095.      `/dev/ttya'.  *Note GDB with a remote i960 (Nindy): i960-Nindy
  6096.      Remote.
  6097.  
  6098. `target st2000 DEV SPEED'
  6099.      A Tandem ST2000 phone switch, running Tandem's STDBUG protocol.
  6100.      DEV is the name of the device attached to the ST2000 serial line;
  6101.      SPEED is the communication line speed.  The arguments are not used
  6102.      if GDB is configured to connect to the ST2000 using TCP or Telnet.
  6103.      *Note GDB with a Tandem ST2000: ST2000 Remote.
  6104.  
  6105. `target vxworks MACHINENAME'
  6106.      A VxWorks system, attached via TCP/IP.  The argument MACHINENAME
  6107.      is the target system's machine name or IP address.  *Note GDB and
  6108.      VxWorks: VxWorks Remote.
  6109.  
  6110. `target cpu32bug DEV'
  6111.      CPU32BUG monitor, running on a CPU32 (M68K) board.
  6112.  
  6113. `target op50n DEV'
  6114.      OP50N monitor, running on an OKI HPPA board.
  6115.  
  6116. `target w89k DEV'
  6117.      W89K monitor, running on a Winbond HPPA board.
  6118.  
  6119. `target est DEV'
  6120.      EST-300 ICE monitor, running on a CPU32 (M68K) board.
  6121.  
  6122. `target rom68k DEV'
  6123.      ROM 68K monitor, running on an IDP board.
  6124.  
  6125. `target array DEV'
  6126.      Array Tech LSI33K RAID controller board.
  6127.  
  6128. `target sparclite DEV'
  6129.      Fujitsu sparclite boards, used only for the purpose of loading.
  6130.      You must use an additional command to debug the program.  For
  6131.      example: target remote DEV using GDB standard remote protocol.
  6132.  
  6133.    Different targets are available on different configurations of GDB;
  6134. your configuration may have more or fewer targets.
  6135.  
  6136. Choosing target byte order
  6137. ==========================
  6138.  
  6139.    You can now choose which byte order to use with a target system.
  6140. Use the `set endian big' and `set endian little' commands.  Use the
  6141. `set endian auto' command to instruct GDB to use the byte order
  6142. associated with the executable.  You can see the current setting for
  6143. byte order with the `show endian' command.
  6144.  
  6145.    *Warning:* Currently, only embedded MIPS configurations support
  6146. dynamic selection of target byte order.
  6147.  
  6148. 
  6149. File: gdb,  Node: Remote,  Prev: Target Commands,  Up: Targets
  6150.  
  6151. Remote debugging
  6152. ================
  6153.  
  6154.    If you are trying to debug a program running on a machine that
  6155. cannot run GDB in the usual way, it is often useful to use remote
  6156. debugging.  For example, you might use remote debugging on an operating
  6157. system kernel, or on a small system which does not have a general
  6158. purpose operating system powerful enough to run a full-featured
  6159. debugger.
  6160.  
  6161.    Some configurations of GDB have special serial or TCP/IP interfaces
  6162. to make this work with particular debugging targets.  In addition, GDB
  6163. comes with a generic serial protocol (specific to GDB, but not specific
  6164. to any particular target system) which you can use if you write the
  6165. remote stubs--the code that runs on the remote system to communicate
  6166. with GDB.
  6167.  
  6168.    Other remote targets may be available in your configuration of GDB;
  6169. use `help target' to list them.
  6170.  
  6171. * Menu:
  6172.  
  6173.  
  6174. * Remote Serial::               GDB remote serial protocol
  6175.  
  6176. * i960-Nindy Remote::        GDB with a remote i960 (Nindy)
  6177.  
  6178. * UDI29K Remote::               The UDI protocol for AMD29K
  6179. * EB29K Remote::        The EBMON protocol for AMD29K
  6180.  
  6181. * VxWorks Remote::        GDB and VxWorks
  6182.  
  6183. * ST2000 Remote::               GDB with a Tandem ST2000
  6184.  
  6185. * Hitachi Remote::              GDB and Hitachi Microprocessors
  6186.  
  6187. * MIPS Remote::            GDB and MIPS boards
  6188.  
  6189. * Simulator::                   Simulated CPU target
  6190.  
  6191. 
  6192. File: gdb,  Node: Remote Serial,  Next: i960-Nindy Remote,  Up: Remote
  6193.  
  6194. The GDB remote serial protocol
  6195. ------------------------------
  6196.  
  6197.    To debug a program running on another machine (the debugging
  6198. "target" machine), you must first arrange for all the usual
  6199. prerequisites for the program to run by itself.  For example, for a C
  6200. program, you need:
  6201.  
  6202.   1. A startup routine to set up the C runtime environment; these
  6203.      usually have a name like `crt0'.  The startup routine may be
  6204.      supplied by your hardware supplier, or you may have to write your
  6205.      own.
  6206.  
  6207.   2. You probably need a C subroutine library to support your program's
  6208.      subroutine calls, notably managing input and output.
  6209.  
  6210.   3. A way of getting your program to the other machine--for example, a
  6211.      download program.  These are often supplied by the hardware
  6212.      manufacturer, but you may have to write your own from hardware
  6213.      documentation.
  6214.  
  6215.    The next step is to arrange for your program to use a serial port to
  6216. communicate with the machine where GDB is running (the "host" machine).
  6217. In general terms, the scheme looks like this:
  6218.  
  6219. *On the host,*
  6220.      GDB already understands how to use this protocol; when everything
  6221.      else is set up, you can simply use the `target remote' command
  6222.      (*note Specifying a Debugging Target: Targets.).
  6223.  
  6224. *On the target,*
  6225.      you must link with your program a few special-purpose subroutines
  6226.      that implement the GDB remote serial protocol.  The file
  6227.      containing these subroutines is called  a "debugging stub".
  6228.  
  6229.      On certain remote targets, you can use an auxiliary program
  6230.      `gdbserver' instead of linking a stub into your program.  *Note
  6231.      Using the `gdbserver' program: Server, for details.
  6232.  
  6233.    The debugging stub is specific to the architecture of the remote
  6234. machine; for example, use `sparc-stub.c' to debug programs on SPARC
  6235. boards.
  6236.  
  6237.    These working remote stubs are distributed with GDB:
  6238.  
  6239. `sparc-stub.c'
  6240.      For SPARC architectures.
  6241.  
  6242. `m68k-stub.c'
  6243.      For Motorola 680x0 architectures.
  6244.  
  6245. `i386-stub.c'
  6246.      For Intel 386 and compatible architectures.
  6247.  
  6248.    The `README' file in the GDB distribution may list other recently
  6249. added stubs.
  6250.  
  6251. * Menu:
  6252.  
  6253. * Stub Contents::       What the stub can do for you
  6254. * Bootstrapping::       What you must do for the stub
  6255. * Debug Session::       Putting it all together
  6256. * Protocol::            Outline of the communication protocol
  6257.  
  6258. * Server::        Using the `gdbserver' program
  6259.  
  6260. * NetWare::        Using the `gdbserve.nlm' program
  6261.  
  6262. 
  6263. File: gdb,  Node: Stub Contents,  Next: Bootstrapping,  Up: Remote Serial
  6264.  
  6265. What the stub can do for you
  6266. ............................
  6267.  
  6268.    The debugging stub for your architecture supplies these three
  6269. subroutines:
  6270.  
  6271. `set_debug_traps'
  6272.      This routine arranges for `handle_exception' to run when your
  6273.      program stops.  You must call this subroutine explicitly near the
  6274.      beginning of your program.
  6275.  
  6276. `handle_exception'
  6277.      This is the central workhorse, but your program never calls it
  6278.      explicitly--the setup code arranges for `handle_exception' to run
  6279.      when a trap is triggered.
  6280.  
  6281.      `handle_exception' takes control when your program stops during
  6282.      execution (for example, on a breakpoint), and mediates
  6283.      communications with GDB on the host machine.  This is where the
  6284.      communications protocol is implemented; `handle_exception' acts as
  6285.      the GDB representative on the target machine; it begins by sending
  6286.      summary information on the state of your program, then continues
  6287.      to execute, retrieving and transmitting any information GDB needs,
  6288.      until you execute a GDB command that makes your program resume; at
  6289.      that point, `handle_exception' returns control to your own code on
  6290.      the target machine.
  6291.  
  6292. `breakpoint'
  6293.      Use this auxiliary subroutine to make your program contain a
  6294.      breakpoint.  Depending on the particular situation, this may be
  6295.      the only way for GDB to get control.  For instance, if your target
  6296.      machine has some sort of interrupt button, you won't need to call
  6297.      this; pressing the interrupt button transfers control to
  6298.      `handle_exception'--in effect, to GDB.  On some machines, simply
  6299.      receiving characters on the serial port may also trigger a trap;
  6300.      again, in that situation, you don't need to call `breakpoint' from
  6301.      your own program--simply running `target remote' from the host GDB
  6302.      session gets control.
  6303.  
  6304.      Call `breakpoint' if none of these is true, or if you simply want
  6305.      to make certain your program stops at a predetermined point for the
  6306.      start of your debugging session.
  6307.  
  6308. 
  6309. File: gdb,  Node: Bootstrapping,  Next: Debug Session,  Prev: Stub Contents,  Up: Remote Serial
  6310.  
  6311. What you must do for the stub
  6312. .............................
  6313.  
  6314.    The debugging stubs that come with GDB are set up for a particular
  6315. chip architecture, but they have no information about the rest of your
  6316. debugging target machine.
  6317.  
  6318.    First of all you need to tell the stub how to communicate with the
  6319. serial port.
  6320.  
  6321. `int getDebugChar()'
  6322.      Write this subroutine to read a single character from the serial
  6323.      port.  It may be identical to `getchar' for your target system; a
  6324.      different name is used to allow you to distinguish the two if you
  6325.      wish.
  6326.  
  6327. `void putDebugChar(int)'
  6328.      Write this subroutine to write a single character to the serial
  6329.      port.  It may be identical to `putchar' for your target system; a
  6330.      different name is used to allow you to distinguish the two if you
  6331.      wish.
  6332.  
  6333.    If you want GDB to be able to stop your program while it is running,
  6334. you need to use an interrupt-driven serial driver, and arrange for it
  6335. to stop when it receives a `^C' (`\003', the control-C character).
  6336. That is the character which GDB uses to tell the remote system to stop.
  6337.  
  6338.    Getting the debugging target to return the proper status to GDB
  6339. probably requires changes to the standard stub; one quick and dirty way
  6340. is to just execute a breakpoint instruction (the "dirty" part is that
  6341. GDB reports a `SIGTRAP' instead of a `SIGINT').
  6342.  
  6343.    Other routines you need to supply are:
  6344.  
  6345. `void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
  6346.      Write this function to install EXCEPTION_ADDRESS in the exception
  6347.      handling tables.  You need to do this because the stub does not
  6348.      have any way of knowing what the exception handling tables on your
  6349.      target system are like (for example, the processor's table might
  6350.      be in ROM, containing entries which point to a table in RAM).
  6351.      EXCEPTION_NUMBER is the exception number which should be changed;
  6352.      its meaning is architecture-dependent (for example, different
  6353.      numbers might represent divide by zero, misaligned access, etc).
  6354.      When this exception occurs, control should be transferred directly
  6355.      to EXCEPTION_ADDRESS, and the processor state (stack, registers,
  6356.      and so on) should be just as it is when a processor exception
  6357.      occurs.  So if you want to use a jump instruction to reach
  6358.      EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
  6359.      subroutine.
  6360.  
  6361.      For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
  6362.      gate so that interrupts are masked while the handler runs.  The
  6363.      gate should be at privilege level 0 (the most privileged level).
  6364.      The SPARC and 68k stubs are able to mask interrup themselves
  6365.      without help from `exceptionHandler'.
  6366.  
  6367. `void flush_i_cache()'
  6368.      (sparc and sparclite only) Write this subroutine to flush the
  6369.      instruction cache, if any, on your target machine.  If there is no
  6370.      instruction cache, this subroutine may be a no-op.
  6371.  
  6372.      On target machines that have instruction caches, GDB requires this
  6373.      function to make certain that the state of your program is stable.
  6374.  
  6375. You must also make sure this library routine is available:
  6376.  
  6377. `void *memset(void *, int, int)'
  6378.      This is the standard library function `memset' that sets an area of
  6379.      memory to a known value.  If you have one of the free versions of
  6380.      `libc.a', `memset' can be found there; otherwise, you must either
  6381.      obtain it from your hardware manufacturer, or write your own.
  6382.  
  6383.    If you do not use the GNU C compiler, you may need other standard
  6384. library subroutines as well; this varies from one stub to another, but
  6385. in general the stubs are likely to use any of the common library
  6386. subroutines which `gcc' generates as inline code.
  6387.  
  6388. 
  6389. File: gdb,  Node: Debug Session,  Next: Protocol,  Prev: Bootstrapping,  Up: Remote Serial
  6390.  
  6391. Putting it all together
  6392. .......................
  6393.  
  6394.    In summary, when your program is ready to debug, you must follow
  6395. these steps.
  6396.  
  6397.   1. Make sure you have the supporting low-level routines (*note What
  6398.      you must do for the stub: Bootstrapping.):
  6399.           `getDebugChar', `putDebugChar',
  6400.           `flush_i_cache', `memset', `exceptionHandler'.
  6401.  
  6402.   2. Insert these lines near the top of your program:
  6403.  
  6404.           set_debug_traps();
  6405.           breakpoint();
  6406.  
  6407.   3. For the 680x0 stub only, you need to provide a variable called
  6408.      `exceptionHook'.  Normally you just use:
  6409.  
  6410.           void (*exceptionHook)() = 0;
  6411.  
  6412.      but if before calling `set_debug_traps', you set it to point to a
  6413.      function in your program, that function is called when `GDB'
  6414.      continues after stopping on a trap (for example, bus error).  The
  6415.      function indicated by `exceptionHook' is called with one
  6416.      parameter: an `int' which is the exception number.
  6417.  
  6418.   4. Compile and link together: your program, the GDB debugging stub for
  6419.      your target architecture, and the supporting subroutines.
  6420.  
  6421.   5. Make sure you have a serial connection between your target machine
  6422.      and the GDB host, and identify the serial port on the host.
  6423.  
  6424.   6. Download your program to your target machine (or get it there by
  6425.      whatever means the manufacturer provides), and start it.
  6426.  
  6427.   7. To start remote debugging, run GDB on the host machine, and specify
  6428.      as an executable file the program that is running in the remote
  6429.      machine.  This tells GDB how to find your program's symbols and
  6430.      the contents of its pure text.
  6431.  
  6432.      Then establish communication using the `target remote' command.
  6433.      Its argument specifies how to communicate with the target
  6434.      machine--either via a devicename attached to a direct serial line,
  6435.      or a TCP port (usually to a terminal server which in turn has a
  6436.      serial line to the target).  For example, to use a serial line
  6437.      connected to the device named `/dev/ttyb':
  6438.  
  6439.           target remote /dev/ttyb
  6440.  
  6441.      To use a TCP connection, use an argument of the form `HOST:port'.
  6442.      For example, to connect to port 2828 on a terminal server named
  6443.      `manyfarms':
  6444.  
  6445.           target remote manyfarms:2828
  6446.  
  6447.    Now you can use all the usual commands to examine and change data
  6448. and to step and continue the remote program.
  6449.  
  6450.    To resume the remote program and stop debugging it, use the `detach'
  6451. command.
  6452.  
  6453.    Whenever GDB is waiting for the remote program, if you type the
  6454. interrupt character (often C-C), GDB attempts to stop the program.
  6455. This may or may not succeed, depending in part on the hardware and the
  6456. serial drivers the remote system uses.  If you type the interrupt
  6457. character once again, GDB displays this prompt:
  6458.  
  6459.      Interrupted while waiting for the program.
  6460.      Give up (and stop debugging it)?  (y or n)
  6461.  
  6462.    If you type `y', GDB abandons the remote debugging session.  (If you
  6463. decide you want to try again later, you can use `target remote' again
  6464. to connect once more.)  If you type `n', GDB goes back to waiting.
  6465.  
  6466. 
  6467. File: gdb,  Node: Protocol,  Next: Server,  Prev: Debug Session,  Up: Remote Serial
  6468.  
  6469. Communication protocol
  6470. ......................
  6471.  
  6472.    The stub files provided with GDB implement the target side of the
  6473. communication protocol, and the GDB side is implemented in the GDB
  6474. source file `remote.c'.  Normally, you can simply allow these
  6475. subroutines to communicate, and ignore the details.  (If you're
  6476. implementing your own stub file, you can still ignore the details: start
  6477. with one of the existing stub files.  `sparc-stub.c' is the best
  6478. organized, and therefore the easiest to read.)
  6479.  
  6480.    However, there may be occasions when you need to know something about
  6481. the protocol--for example, if there is only one serial port to your
  6482. target machine, you might want your program to do something special if
  6483. it recognizes a packet meant for GDB.
  6484.  
  6485.    All GDB commands and responses (other than acknowledgements, which
  6486. are single characters) are sent as a packet which includes a checksum.
  6487. A packet is introduced with the character `$', and ends with the
  6488. character `#' followed by a two-digit checksum:
  6489.  
  6490.      $PACKET INFO#CHECKSUM
  6491.  
  6492. CHECKSUM is computed as the modulo 256 sum of the PACKET INFO
  6493. characters.
  6494.  
  6495.    When either the host or the target machine receives a packet, the
  6496. first response expected is an acknowledgement: a single character,
  6497. either `+' (to indicate the package was received correctly) or `-' (to
  6498. request retransmission).
  6499.  
  6500.    The host (GDB) sends commands, and the target (the debugging stub
  6501. incorporated in your program) sends data in response.  The target also
  6502. sends data when your program stops.
  6503.  
  6504.    Command packets are distinguished by their first character, which
  6505. identifies the kind of command.
  6506.  
  6507.    These are some of the commands currently supported (for a complete
  6508. list of commands, look in `gdb/remote.c.'):
  6509.  
  6510. `g'
  6511.      Requests the values of CPU registers.
  6512.  
  6513. `G'
  6514.      Sets the values of CPU registers.
  6515.  
  6516. `mADDR,COUNT'
  6517.      Read COUNT bytes at location ADDR.
  6518.  
  6519. `MADDR,COUNT:...'
  6520.      Write COUNT bytes at location ADDR.
  6521.  
  6522. `c'
  6523. `cADDR'
  6524.      Resume execution at the current address (or at ADDR if supplied).
  6525.  
  6526. `s'
  6527. `sADDR'
  6528.      Step the target program for one instruction, from either the
  6529.      current program counter or from ADDR if supplied.
  6530.  
  6531. `k'
  6532.      Kill the target program.
  6533.  
  6534. `?'
  6535.      Report the most recent signal.  To allow you to take advantage of
  6536.      the GDB signal handling commands, one of the functions of the
  6537.      debugging stub is to report CPU traps as the corresponding POSIX
  6538.      signal values.
  6539.  
  6540. `T'
  6541.      Allows the remote stub to send only the registers that GDB needs
  6542.      to make a quick decision about single-stepping or conditional
  6543.      breakpoints.  This eliminates the need to fetch the entire
  6544.      register set for each instruction being stepped through.
  6545.  
  6546.      The GDB remote serial protocol now implements a write-through
  6547.      cache for registers.  GDB only re-reads the registers if the
  6548.      target has run.
  6549.  
  6550.    If you have trouble with the serial connection, you can use the
  6551. command `set remotedebug'.  This makes GDB report on all packets sent
  6552. back and forth across the serial line to the remote machine.  The
  6553. packet-debugging information is printed on the GDB standard output
  6554. stream.  `set remotedebug off' turns it off, and `show remotedebug'
  6555. shows you its current state.
  6556.  
  6557. 
  6558. File: gdb,  Node: Server,  Next: NetWare,  Prev: Protocol,  Up: Remote Serial
  6559.  
  6560. Using the `gdbserver' program
  6561. .............................
  6562.  
  6563.    `gdbserver' is a control program for Unix-like systems, which allows
  6564. you to connect your program with a remote GDB via `target remote'--but
  6565. without linking in the usual debugging stub.
  6566.  
  6567.    `gdbserver' is not a complete replacement for the debugging stubs,
  6568. because it requires essentially the same operating-system facilities
  6569. that GDB itself does.  In fact, a system that can run `gdbserver' to
  6570. connect to a remote GDB could also run GDB locally!  `gdbserver' is
  6571. sometimes useful nevertheless, because it is a much smaller program
  6572. than GDB itself.  It is also easier to port than all of GDB, so you may
  6573. be able to get started more quickly on a new system by using
  6574. `gdbserver'.  Finally, if you develop code for real-time systems, you
  6575. may find that the tradeoffs involved in real-time operation make it
  6576. more convenient to do as much development work as possible on another
  6577. system, for example by cross-compiling.  You can use `gdbserver' to
  6578. make a similar choice for debugging.
  6579.  
  6580.    GDB and `gdbserver' communicate via either a serial line or a TCP
  6581. connection, using the standard GDB remote serial protocol.
  6582.  
  6583. *On the target machine,*
  6584.      you need to have a copy of the program you want to debug.
  6585.      `gdbserver' does not need your program's symbol table, so you can
  6586.      strip the program if necessary to save space.  GDB on the host
  6587.      system does all the symbol handling.
  6588.  
  6589.      To use the server, you must tell it how to communicate with GDB;
  6590.      the name of your program; and the arguments for your program.  The
  6591.      syntax is:
  6592.  
  6593.           target> gdbserver COMM PROGRAM [ ARGS ... ]
  6594.  
  6595.      COMM is either a device name (to use a serial line) or a TCP
  6596.      hostname and portnumber.  For example, to debug Emacs with the
  6597.      argument `foo.txt' and communicate with GDB over the serial port
  6598.      `/dev/com1':
  6599.  
  6600.           target> gdbserver /dev/com1 emacs foo.txt
  6601.  
  6602.      `gdbserver' waits passively for the host GDB to communicate with
  6603.      it.
  6604.  
  6605.      To use a TCP connection instead of a serial line:
  6606.  
  6607.           target> gdbserver host:2345 emacs foo.txt
  6608.  
  6609.      The only difference from the previous example is the first
  6610.      argument, specifying that you are communicating with the host GDB
  6611.      via TCP.  The `host:2345' argument means that `gdbserver' is to
  6612.      expect a TCP connection from machine `host' to local TCP port 2345.
  6613.      (Currently, the `host' part is ignored.)  You can choose any number
  6614.      you want for the port number as long as it does not conflict with
  6615.      any TCP ports already in use on the target system (for example,
  6616.      `23' is reserved for `telnet').(1) You must use the same port
  6617.      number with the host GDB `target remote' command.
  6618.  
  6619. *On the GDB host machine,*
  6620.      you need an unstripped copy of your program, since GDB needs
  6621.      symbols and debugging information.  Start up GDB as usual, using
  6622.      the name of the local copy of your program as the first argument.
  6623.      (You may also need the `--baud' option if the serial line is
  6624.      running at anything other than 9600 bps.)  After that, use `target
  6625.      remote' to establish communications with `gdbserver'.  Its argument
  6626.      is either a device name (usually a serial device, like
  6627.      `/dev/ttyb'), or a TCP port descriptor in the form `HOST:PORT'.
  6628.      For example:
  6629.  
  6630.           (gdb) target remote /dev/ttyb
  6631.  
  6632.      communicates with the server via serial line `/dev/ttyb', and
  6633.  
  6634.           (gdb) target remote the-target:2345
  6635.  
  6636.      communicates via a TCP connection to port 2345 on host
  6637.      `the-target'.  For TCP connections, you must start up `gdbserver'
  6638.      prior to using the `target remote' command.  Otherwise you may get
  6639.      an error whose text depends on the host system, but which usually
  6640.      looks something like `Connection refused'.
  6641.  
  6642.    ---------- Footnotes ----------
  6643.  
  6644.    (1)  If you choose a port number that conflicts with another
  6645. service, `gdbserver' prints an error message and exits.
  6646.  
  6647. 
  6648. File: gdb,  Node: NetWare,  Prev: Server,  Up: Remote Serial
  6649.  
  6650. Using the `gdbserve.nlm' program
  6651. ................................
  6652.  
  6653.    `gdbserve.nlm' is a control program for NetWare systems, which
  6654. allows you to connect your program with a remote GDB via `target
  6655. remote'.
  6656.  
  6657.    GDB and `gdbserve.nlm' communicate via a serial line, using the
  6658. standard GDB remote serial protocol.
  6659.  
  6660. *On the target machine,*
  6661.      you need to have a copy of the program you want to debug.
  6662.      `gdbserve.nlm' does not need your program's symbol table, so you
  6663.      can strip the program if necessary to save space.  GDB on the host
  6664.      system does all the symbol handling.
  6665.  
  6666.      To use the server, you must tell it how to communicate with GDB;
  6667.      the name of your program; and the arguments for your program.  The
  6668.      syntax is:
  6669.  
  6670.           load gdbserve [ BOARD=BOARD ] [ PORT=PORT ]
  6671.                         [ BAUD=BAUD ] PROGRAM [ ARGS ... ]
  6672.  
  6673.      BOARD and PORT specify the serial line; BAUD specifies the baud
  6674.      rate used by the connection.  PORT and NODE default to 0, BAUD
  6675.      defaults to 9600 bps.
  6676.  
  6677.      For example, to debug Emacs with the argument `foo.txt'and
  6678.      communicate with GDB over serial port number 2 or board 1 using a
  6679.      19200 bps connection:
  6680.  
  6681.           load gdbserve BOARD=1 PORT=2 BAUD=19200 emacs foo.txt
  6682.  
  6683. *On the GDB host machine,*
  6684.      you need an unstripped copy of your program, since GDB needs
  6685.      symbols and debugging information.  Start up GDB as usual, using
  6686.      the name of the local copy of your program as the first argument.
  6687.      (You may also need the `--baud' option if the serial line is
  6688.      running at anything other than 9600 bps.  After that, use `target
  6689.      remote' to establish communications with `gdbserve.nlm'.  Its
  6690.      argument is a device name (usually a serial device, like
  6691.      `/dev/ttyb').  For example:
  6692.  
  6693.           (gdb) target remote /dev/ttyb
  6694.  
  6695.      communications with the server via serial line `/dev/ttyb'.
  6696.  
  6697. 
  6698. File: gdb,  Node: i960-Nindy Remote,  Next: UDI29K Remote,  Prev: Remote Serial,  Up: Remote
  6699.  
  6700. GDB with a remote i960 (Nindy)
  6701. ------------------------------
  6702.  
  6703.    "Nindy" is a ROM Monitor program for Intel 960 target systems.  When
  6704. GDB is configured to control a remote Intel 960 using Nindy, you can
  6705. tell GDB how to connect to the 960 in several ways:
  6706.  
  6707.    * Through command line options specifying serial port, version of the
  6708.      Nindy protocol, and communications speed;
  6709.  
  6710.    * By responding to a prompt on startup;
  6711.  
  6712.    * By using the `target' command at any point during your GDB
  6713.      session.  *Note Commands for managing targets: Target Commands.
  6714.  
  6715. * Menu:
  6716.  
  6717. * Nindy Startup::               Startup with Nindy
  6718. * Nindy Options::               Options for Nindy
  6719. * Nindy Reset::                 Nindy reset command
  6720.  
  6721. 
  6722. File: gdb,  Node: Nindy Startup,  Next: Nindy Options,  Up: i960-Nindy Remote
  6723.  
  6724. Startup with Nindy
  6725. ..................
  6726.  
  6727.    If you simply start `gdb' without using any command-line options,
  6728. you are prompted for what serial port to use, *before* you reach the
  6729. ordinary GDB prompt:
  6730.  
  6731.      Attach /dev/ttyNN -- specify NN, or "quit" to quit:
  6732.  
  6733. Respond to the prompt with whatever suffix (after `/dev/tty')
  6734. identifies the serial port you want to use.  You can, if you choose,
  6735. simply start up with no Nindy connection by responding to the prompt
  6736. with an empty line.  If you do this and later wish to attach to Nindy,
  6737. use `target' (*note Commands for managing targets: Target Commands.).
  6738.  
  6739. 
  6740. File: gdb,  Node: Nindy Options,  Next: Nindy Reset,  Prev: Nindy Startup,  Up: i960-Nindy Remote
  6741.  
  6742. Options for Nindy
  6743. .................
  6744.  
  6745.    These are the startup options for beginning your GDB session with a
  6746. Nindy-960 board attached:
  6747.  
  6748. `-r PORT'
  6749.      Specify the serial port name of a serial interface to be used to
  6750.      connect to the target system.  This option is only available when
  6751.      GDB is configured for the Intel 960 target architecture.  You may
  6752.      specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
  6753.      device name in `/dev' (e.g. `-r ttya'), or simply the unique
  6754.      suffix for a specific `tty' (e.g. `-r a').
  6755.  
  6756. `-O'
  6757.      (An uppercase letter "O", not a zero.)  Specify that GDB should use
  6758.      the "old" Nindy monitor protocol to connect to the target system.
  6759.      This option is only available when GDB is configured for the Intel
  6760.      960 target architecture.
  6761.  
  6762.           *Warning:* if you specify `-O', but are actually trying to
  6763.           connect to a target system that expects the newer protocol,
  6764.           the connection fails, appearing to be a speed mismatch.  GDB
  6765.           repeatedly attempts to reconnect at several different line
  6766.           speeds.  You can abort this process with an interrupt.
  6767.  
  6768. `-brk'
  6769.      Specify that GDB should first send a `BREAK' signal to the target
  6770.      system, in an attempt to reset it, before connecting to a Nindy
  6771.      target.
  6772.  
  6773.           *Warning:* Many target systems do not have the hardware that
  6774.           this requires; it only works with a few boards.
  6775.  
  6776.    The standard `-b' option controls the line speed used on the serial
  6777. port.
  6778.  
  6779. 
  6780. File: gdb,  Node: Nindy Reset,  Prev: Nindy Options,  Up: i960-Nindy Remote
  6781.  
  6782. Nindy reset command
  6783. ...................
  6784.  
  6785. `reset'
  6786.      For a Nindy target, this command sends a "break" to the remote
  6787.      target system; this is only useful if the target has been equipped
  6788.      with a circuit to perform a hard reset (or some other interesting
  6789.      action) when a break is detected.
  6790.  
  6791. 
  6792. File: gdb,  Node: UDI29K Remote,  Next: EB29K Remote,  Prev: i960-Nindy Remote,  Up: Remote
  6793.  
  6794. The UDI protocol for AMD29K
  6795. ---------------------------
  6796.  
  6797.    GDB supports AMD's UDI ("Universal Debugger Interface") protocol for
  6798. debugging the a29k processor family.  To use this configuration with
  6799. AMD targets running the MiniMON monitor, you need the program `MONTIP',
  6800. available from AMD at no charge.  You can also use GDB with the
  6801. UDI-conformant a29k simulator program `ISSTIP', also available from AMD.
  6802.  
  6803. `target udi KEYWORD'
  6804.      Select the UDI interface to a remote a29k board or simulator, where
  6805.      KEYWORD is an entry in the AMD configuration file `udi_soc'.  This
  6806.      file contains keyword entries which specify parameters used to
  6807.      connect to a29k targets.  If the `udi_soc' file is not in your
  6808.      working directory, you must set the environment variable `UDICONF'
  6809.      to its pathname.
  6810.  
  6811. 
  6812. File: gdb,  Node: EB29K Remote,  Next: VxWorks Remote,  Prev: UDI29K Remote,  Up: Remote
  6813.  
  6814. The EBMON protocol for AMD29K
  6815. -----------------------------
  6816.  
  6817.    AMD distributes a 29K development board meant to fit in a PC,
  6818. together with a DOS-hosted monitor program called `EBMON'.  As a
  6819. shorthand term, this development system is called the "EB29K".  To use
  6820. GDB from a Unix system to run programs on the EB29K board, you must
  6821. first connect a serial cable between the PC (which hosts the EB29K
  6822. board) and a serial port on the Unix system.  In the following, we
  6823. assume you've hooked the cable between the PC's `COM1' port and
  6824. `/dev/ttya' on the Unix system.
  6825.  
  6826. * Menu:
  6827.  
  6828. * Comms (EB29K)::               Communications setup
  6829. * gdb-EB29K::                   EB29K cross-debugging
  6830. * Remote Log::                  Remote log
  6831.  
  6832. 
  6833. File: gdb,  Node: Comms (EB29K),  Next: gdb-EB29K,  Up: EB29K Remote
  6834.  
  6835. Communications setup
  6836. ....................
  6837.  
  6838.    The next step is to set up the PC's port, by doing something like
  6839. this in DOS on the PC:
  6840.  
  6841.      C:\> MODE com1:9600,n,8,1,none
  6842.  
  6843. This example--run on an MS DOS 4.0 system--sets the PC port to 9600
  6844. bps, no parity, eight data bits, one stop bit, and no "retry" action;
  6845. you must match the communications parameters when establishing the Unix
  6846. end of the connection as well.
  6847.  
  6848.    To give control of the PC to the Unix side of the serial line, type
  6849. the following at the DOS console:
  6850.  
  6851.      C:\> CTTY com1
  6852.  
  6853. (Later, if you wish to return control to the DOS console, you can use
  6854. the command `CTTY con'--but you must send it over the device that had
  6855. control, in our example over the `COM1' serial line).
  6856.  
  6857.    From the Unix host, use a communications program such as `tip' or
  6858. `cu' to communicate with the PC; for example,
  6859.  
  6860.      cu -s 9600 -l /dev/ttya
  6861.  
  6862. The `cu' options shown specify, respectively, the linespeed and the
  6863. serial port to use.  If you use `tip' instead, your command line may
  6864. look something like the following:
  6865.  
  6866.      tip -9600 /dev/ttya
  6867.  
  6868. Your system may require a different name where we show `/dev/ttya' as
  6869. the argument to `tip'.  The communications parameters, including which
  6870. port to use, are associated with the `tip' argument in the "remote"
  6871. descriptions file--normally the system table `/etc/remote'.
  6872.  
  6873.    Using the `tip' or `cu' connection, change the DOS working directory
  6874. to the directory containing a copy of your 29K program, then start the
  6875. PC program `EBMON' (an EB29K control program supplied with your board
  6876. by AMD).  You should see an initial display from `EBMON' similar to the
  6877. one that follows, ending with the `EBMON' prompt `#'--
  6878.  
  6879.      C:\> G:
  6880.      
  6881.      G:\> CD \usr\joe\work29k
  6882.      
  6883.      G:\USR\JOE\WORK29K> EBMON
  6884.      Am29000 PC Coprocessor Board Monitor, version 3.0-18
  6885.      Copyright 1990 Advanced Micro Devices, Inc.
  6886.      Written by Gibbons and Associates, Inc.
  6887.      
  6888.      Enter '?' or 'H' for help
  6889.      
  6890.      PC Coprocessor Type   = EB29K
  6891.      I/O Base              = 0x208
  6892.      Memory Base           = 0xd0000
  6893.      
  6894.      Data Memory Size      = 2048KB
  6895.      Available I-RAM Range = 0x8000 to 0x1fffff
  6896.      Available D-RAM Range = 0x80002000 to 0x801fffff
  6897.      
  6898.      PageSize              = 0x400
  6899.      Register Stack Size   = 0x800
  6900.      Memory Stack Size     = 0x1800
  6901.      
  6902.      CPU PRL               = 0x3
  6903.      Am29027 Available     = No
  6904.      Byte Write Available  = Yes
  6905.      
  6906.      # ~.
  6907.  
  6908.    Then exit the `cu' or `tip' program (done in the example by typing
  6909. `~.' at the `EBMON' prompt).  `EBMON' keeps running, ready for GDB to
  6910. take over.
  6911.  
  6912.    For this example, we've assumed what is probably the most convenient
  6913. way to make sure the same 29K program is on both the PC and the Unix
  6914. system: a PC/NFS connection that establishes "drive `G:'" on the PC as
  6915. a file system on the Unix host.  If you do not have PC/NFS or something
  6916. similar connecting the two systems, you must arrange some other
  6917. way--perhaps floppy-disk transfer--of getting the 29K program from the
  6918. Unix system to the PC; GDB does *not* download it over the serial line.
  6919.  
  6920. 
  6921. File: gdb,  Node: gdb-EB29K,  Next: Remote Log,  Prev: Comms (EB29K),  Up: EB29K Remote
  6922.  
  6923. EB29K cross-debugging
  6924. .....................
  6925.  
  6926.    Finally, `cd' to the directory containing an image of your 29K
  6927. program on the Unix system, and start GDB--specifying as argument the
  6928. name of your 29K program:
  6929.  
  6930.      cd /usr/joe/work29k
  6931.      gdb myfoo
  6932.  
  6933.    Now you can use the `target' command:
  6934.  
  6935.      target amd-eb /dev/ttya 9600 MYFOO
  6936.  
  6937. In this example, we've assumed your program is in a file called
  6938. `myfoo'.  Note that the filename given as the last argument to `target
  6939. amd-eb' should be the name of the program as it appears to DOS.  In our
  6940. example this is simply `MYFOO', but in general it can include a DOS
  6941. path, and depending on your transfer mechanism may not resemble the
  6942. name on the Unix side.
  6943.  
  6944.    At this point, you can set any breakpoints you wish; when you are
  6945. ready to see your program run on the 29K board, use the GDB command
  6946. `run'.
  6947.  
  6948.    To stop debugging the remote program, use the GDB `detach' command.
  6949.  
  6950.    To return control of the PC to its console, use `tip' or `cu' once
  6951. again, after your GDB session has concluded, to attach to `EBMON'.  You
  6952. can then type the command `q' to shut down `EBMON', returning control
  6953. to the DOS command-line interpreter.  Type `CTTY con' to return command
  6954. input to the main DOS console, and type `~.' to leave `tip' or `cu'.
  6955.  
  6956. 
  6957. File: gdb,  Node: Remote Log,  Prev: gdb-EB29K,  Up: EB29K Remote
  6958.  
  6959. Remote log
  6960. ..........
  6961.  
  6962.    The `target amd-eb' command creates a file `eb.log' in the current
  6963. working directory, to help debug problems with the connection.
  6964. `eb.log' records all the output from `EBMON', including echoes of the
  6965. commands sent to it.  Running `tail -f' on this file in another window
  6966. often helps to understand trouble with `EBMON', or unexpected events on
  6967. the PC side of the connection.
  6968.  
  6969. 
  6970. File: gdb,  Node: ST2000 Remote,  Next: Hitachi Remote,  Prev: VxWorks Remote,  Up: Remote
  6971.  
  6972. GDB with a Tandem ST2000
  6973. ------------------------
  6974.  
  6975.    To connect your ST2000 to the host system, see the manufacturer's
  6976. manual.  Once the ST2000 is physically attached, you can run:
  6977.  
  6978.      target st2000 DEV SPEED
  6979.  
  6980. to establish it as your debugging environment.  DEV is normally the
  6981. name of a serial device, such as `/dev/ttya', connected to the ST2000
  6982. via a serial line.  You can instead specify DEV as a TCP connection
  6983. (for example, to a serial line attached via a terminal concentrator)
  6984. using the syntax `HOSTNAME:PORTNUMBER'.
  6985.  
  6986.    The `load' and `attach' commands are *not* defined for this target;
  6987. you must load your program into the ST2000 as you normally would for
  6988. standalone operation.  GDB reads debugging information (such as
  6989. symbols) from a separate, debugging version of the program available on
  6990. your host computer.
  6991.  
  6992.    These auxiliary GDB commands are available to help you with the
  6993. ST2000 environment:
  6994.  
  6995. `st2000 COMMAND'
  6996.      Send a COMMAND to the STDBUG monitor.  See the manufacturer's
  6997.      manual for available commands.
  6998.  
  6999. `connect'
  7000.      Connect the controlling terminal to the STDBUG command monitor.
  7001.      When you are done interacting with STDBUG, typing either of two
  7002.      character sequences gets you back to the GDB command prompt:
  7003.      `RET~.' (Return, followed by tilde and period) or `RET~C-d'
  7004.      (Return, followed by tilde and control-D).
  7005.  
  7006. 
  7007. File: gdb,  Node: VxWorks Remote,  Next: ST2000 Remote,  Prev: EB29K Remote,  Up: Remote
  7008.  
  7009. GDB and VxWorks
  7010. ---------------
  7011.  
  7012.    GDB enables developers to spawn and debug tasks running on networked
  7013. VxWorks targets from a Unix host.  Already-running tasks spawned from
  7014. the VxWorks shell can also be debugged.  GDB uses code that runs on
  7015. both the Unix host and on the VxWorks target.  The program `gdb' is
  7016. installed and executed on the Unix host.  (It may be installed with the
  7017. name `vxgdb', to distinguish it from a GDB for debugging programs on
  7018. the host itself.)
  7019.  
  7020. `VxWorks-timeout ARGS'
  7021.      All VxWorks-based targets now support the option `vxworks-timeout'.
  7022.      This option is set by the user, and  ARGS represents the number of
  7023.      seconds GDB waits for responses to rpc's.  You might use this if
  7024.      your VxWorks target is a slow software simulator or is on the far
  7025.      side of a thin network line.
  7026.  
  7027.    The following information on connecting to VxWorks was current when
  7028. this manual was produced; newer releases of VxWorks may use revised
  7029. procedures.
  7030.  
  7031.    To use GDB with VxWorks, you must rebuild your VxWorks kernel to
  7032. include the remote debugging interface routines in the VxWorks library
  7033. `rdb.a'.  To do this, define `INCLUDE_RDB' in the VxWorks configuration
  7034. file `configAll.h' and rebuild your VxWorks kernel.  The resulting
  7035. kernel contains `rdb.a', and spawns the source debugging task
  7036. `tRdbTask' when VxWorks is booted.  For more information on configuring
  7037. and remaking VxWorks, see the manufacturer's manual.
  7038.  
  7039.    Once you have included `rdb.a' in your VxWorks system image and set
  7040. your Unix execution search path to find GDB, you are ready to run GDB.
  7041. From your Unix host, run `gdb' (or `vxgdb', depending on your
  7042. installation).
  7043.  
  7044.    GDB comes up showing the prompt:
  7045.  
  7046.      (vxgdb)
  7047.  
  7048. * Menu:
  7049.  
  7050. * VxWorks Connection::          Connecting to VxWorks
  7051. * VxWorks Download::            VxWorks download
  7052. * VxWorks Attach::              Running tasks
  7053.  
  7054. 
  7055. File: gdb,  Node: VxWorks Connection,  Next: VxWorks Download,  Up: VxWorks Remote
  7056.  
  7057. Connecting to VxWorks
  7058. .....................
  7059.  
  7060.    The GDB command `target' lets you connect to a VxWorks target on the
  7061. network.  To connect to a target whose host name is "`tt'", type:
  7062.  
  7063.      (vxgdb) target vxworks tt
  7064.  
  7065.    GDB displays messages like these:
  7066.  
  7067.      Attaching remote machine across net...
  7068.      Connected to tt.
  7069.  
  7070.    GDB then attempts to read the symbol tables of any object modules
  7071. loaded into the VxWorks target since it was last booted.  GDB locates
  7072. these files by searching the directories listed in the command search
  7073. path (*note Your program's environment: Environment.); if it fails to
  7074. find an object file, it displays a message such as:
  7075.  
  7076.      prog.o: No such file or directory.
  7077.  
  7078.    When this happens, add the appropriate directory to the search path
  7079. with the GDB command `path', and execute the `target' command again.
  7080.  
  7081. 
  7082. File: gdb,  Node: VxWorks Download,  Next: VxWorks Attach,  Prev: VxWorks Connection,  Up: VxWorks Remote
  7083.  
  7084. VxWorks download
  7085. ................
  7086.  
  7087.    If you have connected to the VxWorks target and you want to debug an
  7088. object that has not yet been loaded, you can use the GDB `load' command
  7089. to download a file from Unix to VxWorks incrementally.  The object file
  7090. given as an argument to the `load' command is actually opened twice:
  7091. first by the VxWorks target in order to download the code, then by GDB
  7092. in order to read the symbol table.  This can lead to problems if the
  7093. current working directories on the two systems differ.  If both systems
  7094. have NFS mounted the same filesystems, you can avoid these problems by
  7095. using absolute paths.  Otherwise, it is simplest to set the working
  7096. directory on both systems to the directory in which the object file
  7097. resides, and then to reference the file by its name, without any path.
  7098. For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
  7099. VxWorks and in `HOSTPATH/vw/demo/rdb' on the host.  To load this
  7100. program, type this on VxWorks:
  7101.  
  7102.      -> cd "VXPATH/vw/demo/rdb"
  7103.    v Then, in GDB, type:
  7104.  
  7105.      (vxgdb) cd HOSTPATH/vw/demo/rdb
  7106.      (vxgdb) load prog.o
  7107.  
  7108.    GDB displays a response similar to this:
  7109.  
  7110.      Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
  7111.  
  7112.    You can also use the `load' command to reload an object module after
  7113. editing and recompiling the corresponding source file.  Note that this
  7114. makes GDB delete all currently-defined breakpoints, auto-displays, and
  7115. convenience variables, and to clear the value history.  (This is
  7116. necessary in order to preserve the integrity of debugger data
  7117. structures that reference the target system's symbol table.)
  7118.  
  7119. 
  7120. File: gdb,  Node: VxWorks Attach,  Prev: VxWorks Download,  Up: VxWorks Remote
  7121.  
  7122. Running tasks
  7123. .............
  7124.  
  7125.    You can also attach to an existing task using the `attach' command as
  7126. follows:
  7127.  
  7128.      (vxgdb) attach TASK
  7129.  
  7130. where TASK is the VxWorks hexadecimal task ID.  The task can be running
  7131. or suspended when you attach to it.  Running tasks are suspended at the
  7132. time of attachment.
  7133.  
  7134. 
  7135. File: gdb,  Node: Hitachi Remote,  Next: MIPS Remote,  Prev: ST2000 Remote,  Up: Remote
  7136.  
  7137. GDB and Hitachi microprocessors
  7138. -------------------------------
  7139.  
  7140.    GDB needs to know these things to talk to your Hitachi SH, H8/300,
  7141. or H8/500:
  7142.  
  7143.   1. that you want to use `target hms', the remote debugging interface
  7144.      for Hitachi microprocessors, or `target e7000', the in-circuit
  7145.      emulator for the Hitachi SH and the Hitachi 300H.  (`target hms' is
  7146.      the default when GDB is configured specifically for the Hitachi SH,
  7147.      H8/300, or H8/500.)
  7148.  
  7149.   2. what serial device connects your host to your Hitachi board (the
  7150.      first serial device available on your host is the default).
  7151.  
  7152.   3. what speed to use over the serial device.
  7153.  
  7154. * Menu:
  7155.  
  7156. * Hitachi Boards::      Connecting to Hitachi boards.
  7157. * Hitachi ICE::         Using the E7000 In-Circuit Emulator.
  7158. * Hitachi Special::     Special GDB commands for Hitachi micros.
  7159.  
  7160. 
  7161. File: gdb,  Node: Hitachi Boards,  Next: Hitachi ICE,  Up: Hitachi Remote
  7162.  
  7163. Connecting to Hitachi boards
  7164. ............................
  7165.  
  7166.    Use the special `gdb' command `device PORT' if you need to
  7167. explicitly set the serial device.  The default PORT is the first
  7168. available port on your host.  This is only necessary on Unix hosts,
  7169. where it is typically something like `/dev/ttya'.
  7170.  
  7171.    `gdb' has another special command to set the communications speed:
  7172. `speed BPS'.  This command also is only used from Unix hosts; on DOS
  7173. hosts, set the line speed as usual from outside GDB with the DOS `mode'
  7174. command (for instance, `mode com2:9600,n,8,1,p' for a 9600 bps
  7175. connection).
  7176.  
  7177.    The `device' and `speed' commands are available only when you use a
  7178. Unix host to debug your Hitachi microprocessor programs.  If you use a
  7179. DOS host, GDB depends on an auxiliary terminate-and-stay-resident
  7180. program called `asynctsr' to communicate with the development board
  7181. through a PC serial port.  You must also use the DOS `mode' command to
  7182. set up the serial port on the DOS side.
  7183.  
  7184. 
  7185. File: gdb,  Node: Hitachi ICE,  Next: Hitachi Special,  Prev: Hitachi Boards,  Up: Hitachi Remote
  7186.  
  7187. Using the E7000 in-circuit emulator
  7188. ...................................
  7189.  
  7190.    You can use the E7000 in-circuit emulator to develop code for either
  7191. the Hitachi SH or the H8/300H.  Use one of these forms of the `target
  7192. e7000' command to connect GDB to your E7000:
  7193.  
  7194. `target e7000 PORT SPEED'
  7195.      Use this form if your E7000 is connected to a serial port.  The
  7196.      PORT argument identifies what serial port to use (for example,
  7197.      `com2').  The third argument is the line speed in bits per second
  7198.      (for example, `9600').
  7199.  
  7200. `target e7000 HOSTNAME'
  7201.      If your E7000 is installed as a host on a TCP/IP network, you can
  7202.      just specify its hostname; GDB uses `telnet' to connect.
  7203.  
  7204. 
  7205. File: gdb,  Node: Hitachi Special,  Prev: Hitachi ICE,  Up: Hitachi Remote
  7206.  
  7207. Special GDB commands for Hitachi micros
  7208. .......................................
  7209.  
  7210.    Some GDB commands are available only on the H8/300 or the H8/500
  7211. configurations:
  7212.  
  7213. `set machine h8300'
  7214. `set machine h8300h'
  7215.      Condition GDB for one of the two variants of the H8/300
  7216.      architecture with `set machine'.  You can use `show machine' to
  7217.      check which variant is currently in effect.
  7218.  
  7219. `set memory MOD'
  7220. `show memory'
  7221.      Specify which H8/500 memory model (MOD) you are using with `set
  7222.      memory'; check which memory model is in effect with `show memory'.
  7223.      The accepted values for MOD are `small', `big', `medium', and
  7224.      `compact'.
  7225.  
  7226. 
  7227. File: gdb,  Node: MIPS Remote,  Next: Simulator,  Prev: Hitachi Remote,  Up: Remote
  7228.  
  7229. GDB and remote MIPS boards
  7230. --------------------------
  7231.  
  7232.    GDB can use the MIPS remote debugging protocol to talk to a MIPS
  7233. board attached to a serial line.  This is available when you configure
  7234. GDB with `--target=mips-idt-ecoff'.
  7235.  
  7236.    Use these GDB commands to specify the connection to your target
  7237. board:
  7238.  
  7239. `target mips PORT'
  7240.      To run a program on the board, start up `gdb' with the name of
  7241.      your program as the argument.  To connect to the board, use the
  7242.      command `target mips PORT', where PORT is the name of the serial
  7243.      port connected to the board.  If the program has not already been
  7244.      downloaded to the board, you may use the `load' command to
  7245.      download it.  You can then use all the usual GDB commands.
  7246.  
  7247.      For example, this sequence connects to the target board through a
  7248.      serial port, and loads and runs a program called PROG through the
  7249.      debugger:
  7250.  
  7251.           host$ gdb PROG
  7252.           GDB is free software and ...
  7253.           (gdb) target mips /dev/ttyb
  7254.           (gdb) load PROG
  7255.           (gdb) run
  7256.  
  7257. `target mips HOSTNAME:PORTNUMBER'
  7258.      On some GDB host configurations, you can specify a TCP connection
  7259.      (for instance, to a serial line managed by a terminal
  7260.      concentrator) instead of a serial port, using the syntax
  7261.      `HOSTNAME:PORTNUMBER'.
  7262.  
  7263. GDB also supports these special commands for MIPS targets:
  7264.  
  7265. `set processor ARGS'
  7266. `show processor'
  7267.      Use the `set processor' command to set the type of MIPS processor
  7268.      when you want to access processor-type-specific registers.  For
  7269.      example, `set processor R3041' tells GDB to use the CPO registers
  7270.      appropriate for the 3041 chip.  Use the `show processor' command
  7271.      to see what MIPS processor GDB is using.  Use the `info reg'
  7272.      command to see what registers GDB is using.
  7273.  
  7274. `set mipsfpu double'
  7275. `set mipsfpu single'
  7276. `set mipsfpu none'
  7277. `show mipsfpu'
  7278.      If your target board does not support the MIPS floating point
  7279.      coprocessor, you should use the command `set mipsfpu none' (if you
  7280.      need this, you may wish to put the command in your .gdbinit file).
  7281.      This tells GDB how to find the return value of functions which
  7282.      return floating point values.  It also allows GDB to avoid saving
  7283.      the floating point registers when calling functions on the board.
  7284.      If you are using a floating point coprocessor with only single
  7285.      precision floating point support, as on the R4650 processor, use
  7286.      the command `set mipsfpu single'.  The default double precision
  7287.      floating point coprocessor may be selected using `set mipsfpu
  7288.      double'.
  7289.  
  7290.      In previous versions the only choices were double precision or no
  7291.      floating point, so `set mipsfpu on' will select double precision
  7292.      and `set mipsfpu off' will select no floating point.
  7293.  
  7294.      As usual, you can inquire about the `mipsfpu' variable with `show
  7295.      mipsfpu'.
  7296.  
  7297. `set remotedebug N'
  7298. `show remotedebug'
  7299.      You can see some debugging information about communications with
  7300.      the board by setting the `remotedebug' variable.  If you set it to
  7301.      `1' using `set remotedebug 1', every packet is displayed.  If you
  7302.      set it to `2', every character is displayed.  You can check the
  7303.      current value at any time with the command `show remotedebug'.
  7304.  
  7305. `set timeout SECONDS'
  7306. `set retransmit-timeout SECONDS'
  7307. `show timeout'
  7308. `show retransmit-timeout'
  7309.      You can control the timeout used while waiting for a packet, in
  7310.      the MIPS remote protocol, with the `set timeout SECONDS' command.
  7311.      The default is 5 seconds.  Similarly, you can control the timeout
  7312.      used while waiting for an acknowledgement of a packet with the `set
  7313.      retransmit-timeout SECONDS' command.  The default is 3 seconds.
  7314.      You can inspect both values with `show timeout' and `show
  7315.      retransmit-timeout'.  (These commands are *only* available when
  7316.      GDB is configured for `--target=mips-idt-ecoff'.)
  7317.  
  7318.      The timeout set by `set timeout' does not apply when GDB is
  7319.      waiting for your program to stop.  In that case, GDB waits forever
  7320.      because it has no way of knowing how long the program is going to
  7321.      run before stopping.
  7322.  
  7323. 
  7324. File: gdb,  Node: Simulator,  Prev: MIPS Remote,  Up: Remote
  7325.  
  7326. Simulated CPU target
  7327. --------------------
  7328.  
  7329.    For some configurations, GDB includes a CPU simulator that you can
  7330. use instead of a hardware CPU to debug your programs.  Currently, a
  7331. simulator is available when GDB is configured to debug Zilog Z8000 or
  7332. Hitachi microprocessor targets.
  7333.  
  7334.    For the Z8000 family, `target sim' simulates either the Z8002 (the
  7335. unsegmented variant of the Z8000 architecture) or the Z8001 (the
  7336. segmented variant).  The simulator recognizes which architecture is
  7337. appropriate by inspecting the object code.
  7338.  
  7339. `target sim'
  7340.      Debug programs on a simulated CPU (which CPU depends on the GDB
  7341.      configuration)
  7342.  
  7343. After specifying this target, you can debug programs for the simulated
  7344. CPU in the same style as programs for your host computer; use the
  7345. `file' command to load a new program image, the `run' command to run
  7346. your program, and so on.
  7347.  
  7348.    As well as making available all the usual machine registers (see
  7349. `info reg'), this debugging target provides three additional items of
  7350. information as specially named registers:
  7351.  
  7352. `cycles'
  7353.      Counts clock-ticks in the simulator.
  7354.  
  7355. `insts'
  7356.      Counts instructions run in the simulator.
  7357.  
  7358. `time'
  7359.      Execution time in 60ths of a second.
  7360.  
  7361.    You can refer to these values in GDB expressions with the usual
  7362. conventions; for example, `b fputc if $cycles>5000' sets a conditional
  7363. breakpoint that suspends only after at least 5000 simulated clock ticks.
  7364.  
  7365. 
  7366. File: gdb,  Node: Controlling GDB,  Next: Sequences,  Prev: Targets,  Up: Top
  7367.  
  7368. Controlling GDB
  7369. ***************
  7370.  
  7371.    You can alter the way GDB interacts with you by using the `set'
  7372. command.  For commands controlling how GDB displays data, *note Print
  7373. settings: Print Settings.; other settings are described here.
  7374.  
  7375. * Menu:
  7376.  
  7377. * Prompt::                      Prompt
  7378. * Editing::                     Command editing
  7379. * History::                     Command history
  7380. * Screen Size::                 Screen size
  7381. * Numbers::                     Numbers
  7382. * Messages/Warnings::           Optional warnings and messages
  7383.  
  7384. 
  7385. File: gdb,  Node: Prompt,  Next: Editing,  Up: Controlling GDB
  7386.  
  7387. Prompt
  7388. ======
  7389.  
  7390.    GDB indicates its readiness to read a command by printing a string
  7391. called the "prompt".  This string is normally `(gdb)'.  You can change
  7392. the prompt string with the `set prompt' command.  For instance, when
  7393. debugging GDB with GDB, it is useful to change the prompt in one of the
  7394. GDB sessions so that you can always tell which one you are talking to.
  7395.  
  7396.    *Note:*  `set prompt' no longer adds a space for you after the
  7397. prompt you set.  This allows you to set a prompt which ends in a space
  7398. or a prompt that does not.
  7399.  
  7400. `set prompt NEWPROMPT'
  7401.      Directs GDB to use NEWPROMPT as its prompt string henceforth.
  7402.  
  7403. `show prompt'
  7404.      Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
  7405.  
  7406. 
  7407. File: gdb,  Node: Editing,  Next: History,  Prev: Prompt,  Up: Controlling GDB
  7408.  
  7409. Command editing
  7410. ===============
  7411.  
  7412.    GDB reads its input commands via the "readline" interface.  This GNU
  7413. library provides consistent behavior for programs which provide a
  7414. command line interface to the user.  Advantages are GNU Emacs-style or
  7415. "vi"-style inline editing of commands, `csh'-like history substitution,
  7416. and a storage and recall of command history across debugging sessions.
  7417.  
  7418.    You may control the behavior of command line editing in GDB with the
  7419. command `set'.
  7420.  
  7421. `set editing'
  7422. `set editing on'
  7423.      Enable command line editing (enabled by default).
  7424.  
  7425. `set editing off'
  7426.      Disable command line editing.
  7427.  
  7428. `show editing'
  7429.      Show whether command line editing is enabled.
  7430.  
  7431. 
  7432. File: gdb,  Node: History,  Next: Screen Size,  Prev: Editing,  Up: Controlling GDB
  7433.  
  7434. Command history
  7435. ===============
  7436.  
  7437.    GDB can keep track of the commands you type during your debugging
  7438. sessions, so that you can be certain of precisely what happened.  Use
  7439. these commands to manage the GDB command history facility.
  7440.  
  7441. `set history filename FNAME'
  7442.      Set the name of the GDB command history file to FNAME.  This is
  7443.      the file where GDB reads an initial command history list, and
  7444.      where it writes the command history from this session when it
  7445.      exits.  You can access this list through history expansion or
  7446.      through the history command editing characters listed below.  This
  7447.      file defaults to the value of the environment variable
  7448.      `GDBHISTFILE', or to `./.gdb_history' if this variable is not set.
  7449.  
  7450. `set history save'
  7451. `set history save on'
  7452.      Record command history in a file, whose name may be specified with
  7453.      the `set history filename' command.  By default, this option is
  7454.      disabled.
  7455.  
  7456. `set history save off'
  7457.      Stop recording command history in a file.
  7458.  
  7459. `set history size SIZE'
  7460.      Set the number of commands which GDB keeps in its history list.
  7461.      This defaults to the value of the environment variable `HISTSIZE',
  7462.      or to 256 if this variable is not set.
  7463.  
  7464.    History expansion assigns special meaning to the character `!'.
  7465.  
  7466.    Since `!' is also the logical not operator in C, history expansion
  7467. is off by default. If you decide to enable history expansion with the
  7468. `set history expansion on' command, you may sometimes need to follow
  7469. `!' (when it is used as logical not, in an expression) with a space or
  7470. a tab to prevent it from being expanded.  The readline history
  7471. facilities do not attempt substitution on the strings `!=' and `!(',
  7472. even when history expansion is enabled.
  7473.  
  7474.    The commands to control history expansion are:
  7475.  
  7476. `set history expansion on'
  7477. `set history expansion'
  7478.      Enable history expansion.  History expansion is off by default.
  7479.  
  7480. `set history expansion off'
  7481.      Disable history expansion.
  7482.  
  7483.      The readline code comes with more complete documentation of
  7484.      editing and history expansion features.  Users unfamiliar with GNU
  7485.      Emacs or `vi' may wish to read it.
  7486.  
  7487. `show history'
  7488. `show history filename'
  7489. `show history save'
  7490. `show history size'
  7491. `show history expansion'
  7492.      These commands display the state of the GDB history parameters.
  7493.      `show history' by itself displays all four states.
  7494.  
  7495. `show commands'
  7496.      Display the last ten commands in the command history.
  7497.  
  7498. `show commands N'
  7499.      Print ten commands centered on command number N.
  7500.  
  7501. `show commands +'
  7502.      Print ten commands just after the commands last printed.
  7503.  
  7504. 
  7505. File: gdb,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
  7506.  
  7507. Screen size
  7508. ===========
  7509.  
  7510.    Certain commands to GDB may produce large amounts of information
  7511. output to the screen.  To help you read all of it, GDB pauses and asks
  7512. you for input at the end of each page of output.  Type RET when you
  7513. want to continue the output, or `q' to discard the remaining output.
  7514. Also, the screen width setting determines when to wrap lines of output.
  7515. Depending on what is being printed, GDB tries to break the line at a
  7516. readable place, rather than simply letting it overflow onto the
  7517. following line.
  7518.  
  7519.    Normally GDB knows the size of the screen from the termcap data base
  7520. together with the value of the `TERM' environment variable and the
  7521. `stty rows' and `stty cols' settings. If this is not correct, you can
  7522. override it with the `set height' and `set width' commands:
  7523.  
  7524. `set height LPP'
  7525. `show height'
  7526. `set width CPL'
  7527. `show width'
  7528.      These `set' commands specify a screen height of LPP lines and a
  7529.      screen width of CPL characters.  The associated `show' commands
  7530.      display the current settings.
  7531.  
  7532.      If you specify a height of zero lines, GDB does not pause during
  7533.      output no matter how long the output is.  This is useful if output
  7534.      is to a file or to an editor buffer.
  7535.  
  7536.      Likewise, you can specify `set width 0' to prevent GDB from
  7537.      wrapping its output.
  7538.  
  7539. 
  7540. File: gdb,  Node: Numbers,  Next: Messages/Warnings,  Prev: Screen Size,  Up: Controlling GDB
  7541.  
  7542. Numbers
  7543. =======
  7544.  
  7545.    You can always enter numbers in octal, decimal, or hexadecimal in
  7546. GDB by the usual conventions: octal numbers begin with `0', decimal
  7547. numbers end with `.', and hexadecimal numbers begin with `0x'.  Numbers
  7548. that begin with none of these are, by default, entered in base 10;
  7549. likewise, the default display for numbers--when no particular format is
  7550. specified--is base 10.  You can change the default base for both input
  7551. and output with the `set radix' command.
  7552.  
  7553. `set input-radix BASE'
  7554.      Set the default base for numeric input.  Supported choices for
  7555.      BASE are decimal 8, 10, or 16.  BASE must itself be specified
  7556.      either unambiguously or using the current default radix; for
  7557.      example, any of
  7558.  
  7559.           set radix 012
  7560.           set radix 10.
  7561.           set radix 0xa
  7562.  
  7563.      sets the base to decimal.  On the other hand, `set radix 10'
  7564.      leaves the radix unchanged no matter what it was.
  7565.  
  7566. `set output-radix BASE'
  7567.      Set the default base for numeric display.  Supported choices for
  7568.      BASE are decimal 8, 10, or 16.  BASE must itself be specified
  7569.      either unambiguously or using the current default radix.
  7570.  
  7571. `show input-radix'
  7572.      Display the current default base for numeric input.
  7573.  
  7574. `show output-radix'
  7575.      Display the current default base for numeric display.
  7576.  
  7577. 
  7578. File: gdb,  Node: Messages/Warnings,  Prev: Numbers,  Up: Controlling GDB
  7579.  
  7580. Optional warnings and messages
  7581. ==============================
  7582.  
  7583.    By default, GDB is silent about its inner workings.  If you are
  7584. running on a slow machine, you may want to use the `set verbose'
  7585. command.  This makes GDB tell you when it does a lengthy internal
  7586. operation, so you will not think it has crashed.
  7587.  
  7588.    Currently, the messages controlled by `set verbose' are those which
  7589. announce that the symbol table for a source file is being read; see
  7590. `symbol-file' in *Note Commands to specify files: Files.
  7591.  
  7592. `set verbose on'
  7593.      Enables GDB output of certain informational messages.
  7594.  
  7595. `set verbose off'
  7596.      Disables GDB output of certain informational messages.
  7597.  
  7598. `show verbose'
  7599.      Displays whether `set verbose' is on or off.
  7600.  
  7601.    By default, if GDB encounters bugs in the symbol table of an object
  7602. file, it is silent; but if you are debugging a compiler, you may find
  7603. this information useful (*note Errors reading symbol files: Symbol
  7604. Errors.).
  7605.  
  7606. `set complaints LIMIT'
  7607.      Permits GDB to output LIMIT complaints about each type of unusual
  7608.      symbols before becoming silent about the problem.  Set LIMIT to
  7609.      zero to suppress all complaints; set it to a large number to
  7610.      prevent complaints from being suppressed.
  7611.  
  7612. `show complaints'
  7613.      Displays how many symbol complaints GDB is permitted to produce.
  7614.  
  7615.    By default, GDB is cautious, and asks what sometimes seems to be a
  7616. lot of stupid questions to confirm certain commands.  For example, if
  7617. you try to run a program which is already running:
  7618.  
  7619.      (gdb) run
  7620.      The program being debugged has been started already.
  7621.      Start it from the beginning? (y or n)
  7622.  
  7623.    If you are willing to unflinchingly face the consequences of your own
  7624. commands, you can disable this "feature":
  7625.  
  7626. `set confirm off'
  7627.      Disables confirmation requests.
  7628.  
  7629. `set confirm on'
  7630.      Enables confirmation requests (the default).
  7631.  
  7632. `show confirm'
  7633.      Displays state of confirmation requests.
  7634.  
  7635. 
  7636. File: gdb,  Node: Sequences,  Next: Emacs,  Prev: Controlling GDB,  Up: Top
  7637.  
  7638. Canned Sequences of Commands
  7639. ****************************
  7640.  
  7641.    Aside from breakpoint commands (*note Breakpoint command lists:
  7642. Break Commands.), GDB provides two ways to store sequences of commands
  7643. for execution as a unit: user-defined commands and command files.
  7644.  
  7645. * Menu:
  7646.  
  7647. * Define::                      User-defined commands
  7648. * Hooks::            User-defined command hooks
  7649. * Command Files::               Command files
  7650. * Output::                      Commands for controlled output
  7651.  
  7652. 
  7653. File: gdb,  Node: Define,  Next: Hooks,  Up: Sequences
  7654.  
  7655. User-defined commands
  7656. =====================
  7657.  
  7658.    A "user-defined command" is a sequence of GDB commands to which you
  7659. assign a new name as a command.  This is done with the `define'
  7660. command.  User commands may accept up to 10 arguments separated by
  7661. whitespace.  Arguments are accessed within the user command via
  7662. $ARG0...$ARG9.  A trivial example:
  7663.  
  7664.      define adder
  7665.        print $arg0 + $arg1 + $arg2
  7666.  
  7667. To execute the command use:
  7668.  
  7669.      adder 1 2 3
  7670.  
  7671. This defines the command `adder', which prints the sum of its three
  7672. arguments.  Note the arguments are text substitutions, so they may
  7673. reference variables, use complex expressions, or even perform inferior
  7674. functions calls.
  7675.  
  7676. `define COMMANDNAME'
  7677.      Define a command named COMMANDNAME.  If there is already a command
  7678.      by that name, you are asked to confirm that you want to redefine
  7679.      it.
  7680.  
  7681.      The definition of the command is made up of other GDB command
  7682.      lines, which are given following the `define' command.  The end of
  7683.      these commands is marked by a line containing `end'.
  7684.  
  7685. `if'
  7686.      Takes a single argument, which is an expression to evaluate.  It
  7687.      is followed by a series of commands that are executed only if the
  7688.      expression is true (nonzero).  There can then optionally be a line
  7689.      `else', followed by a series of commands that are only executed if
  7690.      the expression was false.  The end of the list is marked by a line
  7691.      containing `end'.
  7692.  
  7693. `while'
  7694.      The syntax is similar to `if': the command takes a single argument,
  7695.      which is an expression to evaluate, and must be followed by the
  7696.      commands to execute, one per line, terminated by an `end'.  The
  7697.      commands are executed repeatedly as long as the expression
  7698.      evaluates to true.
  7699.  
  7700. `document COMMANDNAME'
  7701.      Document the user-defined command COMMANDNAME, so that it can be
  7702.      accessed by `help'.  The command COMMANDNAME must already be
  7703.      defined.  This command reads lines of documentation just as
  7704.      `define' reads the lines of the command definition, ending with
  7705.      `end'.  After the `document' command is finished, `help' on command
  7706.      COMMANDNAME displays the documentation you have written.
  7707.  
  7708.      You may use the `document' command again to change the
  7709.      documentation of a command.  Redefining the command with `define'
  7710.      does not change the documentation.
  7711.  
  7712. `help user-defined'
  7713.      List all user-defined commands, with the first line of the
  7714.      documentation (if any) for each.
  7715.  
  7716. `show user'
  7717. `show user COMMANDNAME'
  7718.      Display the GDB commands used to define COMMANDNAME (but not its
  7719.      documentation).  If no COMMANDNAME is given, display the
  7720.      definitions for all user-defined commands.
  7721.  
  7722.    When user-defined commands are executed, the commands of the
  7723. definition are not printed.  An error in any command stops execution of
  7724. the user-defined command.
  7725.  
  7726.    If used interactively, commands that would ask for confirmation
  7727. proceed without asking when used inside a user-defined command.  Many
  7728. GDB commands that normally print messages to say what they are doing
  7729. omit the messages when used in a user-defined command.
  7730.  
  7731. 
  7732. File: gdb,  Node: Hooks,  Next: Command Files,  Prev: Define,  Up: Sequences
  7733.  
  7734. User-defined command hooks
  7735. ==========================
  7736.  
  7737.    You may define *hooks*, which are a special kind of user-defined
  7738. command.  Whenever you run the command `foo', if the user-defined
  7739. command `hook-foo' exists, it is executed (with no arguments) before
  7740. that command.
  7741.  
  7742.    In addition, a pseudo-command, `stop' exists.  Defining
  7743. (`hook-stop') makes the associated commands execute every time
  7744. execution stops in your program: before breakpoint commands are run,
  7745. displays are printed, or the stack frame is printed.
  7746.  
  7747.    For example, to ignore `SIGALRM' signals while single-stepping, but
  7748. treat them normally during normal execution, you could define:
  7749.  
  7750.      define hook-stop
  7751.      handle SIGALRM nopass
  7752.      end
  7753.      
  7754.      define hook-run
  7755.      handle SIGALRM pass
  7756.      end
  7757.      
  7758.      define hook-continue
  7759.      handle SIGLARM pass
  7760.      end
  7761.  
  7762.    You can define a hook for any single-word command in GDB, but not
  7763. for command aliases; you should define a hook for the basic command
  7764. name, e.g.  `backtrace' rather than `bt'.  If an error occurs during
  7765. the execution of your hook, execution of GDB commands stops and GDB
  7766. issues a prompt (before the command that you actually typed had a
  7767. chance to run).
  7768.  
  7769.    If you try to define a hook which does not match any known command,
  7770. you get a warning from the `define' command.
  7771.  
  7772. 
  7773. File: gdb,  Node: Command Files,  Next: Output,  Prev: Hooks,  Up: Sequences
  7774.  
  7775. Command files
  7776. =============
  7777.  
  7778.    A command file for GDB is a file of lines that are GDB commands.
  7779. Comments (lines starting with `#') may also be included.  An empty line
  7780. in a command file does nothing; it does not mean to repeat the last
  7781. command, as it would from the terminal.
  7782.  
  7783.    When you start GDB, it automatically executes commands from its
  7784. "init files".  These are files named `.gdbinit'.  GDB reads the init
  7785. file (if any) in your home directory, then processes command line
  7786. options and operands, and then reads the init file (if any) in the
  7787. current working directory.  This is so the init file in your home
  7788. directory can set options (such as `set complaints') which affect the
  7789. processing of the command line options and operands.  The init files
  7790. are not executed if you use the `-nx' option; *note Choosing modes:
  7791. Mode Options..
  7792.  
  7793.    On some configurations of GDB, the init file is known by a different
  7794. name (these are typically environments where a specialized form of GDB
  7795. may need to coexist with other forms, hence a different name for the
  7796. specialized version's init file).  These are the environments with
  7797. special init file names:
  7798.  
  7799.    * VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
  7800.  
  7801.    * OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
  7802.  
  7803.    * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
  7804.  
  7805.    You can also request the execution of a command file with the
  7806. `source' command:
  7807.  
  7808. `source FILENAME'
  7809.      Execute the command file FILENAME.
  7810.  
  7811.    The lines in a command file are executed sequentially.  They are not
  7812. printed as they are executed.  An error in any command terminates
  7813. execution of the command file.
  7814.  
  7815.    Commands that would ask for confirmation if used interactively
  7816. proceed without asking when used in a command file.  Many GDB commands
  7817. that normally print messages to say what they are doing omit the
  7818. messages when called from command files.
  7819.  
  7820. 
  7821. File: gdb,  Node: Output,  Prev: Command Files,  Up: Sequences
  7822.  
  7823. Commands for controlled output
  7824. ==============================
  7825.  
  7826.    During the execution of a command file or a user-defined command,
  7827. normal GDB output is suppressed; the only output that appears is what is
  7828. explicitly printed by the commands in the definition.  This section
  7829. describes three commands useful for generating exactly the output you
  7830. want.
  7831.  
  7832. `echo TEXT'
  7833.      Print TEXT.  Nonprinting characters can be included in TEXT using
  7834.      C escape sequences, such as `\n' to print a newline.  *No newline
  7835.      is printed unless you specify one.* In addition to the standard C
  7836.      escape sequences, a backslash followed by a space stands for a
  7837.      space.  This is useful for displaying a string with spaces at the
  7838.      beginning or the end, since leading and trailing spaces are
  7839.      otherwise trimmed from all arguments.  To print ` and foo = ', use
  7840.      the command `echo \ and foo = \ '.
  7841.  
  7842.      A backslash at the end of TEXT can be used, as in C, to continue
  7843.      the command onto subsequent lines.  For example,
  7844.  
  7845.           echo This is some text\n\
  7846.           which is continued\n\
  7847.           onto several lines.\n
  7848.  
  7849.      produces the same output as
  7850.  
  7851.           echo This is some text\n
  7852.           echo which is continued\n
  7853.           echo onto several lines.\n
  7854.  
  7855. `output EXPRESSION'
  7856.      Print the value of EXPRESSION and nothing but that value: no
  7857.      newlines, no `$NN = '.  The value is not entered in the value
  7858.      history either.  *Note Expressions: Expressions, for more
  7859.      information on expressions.
  7860.  
  7861. `output/FMT EXPRESSION'
  7862.      Print the value of EXPRESSION in format FMT.  You can use the same
  7863.      formats as for `print'.  *Note Output formats: Output Formats, for
  7864.      more information.
  7865.  
  7866. `printf STRING, EXPRESSIONS...'
  7867.      Print the values of the EXPRESSIONS under the control of STRING.
  7868.      The EXPRESSIONS are separated by commas and may be either numbers
  7869.      or pointers.  Their values are printed as specified by STRING,
  7870.      exactly as if your program were to execute the C subroutine
  7871.  
  7872.           printf (STRING, EXPRESSIONS...);
  7873.  
  7874.      For example, you can print two values in hex like this:
  7875.  
  7876.           printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  7877.  
  7878.      The only backslash-escape sequences that you can use in the format
  7879.      string are the simple ones that consist of backslash followed by a
  7880.      letter.
  7881.  
  7882. 
  7883. File: gdb,  Node: Emacs,  Next: GDB Bugs,  Prev: Sequences,  Up: Top
  7884.  
  7885. Using GDB under GNU Emacs
  7886. *************************
  7887.  
  7888.    A special interface allows you to use GNU Emacs to view (and edit)
  7889. the source files for the program you are debugging with GDB.
  7890.  
  7891.    To use this interface, use the command `M-x gdb' in Emacs.  Give the
  7892. executable file you want to debug as an argument.  This command starts
  7893. GDB as a subprocess of Emacs, with input and output through a newly
  7894. created Emacs buffer.
  7895.  
  7896.    Using GDB under Emacs is just like using GDB normally except for two
  7897. things:
  7898.  
  7899.    * All "terminal" input and output goes through the Emacs buffer.
  7900.  
  7901.    This applies both to GDB commands and their output, and to the input
  7902. and output done by the program you are debugging.
  7903.  
  7904.    This is useful because it means that you can copy the text of
  7905. previous commands and input them again; you can even use parts of the
  7906. output in this way.
  7907.  
  7908.    All the facilities of Emacs' Shell mode are available for interacting
  7909. with your program.  In particular, you can send signals the usual
  7910. way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
  7911.  
  7912.    * GDB displays source code through Emacs.
  7913.  
  7914.    Each time GDB displays a stack frame, Emacs automatically finds the
  7915. source file for that frame and puts an arrow (`=>') at the left margin
  7916. of the current line.  Emacs uses a separate buffer for source display,
  7917. and splits the screen to show both your GDB session and the source.
  7918.  
  7919.    Explicit GDB `list' or search commands still produce output as
  7920. usual, but you probably have no reason to use them from Emacs.
  7921.  
  7922.      *Warning:* If the directory where your program resides is not your
  7923.      current directory, it can be easy to confuse Emacs about the
  7924.      location of the source files, in which case the auxiliary display
  7925.      buffer does not appear to show your source.  GDB can find programs
  7926.      by searching your environment's `PATH' variable, so the GDB input
  7927.      and output session proceeds normally; but Emacs does not get
  7928.      enough information back from GDB to locate the source files in
  7929.      this situation.  To avoid this problem, either start GDB mode from
  7930.      the directory where your program resides, or specify an absolute
  7931.      file name when prompted for the `M-x gdb' argument.
  7932.  
  7933.      A similar confusion can result if you use the GDB `file' command to
  7934.      switch to debugging a program in some other location, from an
  7935.      existing GDB buffer in Emacs.
  7936.  
  7937.    By default, `M-x gdb' calls the program called `gdb'.  If you need
  7938. to call GDB by a different name (for example, if you keep several
  7939. configurations around, with different names) you can set the Emacs
  7940. variable `gdb-command-name'; for example,
  7941.  
  7942.      (setq gdb-command-name "mygdb")
  7943.  
  7944. (preceded by `ESC ESC', or typed in the `*scratch*' buffer, or in your
  7945. `.emacs' file) makes Emacs call the program named "`mygdb'" instead.
  7946.  
  7947.    In the GDB I/O buffer, you can use these special Emacs commands in
  7948. addition to the standard Shell mode commands:
  7949.  
  7950. `C-h m'
  7951.      Describe the features of Emacs' GDB Mode.
  7952.  
  7953. `M-s'
  7954.      Execute to another source line, like the GDB `step' command; also
  7955.      update the display window to show the current file and location.
  7956.  
  7957. `M-n'
  7958.      Execute to next source line in this function, skipping all function
  7959.      calls, like the GDB `next' command.  Then update the display window
  7960.      to show the current file and location.
  7961.  
  7962. `M-i'
  7963.      Execute one instruction, like the GDB `stepi' command; update
  7964.      display window accordingly.
  7965.  
  7966. `M-x gdb-nexti'
  7967.      Execute to next instruction, using the GDB `nexti' command; update
  7968.      display window accordingly.
  7969.  
  7970. `C-c C-f'
  7971.      Execute until exit from the selected stack frame, like the GDB
  7972.      `finish' command.
  7973.  
  7974. `M-c'
  7975.      Continue execution of your program, like the GDB `continue'
  7976.      command.
  7977.  
  7978.      *Warning:* In Emacs v19, this command is `C-c C-p'.
  7979.  
  7980. `M-u'
  7981.      Go up the number of frames indicated by the numeric argument
  7982.      (*note Numeric Arguments: (Emacs)Arguments.), like the GDB `up'
  7983.      command.
  7984.  
  7985.      *Warning:* In Emacs v19, this command is `C-c C-u'.
  7986.  
  7987. `M-d'
  7988.      Go down the number of frames indicated by the numeric argument,
  7989.      like the GDB `down' command.
  7990.  
  7991.      *Warning:* In Emacs v19, this command is `C-c C-d'.
  7992.  
  7993. `C-x &'
  7994.      Read the number where the cursor is positioned, and insert it at
  7995.      the end of the GDB I/O buffer.  For example, if you wish to
  7996.      disassemble code around an address that was displayed earlier,
  7997.      type `disassemble'; then move the cursor to the address display,
  7998.      and pick up the argument for `disassemble' by typing `C-x &'.
  7999.  
  8000.      You can customize this further by defining elements of the list
  8001.      `gdb-print-command'; once it is defined, you can format or
  8002.      otherwise process numbers picked up by `C-x &' before they are
  8003.      inserted.  A numeric argument to `C-x &' indicates that you wish
  8004.      special formatting, and also acts as an index to pick an element
  8005.      of the list.  If the list element is a string, the number to be
  8006.      inserted is formatted using the Emacs function `format'; otherwise
  8007.      the number is passed as an argument to the corresponding list
  8008.      element.
  8009.  
  8010.    In any source file, the Emacs command `C-x SPC' (`gdb-break') tells
  8011. GDB to set a breakpoint on the source line point is on.
  8012.  
  8013.    If you accidentally delete the source-display buffer, an easy way to
  8014. get it back is to type the command `f' in the GDB buffer, to request a
  8015. frame display; when you run under Emacs, this recreates the source
  8016. buffer if necessary to show you the context of the current frame.
  8017.  
  8018.    The source files displayed in Emacs are in ordinary Emacs buffers
  8019. which are visiting the source files in the usual way.  You can edit the
  8020. files with these buffers if you wish; but keep in mind that GDB
  8021. communicates with Emacs in terms of line numbers.  If you add or delete
  8022. lines from the text, the line numbers that GDB knows cease to
  8023. correspond properly with the code.
  8024.  
  8025. 
  8026. File: gdb,  Node: GDB Bugs,  Next: Command Line Editing,  Prev: Emacs,  Up: Top
  8027.  
  8028. Reporting Bugs in GDB
  8029. *********************
  8030.  
  8031.    Your bug reports play an essential role in making GDB reliable.
  8032.  
  8033.    Reporting a bug may help you by bringing a solution to your problem,
  8034. or it may not.  But in any case the principal function of a bug report
  8035. is to help the entire community by making the next version of GDB work
  8036. better.  Bug reports are your contribution to the maintenance of GDB.
  8037.  
  8038.    In order for a bug report to serve its purpose, you must include the
  8039. information that enables us to fix the bug.
  8040.  
  8041. * Menu:
  8042.  
  8043. * Bug Criteria::                Have you found a bug?
  8044. * Bug Reporting::               How to report bugs
  8045.  
  8046. 
  8047. File: gdb,  Node: Bug Criteria,  Next: Bug Reporting,  Up: GDB Bugs
  8048.  
  8049. Have you found a bug?
  8050. =====================
  8051.  
  8052.    If you are not sure whether you have found a bug, here are some
  8053. guidelines:
  8054.  
  8055.    * If the debugger gets a fatal signal, for any input whatever, that
  8056.      is a GDB bug.  Reliable debuggers never crash.
  8057.  
  8058.    * If GDB produces an error message for valid input, that is a bug.
  8059.  
  8060.    * If GDB does not produce an error message for invalid input, that
  8061.      is a bug.  However, you should note that your idea of "invalid
  8062.      input" might be our idea of "an extension" or "support for
  8063.      traditional practice".
  8064.  
  8065.    * If you are an experienced user of debugging tools, your suggestions
  8066.      for improvement of GDB are welcome in any case.
  8067.  
  8068. 
  8069. File: gdb,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: GDB Bugs
  8070.  
  8071. How to report bugs
  8072. ==================
  8073.  
  8074.    A number of companies and individuals offer support for GNU products.
  8075. If you obtained GDB from a support organization, we recommend you
  8076. contact that organization first.
  8077.  
  8078.    You can find contact information for many support companies and
  8079. individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
  8080.  
  8081.    In any event, we also recommend that you send bug reports for GDB to
  8082. one of these addresses:
  8083.  
  8084.      bug-gdb@prep.ai.mit.edu
  8085.      {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-gdb
  8086.  
  8087.    *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
  8088. newsgroups.* Most users of GDB do not want to receive bug reports.
  8089. Those that do have arranged to receive `bug-gdb'.
  8090.  
  8091.    The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
  8092. serves as a repeater.  The mailing list and the newsgroup carry exactly
  8093. the same messages.  Often people think of posting bug reports to the
  8094. newsgroup instead of mailing them.  This appears to work, but it has one
  8095. problem which can be crucial: a newsgroup posting often lacks a mail
  8096. path back to the sender.  Thus, if we need to ask for more information,
  8097. we may be unable to reach you.  For this reason, it is better to send
  8098. bug reports to the mailing list.
  8099.  
  8100.    As a last resort, send bug reports on paper to:
  8101.  
  8102.      GNU Debugger Bugs
  8103.      Free Software Foundation Inc.
  8104.      59 Temple Place - Suite 330
  8105.      Boston, MA 02111-1307
  8106.      USA
  8107.  
  8108.    The fundamental principle of reporting bugs usefully is this:
  8109. *report all the facts*.  If you are not sure whether to state a fact or
  8110. leave it out, state it!
  8111.  
  8112.    Often people omit facts because they think they know what causes the
  8113. problem and assume that some details do not matter.  Thus, you might
  8114. assume that the name of the variable you use in an example does not
  8115. matter.  Well, probably it does not, but one cannot be sure.  Perhaps
  8116. the bug is a stray memory reference which happens to fetch from the
  8117. location where that name is stored in memory; perhaps, if the name were
  8118. different, the contents of that location would fool the debugger into
  8119. doing the right thing despite the bug.  Play it safe and give a
  8120. specific, complete example.  That is the easiest thing for you to do,
  8121. and the most helpful.
  8122.  
  8123.    Keep in mind that the purpose of a bug report is to enable us to fix
  8124. the bug if it is new to us.  Therefore, always write your bug reports on
  8125. the assumption that the bug has not been reported previously.
  8126.  
  8127.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  8128. bell?"  Those bug reports are useless, and we urge everyone to *refuse
  8129. to respond to them* except to chide the sender to report bugs properly.
  8130.  
  8131.    To enable us to fix the bug, you should include all these things:
  8132.  
  8133.    * The version of GDB.  GDB announces it if you start with no
  8134.      arguments; you can also print it at any time using `show version'.
  8135.  
  8136.      Without this, we will not know whether there is any point in
  8137.      looking for the bug in the current version of GDB.
  8138.  
  8139.    * The type of machine you are using, and the operating system name
  8140.      and version number.
  8141.  
  8142.    * What compiler (and its version) was used to compile GDB--e.g.
  8143.      "gcc-2.0".
  8144.  
  8145.    * What compiler (and its version) was used to compile the program you
  8146.      are debugging--e.g.  "gcc-2.0".
  8147.  
  8148.    * The command arguments you gave the compiler to compile your
  8149.      example and observe the bug.  For example, did you use `-O'?  To
  8150.      guarantee you will not omit something important, list them all.  A
  8151.      copy of the Makefile (or the output from make) is sufficient.
  8152.  
  8153.      If we were to try to guess the arguments, we would probably guess
  8154.      wrong and then we might not encounter the bug.
  8155.  
  8156.    * A complete input script, and all necessary source files, that will
  8157.      reproduce the bug.
  8158.  
  8159.    * A description of what behavior you observe that you believe is
  8160.      incorrect.  For example, "It gets a fatal signal."
  8161.  
  8162.      Of course, if the bug is that GDB gets a fatal signal, then we will
  8163.      certainly notice it.  But if the bug is incorrect output, we might
  8164.      not notice unless it is glaringly wrong.  You might as well not
  8165.      give us a chance to make a mistake.
  8166.  
  8167.      Even if the problem you experience is a fatal signal, you should
  8168.      still say so explicitly.  Suppose something strange is going on,
  8169.      such as, your copy of GDB is out of synch, or you have encountered
  8170.      a bug in the C library on your system.  (This has happened!)  Your
  8171.      copy might crash and ours would not.  If you told us to expect a
  8172.      crash, then when ours fails to crash, we would know that the bug
  8173.      was not happening for us.  If you had not told us to expect a
  8174.      crash, then we would not be able to draw any conclusion from our
  8175.      observations.
  8176.  
  8177.    * If you wish to suggest changes to the GDB source, send us context
  8178.      diffs.  If you even discuss something in the GDB source, refer to
  8179.      it by context, not by line number.
  8180.  
  8181.      The line numbers in our development sources will not match those
  8182.      in your sources.  Your line numbers would convey no useful
  8183.      information to us.
  8184.  
  8185.    Here are some things that are not necessary:
  8186.  
  8187.    * A description of the envelope of the bug.
  8188.  
  8189.      Often people who encounter a bug spend a lot of time investigating
  8190.      which changes to the input file will make the bug go away and which
  8191.      changes will not affect it.
  8192.  
  8193.      This is often time consuming and not very useful, because the way
  8194.      we will find the bug is by running a single example under the
  8195.      debugger with breakpoints, not by pure deduction from a series of
  8196.      examples.  We recommend that you save your time for something else.
  8197.  
  8198.      Of course, if you can find a simpler example to report *instead*
  8199.      of the original one, that is a convenience for us.  Errors in the
  8200.      output will be easier to spot, running under the debugger will take
  8201.      less time, and so on.
  8202.  
  8203.      However, simplification is not vital; if you do not want to do
  8204.      this, report the bug anyway and send us the entire test case you
  8205.      used.
  8206.  
  8207.    * A patch for the bug.
  8208.  
  8209.      A patch for the bug does help us if it is a good one.  But do not
  8210.      omit the necessary information, such as the test case, on the
  8211.      assumption that a patch is all we need.  We might see problems
  8212.      with your patch and decide to fix the problem another way, or we
  8213.      might not understand it at all.
  8214.  
  8215.      Sometimes with a program as complicated as GDB it is very hard to
  8216.      construct an example that will make the program follow a certain
  8217.      path through the code.  If you do not send us the example, we will
  8218.      not be able to construct one, so we will not be able to verify
  8219.      that the bug is fixed.
  8220.  
  8221.      And if we cannot understand what bug you are trying to fix, or why
  8222.      your patch should be an improvement, we will not install it.  A
  8223.      test case will help us to understand.
  8224.  
  8225.    * A guess about what the bug is or what it depends on.
  8226.  
  8227.      Such guesses are usually wrong.  Even we cannot guess right about
  8228.      such things without first using the debugger to find the facts.
  8229.  
  8230. 
  8231. File: gdb,  Node: Command Line Editing,  Next: Using History Interactively,  Prev: GDB Bugs,  Up: Top
  8232.  
  8233. Command Line Editing
  8234. ********************
  8235.  
  8236.    This text describes GNU's command line editing interface.
  8237.  
  8238. * Menu:
  8239.  
  8240. * Introduction and Notation::    Notation used in this text.
  8241. * Readline Interaction::    The minimum set of commands for editing a line.
  8242. * Readline Init File::        Customizing Readline from a user's view.
  8243.  
  8244. 
  8245. File: gdb,  Node: Introduction and Notation,  Next: Readline Interaction,  Up: Command Line Editing
  8246.  
  8247. Introduction to Line Editing
  8248. ============================
  8249.  
  8250.    The following paragraphs describe the notation we use to represent
  8251. keystrokes.
  8252.  
  8253.    The text C-k is read as `Control-K' and describes the character
  8254. produced when the Control key is depressed and the k key is struck.
  8255.  
  8256.    The text M-k is read as `Meta-K' and describes the character
  8257. produced when the meta key (if you have one) is depressed, and the k
  8258. key is struck.  If you do not have a meta key, the identical keystroke
  8259. can be generated by typing ESC first, and then typing k.  Either
  8260. process is known as "metafying" the k key.
  8261.  
  8262.    The text M-C-k is read as `Meta-Control-k' and describes the
  8263. character produced by "metafying" C-k.
  8264.  
  8265.    In addition, several keys have their own names.  Specifically, DEL,
  8266. ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this
  8267. text, or in an init file (*note Readline Init File::., for more info).
  8268.  
  8269. 
  8270. File: gdb,  Node: Readline Interaction,  Next: Readline Init File,  Prev: Introduction and Notation,  Up: Command Line Editing
  8271.  
  8272. Readline Interaction
  8273. ====================
  8274.  
  8275.    Often during an interactive session you type in a long line of text,
  8276. only to notice that the first word on the line is misspelled.  The
  8277. Readline library gives you a set of commands for manipulating the text
  8278. as you type it in, allowing you to just fix your typo, and not forcing
  8279. you to retype the majority of the line.  Using these editing commands,
  8280. you move the cursor to the place that needs correction, and delete or
  8281. insert the text of the corrections.  Then, when you are satisfied with
  8282. the line, you simply press RET.  You do not have to be at the end of
  8283. the line to press RET; the entire line is accepted regardless of the
  8284. location of the cursor within the line.
  8285.  
  8286. * Menu:
  8287.  
  8288. * Readline Bare Essentials::    The least you need to know about Readline.
  8289. * Readline Movement Commands::    Moving about the input line.
  8290. * Readline Killing Commands::    How to delete text, and how to get it back!
  8291. * Readline Arguments::        Giving numeric arguments to commands.
  8292.  
  8293. 
  8294. File: gdb,  Node: Readline Bare Essentials,  Next: Readline Movement Commands,  Up: Readline Interaction
  8295.  
  8296. Readline Bare Essentials
  8297. ------------------------
  8298.  
  8299.    In order to enter characters into the line, simply type them.  The
  8300. typed character appears where the cursor was, and then the cursor moves
  8301. one space to the right.  If you mistype a character, you can use DEL to
  8302. back up, and delete the mistyped character.
  8303.  
  8304.    Sometimes you may miss typing a character that you wanted to type,
  8305. and not notice your error until you have typed several other
  8306. characters.  In that case, you can type C-b to move the cursor to the
  8307. left, and then correct your mistake.  Aftwerwards, you can move the
  8308. cursor to the right with C-f.
  8309.  
  8310.    When you add text in the middle of a line, you will notice that
  8311. characters to the right of the cursor get `pushed over' to make room
  8312. for the text that you have inserted.  Likewise, when you delete text
  8313. behind the cursor, characters to the right of the cursor get `pulled
  8314. back' to fill in the blank space created by the removal of the text.  A
  8315. list of the basic bare essentials for editing the text of an input line
  8316. follows.
  8317.  
  8318. C-b
  8319.      Move back one character.
  8320.  
  8321. C-f
  8322.      Move forward one character.
  8323.  
  8324. DEL
  8325.      Delete the character to the left of the cursor.
  8326.  
  8327. C-d
  8328.      Delete the character underneath the cursor.
  8329.  
  8330. Printing characters
  8331.      Insert itself into the line at the cursor.
  8332.  
  8333. C-_
  8334.      Undo the last thing that you did.  You can undo all the way back
  8335.      to an empty line.
  8336.  
  8337. 
  8338. File: gdb,  Node: Readline Movement Commands,  Next: Readline Killing Commands,  Prev: Readline Bare Essentials,  Up: Readline Interaction
  8339.  
  8340. Readline Movement Commands
  8341. --------------------------
  8342.  
  8343.    The above table describes the most basic possible keystrokes that
  8344. you need in order to do editing of the input line.  For your
  8345. convenience, many other commands have been added in addition to C-b,
  8346. C-f, C-d, and DEL.  Here are some commands for moving more rapidly
  8347. about the line.
  8348.  
  8349. C-a
  8350.      Move to the start of the line.
  8351.  
  8352. C-e
  8353.      Move to the end of the line.
  8354.  
  8355. M-f
  8356.      Move forward a word.
  8357.  
  8358. M-b
  8359.      Move backward a word.
  8360.  
  8361. C-l
  8362.      Clear the screen, reprinting the current line at the top.
  8363.  
  8364.    Notice how C-f moves forward a character, while M-f moves forward a
  8365. word.  It is a loose convention that control keystrokes operate on
  8366. characters while meta keystrokes operate on words.
  8367.  
  8368. 
  8369. File: gdb,  Node: Readline Killing Commands,  Next: Readline Arguments,  Prev: Readline Movement Commands,  Up: Readline Interaction
  8370.  
  8371. Readline Killing Commands
  8372. -------------------------
  8373.  
  8374.    "Killing" text means to delete the text from the line, but to save
  8375. it away for later use, usually by "yanking" it back into the line.  If
  8376. the description for a command says that it `kills' text, then you can
  8377. be sure that you can get the text back in a different (or the same)
  8378. place later.
  8379.  
  8380.    Here is the list of commands for killing text.
  8381.  
  8382. C-k
  8383.      Kill the text from the current cursor position to the end of the
  8384.      line.
  8385.  
  8386. M-d
  8387.      Kill from the cursor to the end of the current word, or if between
  8388.      words, to the end of the next word.
  8389.  
  8390. M-DEL
  8391.      Kill from the cursor to the start of the previous word, or if
  8392.      between words, to the start of the previous word.
  8393.  
  8394. C-w
  8395.      Kill from the cursor to the previous whitespace.  This is
  8396.      different than M-DEL because the word boundaries differ.
  8397.  
  8398.    And, here is how to "yank" the text back into the line.
  8399.  
  8400. C-y
  8401.      Yank the most recently killed text back into the buffer at the
  8402.      cursor.
  8403.  
  8404. M-y
  8405.      Rotate the kill-ring, and yank the new top.  You can only do this
  8406.      if the prior command is C-y or M-y.
  8407.  
  8408.    When you use a kill command, the text is saved in a "kill-ring".
  8409. Any number of consecutive kills save all of the killed text together, so
  8410. that when you yank it back, you get it in one clean sweep.  The kill
  8411. ring is not line specific; the text that you killed on a previously
  8412. typed line is available to be yanked back later, when you are typing
  8413. another line.
  8414.  
  8415. 
  8416. File: gdb,  Node: Readline Arguments,  Prev: Readline Killing Commands,  Up: Readline Interaction
  8417.  
  8418. Readline Arguments
  8419. ------------------
  8420.  
  8421.    You can pass numeric arguments to Readline commands.  Sometimes the
  8422. argument acts as a repeat count, other times it is the sign of the
  8423. argument that is significant.  If you pass a negative argument to a
  8424. command which normally acts in a forward direction, that command will
  8425. act in a backward direction.  For example, to kill text back to the
  8426. start of the line, you might type M- C-k.
  8427.  
  8428.    The general way to pass numeric arguments to a command is to type
  8429. meta digits before the command.  If the first `digit' you type is a
  8430. minus sign (-), then the sign of the argument will be negative.  Once
  8431. you have typed one meta digit to get the argument started, you can type
  8432. the remainder of the digits, and then the command.  For example, to give
  8433. the C-d command an argument of 10, you could type M-1 0 C-d.
  8434.  
  8435. 
  8436. File: gdb,  Node: Readline Init File,  Prev: Readline Interaction,  Up: Command Line Editing
  8437.  
  8438. Readline Init File
  8439. ==================
  8440.  
  8441.    Although the Readline library comes with a set of GNU Emacs-like
  8442. keybindings, it is possible that you would like to use a different set
  8443. of keybindings.  You can customize programs that use Readline by putting
  8444. commands in an "init" file in your home directory.  The name of this
  8445. file is `~/.inputrc'.
  8446.  
  8447.    When a program which uses the Readline library starts up, the
  8448. `~/.inputrc' file is read, and the keybindings are set.
  8449.  
  8450.    In addition, the C-x C-r command re-reads this init file, thus
  8451. incorporating any changes that you might have made to it.
  8452.  
  8453. * Menu:
  8454.  
  8455. * Readline Init Syntax::    Syntax for the commands in `~/.inputrc'.
  8456. * Readline vi Mode::        Switching to `vi' mode in Readline.
  8457.  
  8458. 
  8459. File: gdb,  Node: Readline Init Syntax,  Next: Readline vi Mode,  Up: Readline Init File
  8460.  
  8461. Readline Init Syntax
  8462. --------------------
  8463.  
  8464.    There are only four constructs allowed in the `~/.inputrc' file:
  8465.  
  8466. Variable Settings
  8467.      You can change the state of a few variables in Readline.  You do
  8468.      this by using the `set' command within the init file.  Here is how
  8469.      you would specify that you wish to use `vi' line editing commands:
  8470.  
  8471.           set editing-mode vi
  8472.  
  8473.      Right now, there are only a few variables which can be set; so few
  8474.      in fact, that we just iterate them here:
  8475.  
  8476.     `editing-mode'
  8477.           The `editing-mode' variable controls which editing mode you
  8478.           are using.  By default, GNU Readline starts up in Emacs
  8479.           editing mode, where the keystrokes are most similar to Emacs.
  8480.           This variable can either be set to `emacs' or `vi'.
  8481.  
  8482.     `horizontal-scroll-mode'
  8483.           This variable can either be set to `On' or `Off'.  Setting it
  8484.           to `On' means that the text of the lines that you edit will
  8485.           scroll horizontally on a single screen line when they are
  8486.           larger than the width of the screen, instead of wrapping onto
  8487.           a new screen line.  By default, this variable is set to `Off'.
  8488.  
  8489.     `mark-modified-lines'
  8490.           This variable when set to `On', says to display an asterisk
  8491.           (`*') at the starts of history lines which have been modified.
  8492.           This variable is off by default.
  8493.  
  8494.     `prefer-visible-bell'
  8495.           If this variable is set to `On' it means to use a visible
  8496.           bell if one is available, rather than simply ringing the
  8497.           terminal bell.  By default, the value is `Off'.
  8498.  
  8499. Key Bindings
  8500.      The syntax for controlling keybindings in the `~/.inputrc' file is
  8501.      simple.  First you have to know the name of the command that you
  8502.      want to change.  The following pages contain tables of the command
  8503.      name, the default keybinding, and a short description of what the
  8504.      command does.
  8505.  
  8506.      Once you know the name of the command, simply place the name of
  8507.      the key you wish to bind the command to, a colon, and then the
  8508.      name of the command on a line in the `~/.inputrc' file.  The name
  8509.      of the key can be expressed in different ways, depending on which
  8510.      is most comfortable for you.
  8511.  
  8512.     KEYNAME: FUNCTION-NAME or MACRO
  8513.           KEYNAME is the name of a key spelled out in English.  For
  8514.           example:
  8515.                Control-u: universal-argument
  8516.                Meta-Rubout: backward-kill-word
  8517.                Control-o: ">&output"
  8518.  
  8519.           In the above example, C-u is bound to the function
  8520.           `universal-argument', and C-o is bound to run the macro
  8521.           expressed on the right hand side (that is, to insert the text
  8522.           `>&output' into the line).
  8523.  
  8524.     "KEYSEQ": FUNCTION-NAME or MACRO
  8525.           KEYSEQ differs from KEYNAME above in that strings denoting an
  8526.           entire key sequence can be specified.  Simply place the key
  8527.           sequence in double quotes.  GNU Emacs style key escapes can
  8528.           be used, as in the following example:
  8529.  
  8530.                "\C-u": universal-argument
  8531.                "\C-x\C-r": re-read-init-file
  8532.                "\e[11~": "Function Key 1"
  8533.  
  8534.           In the above example, C-u is bound to the function
  8535.           `universal-argument' (just as it was in the first example),
  8536.           C-x C-r is bound to the function `re-read-init-file', and ESC
  8537.           [ 1 1 ~ is bound to insert the text `Function Key 1'.
  8538.  
  8539. * Menu:
  8540.  
  8541. * Commands For Moving::        Moving about the line.
  8542. * Commands For History::    Getting at previous lines.
  8543. * Commands For Text::        Commands for changing text.
  8544. * Commands For Killing::    Commands for killing and yanking.
  8545. * Numeric Arguments::        Specifying numeric arguments, repeat counts.
  8546. * Commands For Completion::    Getting Readline to do the typing for you.
  8547. * Miscellaneous Commands::    Other miscillaneous commands.
  8548.  
  8549. 
  8550. File: gdb,  Node: Commands For Moving,  Next: Commands For History,  Up: Readline Init Syntax
  8551.  
  8552. Commands For Moving
  8553. ...................
  8554.  
  8555. `beginning-of-line (C-a)'
  8556.      Move to the start of the current line.
  8557.  
  8558. `end-of-line (C-e)'
  8559.      Move to the end of the line.
  8560.  
  8561. `forward-char (C-f)'
  8562.      Move forward a character.
  8563.  
  8564. `backward-char (C-b)'
  8565.      Move back a character.
  8566.  
  8567. `forward-word (M-f)'
  8568.      Move forward to the end of the next word.
  8569.  
  8570. `backward-word (M-b)'
  8571.      Move back to the start of this, or the previous, word.
  8572.  
  8573. `clear-screen (C-l)'
  8574.      Clear the screen leaving the current line at the top of the screen.
  8575.  
  8576. 
  8577. File: gdb,  Node: Commands For History,  Next: Commands For Text,  Prev: Commands For Moving,  Up: Readline Init Syntax
  8578.  
  8579. Commands For Manipulating The History
  8580. .....................................
  8581.  
  8582. `accept-line (Newline, Return)'
  8583.      Accept the line regardless of where the cursor is.  If this line is
  8584.      non-empty, add it to the history list.  If this line was a history
  8585.      line, then restore the history line to its original state.
  8586.  
  8587. `previous-history (C-p)'
  8588.      Move `up' through the history list.
  8589.  
  8590. `next-history (C-n)'
  8591.      Move `down' through the history list.
  8592.  
  8593. `beginning-of-history (M-<)'
  8594.      Move to the first line in the history.
  8595.  
  8596. `end-of-history (M->)'
  8597.      Move to the end of the input history, i.e., the line you are
  8598.      entering.
  8599.  
  8600. `reverse-search-history (C-r)'
  8601.      Search backward starting at the current line and moving `up'
  8602.      through the history as necessary.  This is an incremental search.
  8603.  
  8604. `forward-search-history (C-s)'
  8605.      Search forward starting at the current line and moving `down'
  8606.      through the the history as necessary.
  8607.  
  8608. 
  8609. File: gdb,  Node: Commands For Text,  Next: Commands For Killing,  Prev: Commands For History,  Up: Readline Init Syntax
  8610.  
  8611. Commands For Changing Text
  8612. ..........................
  8613.  
  8614. `delete-char (C-d)'
  8615.      Delete the character under the cursor.  If the cursor is at the
  8616.      beginning of the line, and there are no characters in the line, and
  8617.      the last character typed was not C-d, then return EOF.
  8618.  
  8619. `backward-delete-char (Rubout)'
  8620.      Delete the character behind the cursor.  A numeric argument says
  8621.      to kill the characters instead of deleting them.
  8622.  
  8623. `quoted-insert (C-q, C-v)'
  8624.      Add the next character that you type to the line verbatim.  This is
  8625.      how to insert things like C-q for example.
  8626.  
  8627. `tab-insert (M-TAB)'
  8628.      Insert a tab character.
  8629.  
  8630. `self-insert (a, b, A, 1, !, ...)'
  8631.      Insert yourself.
  8632.  
  8633. `transpose-chars (C-t)'
  8634.      Drag the character before point forward over the character at
  8635.      point.  Point moves forward as well.  If point is at the end of
  8636.      the line, then transpose the two characters before point.
  8637.      Negative arguments don't work.
  8638.  
  8639. `transpose-words (M-t)'
  8640.      Drag the word behind the cursor past the word in front of the
  8641.      cursor moving the cursor over that word as well.
  8642.  
  8643. `upcase-word (M-u)'
  8644.      Uppercase all letters in the current (or following) word.  With a
  8645.      negative argument, do the previous word, but do not move point.
  8646.  
  8647. `downcase-word (M-l)'
  8648.      Lowercase all letters in the current (or following) word.  With a
  8649.      negative argument, do the previous word, but do not move point.
  8650.  
  8651. `capitalize-word (M-c)'
  8652.      Uppercase the first letter in the current (or following) word.
  8653.      With a negative argument, do the previous word, but do not move
  8654.      point.
  8655.  
  8656. 
  8657. File: gdb,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Readline Init Syntax
  8658.  
  8659. Killing And Yanking
  8660. ...................
  8661.  
  8662. `kill-line (C-k)'
  8663.      Kill the text from the current cursor position to the end of the
  8664.      line.
  8665.  
  8666. `backward-kill-line ()'
  8667.      Kill backward to the beginning of the line.  This is normally
  8668.      unbound.
  8669.  
  8670. `kill-word (M-d)'
  8671.      Kill from the cursor to the end of the current word, or if between
  8672.      words, to the end of the next word.
  8673.  
  8674. `backward-kill-word (M-DEL)'
  8675.      Kill the word behind the cursor.
  8676.  
  8677. `unix-line-discard (C-u)'
  8678.      Kill the whole line the way C-u used to in Unix line input.  The
  8679.      killed text is saved on the kill-ring.
  8680.  
  8681. `unix-word-rubout (C-w)'
  8682.      Kill the word the way C-w used to in Unix line input.  The killed
  8683.      text is saved on the kill-ring.  This is different than
  8684.      backward-kill-word because the word boundaries differ.
  8685.  
  8686. `yank (C-y)'
  8687.      Yank the top of the kill ring into the buffer at point.
  8688.  
  8689. `yank-pop (M-y)'
  8690.      Rotate the kill-ring, and yank the new top.  You can only do this
  8691.      if the prior command is yank or yank-pop.
  8692.  
  8693. 
  8694. File: gdb,  Node: Numeric Arguments,  Next: Commands For Completion,  Prev: Commands For Killing,  Up: Readline Init Syntax
  8695.  
  8696. Specifying Numeric Arguments
  8697. ............................
  8698.  
  8699. `digit-argument (M-0, M-1, ... M--)'
  8700.      Add this digit to the argument already accumulating, or start a new
  8701.      argument.  M- starts a negative argument.
  8702.  
  8703. `universal-argument ()'
  8704.      Do what C-u does in GNU Emacs.  By default, this is not bound.
  8705.  
  8706. 
  8707. File: gdb,  Node: Commands For Completion,  Next: Miscellaneous Commands,  Prev: Numeric Arguments,  Up: Readline Init Syntax
  8708.  
  8709. Letting Readline Type For You
  8710. .............................
  8711.  
  8712. `complete (TAB)'
  8713.      Attempt to do completion on the text before point.  This is
  8714.      implementation defined.  Generally, if you are typing a filename
  8715.      argument, you can do filename completion; if you are typing a
  8716.      command, you can do command completion, if you are typing in a
  8717.      symbol to GDB, you can do symbol name completion, if you are
  8718.      typing in a variable to Bash, you can do variable name completion.
  8719.  
  8720. `possible-completions (M-?)'
  8721.      List the possible completions of the text before point.
  8722.  
  8723. 
  8724. File: gdb,  Node: Miscellaneous Commands,  Prev: Commands For Completion,  Up: Readline Init Syntax
  8725.  
  8726. Some Miscellaneous Commands
  8727. ...........................
  8728.  
  8729. `re-read-init-file (C-x C-r)'
  8730.      Read in the contents of your `~/.inputrc' file, and incorporate
  8731.      any bindings found there.
  8732.  
  8733. `abort (C-g)'
  8734.      Stop running the current editing command.
  8735.  
  8736. `prefix-meta (ESC)'
  8737.      Make the next character that you type be metafied.  This is for
  8738.      people without a meta key.  Typing ESC f is equivalent to typing
  8739.      M-f.
  8740.  
  8741. `undo (C-_)'
  8742.      Incremental undo, separately remembered for each line.
  8743.  
  8744. `revert-line (M-r)'
  8745.      Undo all changes made to this line.  This is like typing the `undo'
  8746.      command enough times to get back to the beginning.
  8747.  
  8748. 
  8749. File: gdb,  Node: Readline vi Mode,  Prev: Readline Init Syntax,  Up: Readline Init File
  8750.  
  8751. Readline `vi' Mode
  8752. ------------------
  8753.  
  8754.    While the Readline library does not have a full set of `vi' editing
  8755. functions, it does contain enough to allow simple editing of the line.
  8756.  
  8757.    In order to switch interactively between GNU Emacs and `vi' editing
  8758. modes, use the command M-C-j (toggle-editing-mode).
  8759.  
  8760.    When you enter a line in `vi' mode, you are already placed in
  8761. `insertion' mode, as if you had typed an `i'.  Pressing ESC switches
  8762. you into `edit' mode, where you can edit the text of the line with the
  8763. standard `vi' movement keys, move to previous history lines with `k',
  8764. and following lines with `j', and so forth.
  8765.  
  8766. 
  8767. File: gdb,  Node: Using History Interactively,  Next: Formatting Documentation,  Prev: Command Line Editing,  Up: Top
  8768.  
  8769. Using History Interactively
  8770. ***************************
  8771.  
  8772.    This chapter describes how to use the GNU History Library
  8773. interactively, from a user's standpoint.
  8774.  
  8775. * Menu:
  8776.  
  8777. * History Interaction::        What it feels like using History as a user.
  8778.  
  8779. 
  8780. File: gdb,  Node: History Interaction,  Up: Using History Interactively
  8781.  
  8782. History Interaction
  8783. ===================
  8784.  
  8785.    The History library provides a history expansion feature similar to
  8786. the history expansion in `csh'.  The following text describes the
  8787. syntax you use to manipulate history information.
  8788.  
  8789.    History expansion takes two parts.  In the first part, determine
  8790. which line from the previous history will be used for substitution.
  8791. This line is called the "event".  In the second part, select portions
  8792. of that line for inclusion into the current line.  These portions are
  8793. called "words".  GDB breaks the line into words in the same way that
  8794. the Bash shell does, so that several English (or Unix) words surrounded
  8795. by quotes are considered one word.
  8796.  
  8797. * Menu:
  8798.  
  8799. * Event Designators::    How to specify which history line to use.
  8800. * Word Designators::    Specifying which words are of interest.
  8801. * Modifiers::        Modifying the results of susbstitution.
  8802.  
  8803. 
  8804. File: gdb,  Node: Event Designators,  Next: Word Designators,  Up: History Interaction
  8805.  
  8806. Event Designators
  8807. -----------------
  8808.  
  8809.    An "event designator" is a reference to a command line entry in the
  8810. history list.
  8811.  
  8812. `!'
  8813.      Start a history subsititution, except when followed by a space,
  8814.      tab, or the end of the line... = or (.
  8815.  
  8816. `!!'
  8817.      Refer to the previous command.  This is a synonym for `!-1'.
  8818.  
  8819. `!n'
  8820.      Refer to command line N.
  8821.  
  8822. `!-n'
  8823.      Refer to the command line N lines back.
  8824.  
  8825. `!string'
  8826.      Refer to the most recent command starting with STRING.
  8827.  
  8828. `!?string'[`?']
  8829.      Refer to the most recent command containing STRING.
  8830.  
  8831. 
  8832. File: gdb,  Node: Word Designators,  Next: Modifiers,  Prev: Event Designators,  Up: History Interaction
  8833.  
  8834. Word Designators
  8835. ----------------
  8836.  
  8837.    A : separates the event designator from the "word designator".  It
  8838. can be omitted if the word designator begins with a ^, $, * or %.
  8839. Words are numbered from the beginning of the line, with the first word
  8840. being denoted by a 0 (zero).
  8841.  
  8842. `0 (zero)'
  8843.      The zero'th word.  For many applications, this is the command word.
  8844.  
  8845. `n'
  8846.      The N'th word.
  8847.  
  8848. `^'
  8849.      The first argument.  that is, word 1.
  8850.  
  8851. `$'
  8852.      The last argument.
  8853.  
  8854. `%'
  8855.      The word matched by the most recent `?string?' search.
  8856.  
  8857. `x-y'
  8858.      A range of words; `-Y' Abbreviates `0-Y'.
  8859.  
  8860. `*'
  8861.      All of the words, excepting the zero'th.  This is a synonym for
  8862.      `1-$'.  It is not an error to use * if there is just one word in
  8863.      the event.  The empty string is returned in that case.
  8864.  
  8865. 
  8866. File: gdb,  Node: Modifiers,  Prev: Word Designators,  Up: History Interaction
  8867.  
  8868. Modifiers
  8869. ---------
  8870.  
  8871.    After the optional word designator, you can add a sequence of one or
  8872. more of the following "modifiers", each preceded by a :.
  8873.  
  8874. `#'
  8875.      The entire command line typed so far.  This means the current
  8876.      command, not the previous command.
  8877.  
  8878. `h'
  8879.      Remove a trailing pathname component, leaving only the head.
  8880.  
  8881. `r'
  8882.      Remove a trailing suffix of the form `.'SUFFIX, leaving the
  8883.      basename.
  8884.  
  8885. `e'
  8886.      Remove all but the suffix.
  8887.  
  8888. `t'
  8889.      Remove all leading  pathname  components, leaving the tail.
  8890.  
  8891. `p'
  8892.      Print the new command but do not execute it.
  8893.  
  8894. 
  8895. File: gdb,  Node: Formatting Documentation,  Next: Installing GDB,  Prev: Using History Interactively,  Up: Top
  8896.  
  8897. Formatting Documentation
  8898. ************************
  8899.  
  8900.    The GDB 4 release includes an already-formatted reference card, ready
  8901. for printing with PostScript or Ghostscript, in the `gdb' subdirectory
  8902. of the main source directory(1).  If you can use PostScript or
  8903. Ghostscript with your printer, you can print the reference card
  8904. immediately with `refcard.ps'.
  8905.  
  8906.    The release also includes the source for the reference card.  You
  8907. can format it, using TeX, by typing:
  8908.  
  8909.      make refcard.dvi
  8910.  
  8911.    The GDB reference card is designed to print in "landscape" mode on
  8912. US "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  8913. high.  You will need to specify this form of printing as an option to
  8914. your DVI output program.
  8915.  
  8916.    All the documentation for GDB comes as part of the machine-readable
  8917. distribution.  The documentation is written in Texinfo format, which is
  8918. a documentation system that uses a single source file to produce both
  8919. on-line information and a printed manual.  You can use one of the Info
  8920. formatting commands to create the on-line version of the documentation
  8921. and TeX (or `texi2roff') to typeset the printed version.
  8922.  
  8923.    GDB includes an already formatted copy of the on-line Info version of
  8924. this manual in the `gdb' subdirectory.  The main Info file is
  8925. `gdb-version-number/gdb/gdb.info', and it refers to subordinate files
  8926. matching `gdb.info*' in the same directory.  If necessary, you can
  8927. print out these files, or read them with any editor; but they are
  8928. easier to read using the `info' subsystem in GNU Emacs or the
  8929. standalone `info' program, available as part of the GNU Texinfo
  8930. distribution.
  8931.  
  8932.    If you want to format these Info files yourself, you need one of the
  8933. Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
  8934.  
  8935.    If you have `makeinfo' installed, and are in the top level GDB
  8936. source directory (`gdb-4.16', in the case of version 4.16), you can
  8937. make the Info file by typing:
  8938.  
  8939.      cd gdb
  8940.      make gdb.info
  8941.  
  8942.    If you want to typeset and print copies of this manual, you need TeX,
  8943. a program to print its DVI output files, and `texinfo.tex', the Texinfo
  8944. definitions file.
  8945.  
  8946.    TeX is a typesetting program; it does not print files directly, but
  8947. produces output files called DVI files.  To print a typeset document,
  8948. you need a program to print DVI files.  If your system has TeX
  8949. installed, chances are it has such a program.  The precise command to
  8950. use depends on your system; `lpr -d' is common; another (for PostScript
  8951. devices) is `dvips'.  The DVI print command may require a file name
  8952. without any extension or a `.dvi' extension.
  8953.  
  8954.    TeX also requires a macro definitions file called `texinfo.tex'.
  8955. This file tells TeX how to typeset a document written in Texinfo
  8956. format.  On its own, TeX cannot either read or typeset a Texinfo file.
  8957. `texinfo.tex' is distributed with GDB and is located in the
  8958. `gdb-VERSION-NUMBER/texinfo' directory.
  8959.  
  8960.    If you have TeX and a DVI printer program installed, you can typeset
  8961. and print this manual.  First switch to the the `gdb' subdirectory of
  8962. the main source directory (for example, to `gdb-4.16/gdb') and then
  8963. type:
  8964.  
  8965.      make gdb.dvi
  8966.  
  8967.    ---------- Footnotes ----------
  8968.  
  8969.    (1)  In `gdb-4.16/gdb/refcard.ps' of the version 4.16 release.
  8970.  
  8971. 
  8972. File: gdb,  Node: Installing GDB,  Next: Index,  Prev: Formatting Documentation,  Up: Top
  8973.  
  8974. Installing GDB
  8975. **************
  8976.  
  8977.    GDB comes with a `configure' script that automates the process of
  8978. preparing GDB for installation; you can then use `make' to build the
  8979. `gdb' program.
  8980.  
  8981.    The GDB distribution includes all the source code you need for GDB
  8982. in a single directory, whose name is usually composed by appending the
  8983. version number to `gdb'.
  8984.  
  8985.    For example, the GDB version 4.16 distribution is in the `gdb-4.16'
  8986. directory.  That directory contains:
  8987.  
  8988. `gdb-4.16/configure (and supporting files)'
  8989.      script for configuring GDB and all its supporting libraries
  8990.  
  8991. `gdb-4.16/gdb'
  8992.      the source specific to GDB itself
  8993.  
  8994. `gdb-4.16/bfd'
  8995.      source for the Binary File Descriptor library
  8996.  
  8997. `gdb-4.16/include'
  8998.      GNU include files
  8999.  
  9000. `gdb-4.16/libiberty'
  9001.      source for the `-liberty' free software library
  9002.  
  9003. `gdb-4.16/opcodes'
  9004.      source for the library of opcode tables and disassemblers
  9005.  
  9006. `gdb-4.16/readline'
  9007.      source for the GNU command-line interface
  9008.  
  9009. `gdb-4.16/glob'
  9010.      source for the GNU filename pattern-matching subroutine
  9011.  
  9012. `gdb-4.16/mmalloc'
  9013.      source for the GNU memory-mapped malloc package
  9014.  
  9015.    The simplest way to configure and build GDB is to run `configure'
  9016. from the `gdb-VERSION-NUMBER' source directory, which in this example
  9017. is the `gdb-4.16' directory.
  9018.  
  9019.    First switch to the `gdb-VERSION-NUMBER' source directory if you are
  9020. not already in it; then run `configure'.  Pass the identifier for the
  9021. platform on which GDB will run as an argument.
  9022.  
  9023.    For example:
  9024.  
  9025.      cd gdb-4.16
  9026.      ./configure HOST
  9027.      make
  9028.  
  9029. where HOST is an identifier such as `sun4' or `decstation', that
  9030. identifies the platform where GDB will run.  (You can often leave off
  9031. HOST; `configure' tries to guess the correct value by examining your
  9032. system.)
  9033.  
  9034.    Running `configure HOST' and then running `make' builds the `bfd',
  9035. `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
  9036. The configured source files, and the binaries, are left in the
  9037. corresponding source directories.
  9038.  
  9039.    `configure' is a Bourne-shell (`/bin/sh') script; if your system
  9040. does not recognize this automatically when you run a different shell,
  9041. you may need to run `sh' on it explicitly:
  9042.  
  9043.      sh configure HOST
  9044.  
  9045.    If you run `configure' from a directory that contains source
  9046. directories for multiple libraries or programs, such as the `gdb-4.16'
  9047. source directory for version 4.16, `configure' creates configuration
  9048. files for every directory level underneath (unless you tell it not to,
  9049. with the `--norecursion' option).
  9050.  
  9051.    You can run the `configure' script from any of the subordinate
  9052. directories in the GDB distribution if you only want to configure that
  9053. subdirectory, but be sure to specify a path to it.
  9054.  
  9055.    For example, with version 4.16, type the following to configure only
  9056. the `bfd' subdirectory:
  9057.  
  9058.      cd gdb-4.16/bfd
  9059.      ../configure HOST
  9060.  
  9061.    You can install `gdb' anywhere; it has no hardwired paths.  However,
  9062. you should make sure that the shell on your path (named by the `SHELL'
  9063. environment variable) is publicly readable.  Remember that GDB uses the
  9064. shell to start your program--some systems refuse to let GDB debug child
  9065. processes whose programs are not readable.
  9066.  
  9067. * Menu:
  9068.  
  9069. * Separate Objdir::             Compiling GDB in another directory
  9070. * Config Names::                Specifying names for hosts and targets
  9071. * configure Options::           Summary of options for configure
  9072.  
  9073. 
  9074. File: gdb,  Node: Separate Objdir,  Next: Config Names,  Up: Installing GDB
  9075.  
  9076. Compiling GDB in another directory
  9077. ==================================
  9078.  
  9079.    If you want to run GDB versions for several host or target machines,
  9080. you need a different `gdb' compiled for each combination of host and
  9081. target.  `configure' is designed to make this easy by allowing you to
  9082. generate each configuration in a separate subdirectory, rather than in
  9083. the source directory.  If your `make' program handles the `VPATH'
  9084. feature (GNU `make' does), running `make' in each of these directories
  9085. builds the `gdb' program specified there.
  9086.  
  9087.    To build `gdb' in a separate directory, run `configure' with the
  9088. `--srcdir' option to specify where to find the source.  (You also need
  9089. to specify a path to find `configure' itself from your working
  9090. directory.  If the path to `configure' would be the same as the
  9091. argument to `--srcdir', you can leave out the `--srcdir' option; it is
  9092. assumed.)
  9093.  
  9094.    For example, with version 4.16, you can build GDB in a separate
  9095. directory for a Sun 4 like this:
  9096.  
  9097.      cd gdb-4.16
  9098.      mkdir ../gdb-sun4
  9099.      cd ../gdb-sun4
  9100.      ../gdb-4.16/configure sun4
  9101.      make
  9102.  
  9103.    When `configure' builds a configuration using a remote source
  9104. directory, it creates a tree for the binaries with the same structure
  9105. (and using the same names) as the tree under the source directory.  In
  9106. the example, you'd find the Sun 4 library `libiberty.a' in the
  9107. directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
  9108.  
  9109.    One popular reason to build several GDB configurations in separate
  9110. directories is to configure GDB for cross-compiling (where GDB runs on
  9111. one machine--the "host"--while debugging programs that run on another
  9112. machine--the "target").  You specify a cross-debugging target by giving
  9113. the `--target=TARGET' option to `configure'.
  9114.  
  9115.    When you run `make' to build a program or library, you must run it
  9116. in a configured directory--whatever directory you were in when you
  9117. called `configure' (or one of its subdirectories).
  9118.  
  9119.    The `Makefile' that `configure' generates in each source directory
  9120. also runs recursively.  If you type `make' in a source directory such
  9121. as `gdb-4.16' (or in a separate configured directory configured with
  9122. `--srcdir=DIRNAME/gdb-4.16'), you will build all the required
  9123. libraries, and then build GDB.
  9124.  
  9125.    When you have multiple hosts or targets configured in separate
  9126. directories, you can run `make' on them in parallel (for example, if
  9127. they are NFS-mounted on each of the hosts); they will not interfere
  9128. with each other.
  9129.  
  9130. 
  9131. File: gdb,  Node: Config Names,  Next: configure Options,  Prev: Separate Objdir,  Up: Installing GDB
  9132.  
  9133. Specifying names for hosts and targets
  9134. ======================================
  9135.  
  9136.    The specifications used for hosts and targets in the `configure'
  9137. script are based on a three-part naming scheme, but some short
  9138. predefined aliases are also supported.  The full naming scheme encodes
  9139. three pieces of information in the following pattern:
  9140.  
  9141.      ARCHITECTURE-VENDOR-OS
  9142.  
  9143.    For example, you can use the alias `sun4' as a HOST argument, or as
  9144. the value for TARGET in a `--target=TARGET' option.  The equivalent
  9145. full name is `sparc-sun-sunos4'.
  9146.  
  9147.    The `configure' script accompanying GDB does not provide any query
  9148. facility to list all supported host and target names or aliases.
  9149. `configure' calls the Bourne shell script `config.sub' to map
  9150. abbreviations to full names; you can read the script, if you wish, or
  9151. you can use it to test your guesses on abbreviations--for example:
  9152.  
  9153.      % sh config.sub sun4
  9154.      sparc-sun-sunos4.1.1
  9155.      % sh config.sub sun3
  9156.      m68k-sun-sunos4.1.1
  9157.      % sh config.sub decstation
  9158.      mips-dec-ultrix4.2
  9159.      % sh config.sub hp300bsd
  9160.      m68k-hp-bsd
  9161.      % sh config.sub i386v
  9162.      i386-unknown-sysv
  9163.      % sh config.sub i786v
  9164.      Invalid configuration `i786v': machine `i786v' not recognized
  9165.  
  9166. `config.sub' is also distributed in the GDB source directory
  9167. (`gdb-4.16', for version 4.16).
  9168.  
  9169. 
  9170. File: gdb,  Node: configure Options,  Prev: Config Names,  Up: Installing GDB
  9171.  
  9172. `configure' options
  9173. ===================
  9174.  
  9175.    Here is a summary of the `configure' options and arguments that are
  9176. most often useful for building GDB.  `configure' also has several other
  9177. options not listed here.  *note : (configure.info)What Configure Does,
  9178. for a full explanation of `configure'.
  9179.  
  9180.      configure [--help]
  9181.                [--prefix=DIR]
  9182.                [--srcdir=DIRNAME]
  9183.                [--norecursion] [--rm]
  9184.                [--target=TARGET] HOST
  9185.  
  9186. You may introduce options with a single `-' rather than `--' if you
  9187. prefer; but you may abbreviate option names if you use `--'.
  9188.  
  9189. `--help'
  9190.      Display a quick summary of how to invoke `configure'.
  9191.  
  9192. `-prefix=DIR'
  9193.      Configure the source to install programs and files under directory
  9194.      `DIR'.
  9195.  
  9196. `--srcdir=DIRNAME'
  9197.      *Warning: using this option requires GNU `make', or another `make'
  9198.      that implements the `VPATH' feature.*
  9199.      Use this option to make configurations in directories separate
  9200.      from the GDB source directories.  Among other things, you can use
  9201.      this to build (or maintain) several configurations simultaneously,
  9202.      in separate directories.  `configure' writes configuration
  9203.      specific files in the current directory, but arranges for them to
  9204.      use the source in the directory DIRNAME.  `configure' creates
  9205.      directories under the working directory in parallel to the source
  9206.      directories below DIRNAME.
  9207.  
  9208. `--norecursion'
  9209.      Configure only the directory level where `configure' is executed;
  9210.      do not propagate configuration to subdirectories.
  9211.  
  9212. `--rm'
  9213.      *Remove* files otherwise built during configuration.
  9214.  
  9215. `--target=TARGET'
  9216.      Configure GDB for cross-debugging programs running on the specified
  9217.      TARGET.  Without this option, GDB is configured to debug programs
  9218.      that run on the same machine (HOST) as GDB itself.
  9219.  
  9220.      There is no convenient way to generate a list of all available
  9221.      targets.
  9222.  
  9223. `HOST ...'
  9224.      Configure GDB to run on the specified HOST.
  9225.  
  9226.      There is no convenient way to generate a list of all available
  9227.      hosts.
  9228.  
  9229. `configure' accepts other options, for compatibility with configuring
  9230. other GNU tools recursively; but these are the only options that affect
  9231. GDB or its supporting libraries.
  9232.  
  9233. 
  9234. File: gdb,  Node: Index,  Prev: Installing GDB,  Up: Top
  9235.  
  9236. Index
  9237. *****
  9238.  
  9239. * Menu:
  9240.  
  9241. * #:                                    Command Syntax.
  9242. * $_:                                   Convenience Vars.
  9243. * $__:                                  Convenience Vars.
  9244. * $_exitcode:                           Convenience Vars.
  9245. * $bpnum:                               Set Breaks.
  9246. * $cdir:                                Source Path.
  9247. * $cwd:                                 Source Path.
  9248. * .:                                    M2 Scope.
  9249. * .esgdbinit:                           Command Files.
  9250. * .os68gdbinit:                         Command Files.
  9251. * .vxgdbinit:                           Command Files.
  9252. * /proc:                                Process Information.
  9253. * @:                                    Arrays.
  9254. * # in Modula-2:                        GDB/M2.
  9255. * $$:                                   Value History.
  9256. * $_ and info breakpoints:              Set Breaks.
  9257. * $_ and info line:                     Machine Code.
  9258. * $_, $__, and value history:           Memory.
  9259. * $:                                    Value History.
  9260. * breakpoint subroutine, remote:        Stub Contents.
  9261. * heuristic-fence-post (MIPS):          MIPS Stack.
  9262. * remotedebug, MIPS protocol:           MIPS Remote.
  9263. * retransmit-timeout, MIPS protocol:    MIPS Remote.
  9264. * timeout, MIPS protocol:               MIPS Remote.
  9265. * vi style command editing:             Readline vi Mode.
  9266. * .gdbinit:                             Command Files.
  9267. * COFF versus C++:                      Cplus expressions.
  9268. * ECOFF and C++:                        Cplus expressions.
  9269. * ELF/DWARF and C++:                    Cplus expressions.
  9270. * ELF/stabs and C++:                    Cplus expressions.
  9271. * GNU C++:                              C.
  9272. * GNU Emacs:                            Emacs.
  9273. * XCOFF and C++:                        Cplus expressions.
  9274. * GDB bugs, reporting:                  Bug Reporting.
  9275. * GDB reference card:                   Formatting Documentation.
  9276. * {TYPE}:                               Expressions.
  9277. * a.out and C++:                        Cplus expressions.
  9278. * abbreviation:                         Command Syntax.
  9279. * active targets:                       Active Targets.
  9280. * add-shared-symbol-file:               Files.
  9281. * add-symbol-file:                      Files.
  9282. * AMD 29K register stack:               Registers.
  9283. * AMD EB29K:                            Target Commands.
  9284. * AMD29K via UDI:                       UDI29K Remote.
  9285. * arguments (to your program):          Arguments.
  9286. * artificial array:                     Arrays.
  9287. * assembly instructions:                Machine Code.
  9288. * assignment:                           Assignment.
  9289. * attach:                               Attach.
  9290. * automatic display:                    Auto Display.
  9291. * automatic thread selection:           Threads.
  9292. * awatch:                               Set Watchpoints.
  9293. * b:                                    Set Breaks.
  9294. * backtrace:                            Backtrace.
  9295. * break:                                Set Breaks.
  9296. * break ... thread THREADNO:            Thread Stops.
  9297. * break in overloaded functions:        Debugging C plus plus.
  9298. * breakpoint commands:                  Break Commands.
  9299. * breakpoint conditions:                Conditions.
  9300. * breakpoint numbers:                   Breakpoints.
  9301. * breakpoint on memory address:         Breakpoints.
  9302. * breakpoint on variable modification:  Breakpoints.
  9303. * breakpoints:                          Breakpoints.
  9304. * breakpoints and threads:              Thread Stops.
  9305. * bt:                                   Backtrace.
  9306. * bug criteria:                         Bug Criteria.
  9307. * bug reports:                          Bug Reporting.
  9308. * bugs in GDB:                          GDB Bugs.
  9309. * c:                                    Continuing and Stepping.
  9310. * C and C++:                            C.
  9311. * C and C++ checks:                     C Checks.
  9312. * C and C++ constants:                  C Operators.
  9313. * C and C++ defaults:                   C Defaults.
  9314. * C and C++ operators:                  C.
  9315. * C++:                                  C.
  9316. * C++ and object formats:               Cplus expressions.
  9317. * C++ exception handling:               Debugging C plus plus.
  9318. * C++ scope resolution:                 Variables.
  9319. * C++ support, not in COFF:             Cplus expressions.
  9320. * C++ symbol decoding style:            Print Settings.
  9321. * C++ symbol display:                   Debugging C plus plus.
  9322. * call:                                 Calling.
  9323. * call overloaded functions:            Cplus expressions.
  9324. * call stack:                           Stack.
  9325. * calling functions:                    Calling.
  9326. * calling make:                         Shell Commands.
  9327. * casts, to view memory:                Expressions.
  9328. * catch:                                Exception Handling.
  9329. * catch exceptions:                     Frame Info.
  9330. * cd:                                   Working Directory.
  9331. * cdir:                                 Source Path.
  9332. * checks, range:                        Type Checking.
  9333. * checks, type:                         Checks.
  9334. * checksum, for GDB remote:             Protocol.
  9335. * choosing target byte order:           Target Commands.
  9336. * clear:                                Delete Breaks.
  9337. * clearing breakpoints, watchpoints:    Delete Breaks.
  9338. * colon, doubled as scope operator:     M2 Scope.
  9339. * colon-colon <1>:                      M2 Scope.
  9340. * colon-colon:                          Variables.
  9341. * command files <1>:                    Hooks.
  9342. * command files:                        Command Files.
  9343. * command line editing:                 Editing.
  9344. * commands:                             Break Commands.
  9345. * commands for C++:                     Debugging C plus plus.
  9346. * commands to STDBUG (ST2000):          ST2000 Remote.
  9347. * comment:                              Command Syntax.
  9348. * compilation directory:                Source Path.
  9349. * complete:                             Help.
  9350. * completion:                           Completion.
  9351. * completion of quoted strings:         Completion.
  9352. * condition:                            Conditions.
  9353. * conditional breakpoints:              Conditions.
  9354. * configuring GDB:                      Installing GDB.
  9355. * confirmation:                         Messages/Warnings.
  9356. * connect (to STDBUG):                  ST2000 Remote.
  9357. * continue:                             Continuing and Stepping.
  9358. * continuing:                           Continuing and Stepping.
  9359. * continuing threads:                   Thread Stops.
  9360. * control C, and remote debugging:      Bootstrapping.
  9361. * controlling terminal:                 Input/Output.
  9362. * convenience variables:                Convenience Vars.
  9363. * core:                                 Files.
  9364. * core dump file:                       Files.
  9365. * core-file:                            Files.
  9366. * CPU simulator:                        Simulator.
  9367. * crash of debugger:                    Bug Criteria.
  9368. * current directory:                    Source Path.
  9369. * current thread:                       Threads.
  9370. * cwd:                                  Source Path.
  9371. * d:                                    Delete Breaks.
  9372. * debugger crash:                       Bug Criteria.
  9373. * debugging optimized code:             Compilation.
  9374. * debugging stub, example:              Protocol.
  9375. * debugging target:                     Targets.
  9376. * define:                               Define.
  9377. * delete:                               Delete Breaks.
  9378. * delete breakpoints:                   Delete Breaks.
  9379. * delete display:                       Auto Display.
  9380. * deleting breakpoints, watchpoints:    Delete Breaks.
  9381. * demangling:                           Print Settings.
  9382. * detach:                               Attach.
  9383. * device:                               Hitachi Boards.
  9384. * dir:                                  Source Path.
  9385. * directories for source files:         Source Path.
  9386. * directory:                            Source Path.
  9387. * directory, compilation:               Source Path.
  9388. * directory, current:                   Source Path.
  9389. * dis:                                  Disabling.
  9390. * disable:                              Disabling.
  9391. * disable breakpoints:                  Disabling.
  9392. * disable display:                      Auto Display.
  9393. * disassemble:                          Machine Code.
  9394. * display:                              Auto Display.
  9395. * display of expressions:               Auto Display.
  9396. * do:                                   Selection.
  9397. * document:                             Define.
  9398. * documentation:                        Formatting Documentation.
  9399. * down:                                 Selection.
  9400. * down-silently:                        Selection.
  9401. * download to H8/300 or H8/500:         Files.
  9402. * download to Hitachi SH:               Files.
  9403. * download to Nindy-960:                Files.
  9404. * download to VxWorks:                  VxWorks Download.
  9405. * dynamic linking:                      Files.
  9406. * eb.log:                               Remote Log.
  9407. * EB29K board:                          EB29K Remote.
  9408. * EBMON:                                Comms (EB29K).
  9409. * echo:                                 Output.
  9410. * editing:                              Editing.
  9411. * editing-mode:                         Readline Init Syntax.
  9412. * else:                                 Define.
  9413. * Emacs:                                Emacs.
  9414. * enable:                               Disabling.
  9415. * enable breakpoints:                   Disabling.
  9416. * enable display:                       Auto Display.
  9417. * end:                                  Break Commands.
  9418. * entering numbers:                     Numbers.
  9419. * environment (of your program):        Environment.
  9420. * error on valid input:                 Bug Criteria.
  9421. * event designators:                    Event Designators.
  9422. * examining data:                       Data.
  9423. * examining memory:                     Memory.
  9424. * exception handlers <1>:               Frame Info.
  9425. * exception handlers:                   Exception Handling.
  9426. * exceptionHandler:                     Bootstrapping.
  9427. * exec-file:                            Files.
  9428. * executable file:                      Files.
  9429. * exiting GDB:                          Quitting GDB.
  9430. * expansion:                            History Interaction.
  9431. * expressions:                          Expressions.
  9432. * expressions in C or C++:              C.
  9433. * expressions in C++:                   Cplus expressions.
  9434. * expressions in Modula-2:              Modula-2.
  9435. * f:                                    Selection.
  9436. * fatal signal:                         Bug Criteria.
  9437. * fatal signals:                        Signals.
  9438. * fg:                                   Continuing and Stepping.
  9439. * file:                                 Files.
  9440. * finish:                               Continuing and Stepping.
  9441. * flinching:                            Messages/Warnings.
  9442. * floating point:                       Floating Point Hardware.
  9443. * floating point registers:             Registers.
  9444. * floating point, MIPS remote:          MIPS Remote.
  9445. * flush_i_cache:                        Bootstrapping.
  9446. * focus of debugging:                   Threads.
  9447. * foo:                                  Symbol Errors.
  9448. * fork, debugging programs which call:  Processes.
  9449. * format options:                       Print Settings.
  9450. * formatted output:                     Output Formats.
  9451. * Fortran:                              Summary.
  9452. * forward-search:                       Search.
  9453. * frame <1>:                            Frames.
  9454. * frame <1>:                            Selection.
  9455. * frame:                                Frames.
  9456. * frame number:                         Frames.
  9457. * frame pointer:                        Frames.
  9458. * frameless execution:                  Frames.
  9459. * g++:                                  C.
  9460. * GDBHISTFILE:                          History.
  9461. * gdbserve.nlm:                         NetWare.
  9462. * gdbserver:                            Server.
  9463. * getDebugChar:                         Bootstrapping.
  9464. * h:                                    Help.
  9465. * H8/300 or H8/500 download:            Files.
  9466. * H8/300 or H8/500 simulator:           Simulator.
  9467. * handle:                               Signals.
  9468. * handle_exception:                     Stub Contents.
  9469. * handling signals:                     Signals.
  9470. * hbreak:                               Set Breaks.
  9471. * help:                                 Help.
  9472. * help target:                          Target Commands.
  9473. * help user-defined:                    Define.
  9474. * history expansion:                    History.
  9475. * history file:                         History.
  9476. * history number:                       Value History.
  9477. * history save:                         History.
  9478. * history size:                         History.
  9479. * history substitution:                 History.
  9480. * Hitachi SH download:                  Files.
  9481. * Hitachi SH simulator:                 Simulator.
  9482. * horizontal-scroll-mode:               Readline Init Syntax.
  9483. * i:                                    Help.
  9484. * i/o:                                  Input/Output.
  9485. * i386:                                 Remote Serial.
  9486. * i386-stub.c:                          Remote Serial.
  9487. * i960:                                 i960-Nindy Remote.
  9488. * if:                                   Define.
  9489. * ignore:                               Conditions.
  9490. * ignore count (of breakpoint):         Conditions.
  9491. * INCLUDE_RDB:                          VxWorks Remote.
  9492. * info:                                 Help.
  9493. * info address:                         Symbols.
  9494. * info all-registers:                   Registers.
  9495. * info args:                            Frame Info.
  9496. * info breakpoints:                     Set Breaks.
  9497. * info catch:                           Frame Info.
  9498. * info display:                         Auto Display.
  9499. * info f:                               Frame Info.
  9500. * info files:                           Files.
  9501. * info float:                           Floating Point Hardware.
  9502. * info frame <1>:                       Frame Info.
  9503. * info frame:                           Show.
  9504. * info functions:                       Symbols.
  9505. * info line:                            Machine Code.
  9506. * info locals:                          Frame Info.
  9507. * info proc:                            Process Information.
  9508. * info proc id:                         Process Information.
  9509. * info proc mappings:                   Process Information.
  9510. * info proc status:                     Process Information.
  9511. * info proc times:                      Process Information.
  9512. * info program:                         Stopping.
  9513. * info registers:                       Registers.
  9514. * info s:                               Backtrace.
  9515. * info set:                             Help.
  9516. * info share:                           Files.
  9517. * info sharedlibrary:                   Files.
  9518. * info signals:                         Signals.
  9519. * info source <1>:                      Show.
  9520. * info source:                          Symbols.
  9521. * info sources:                         Symbols.
  9522. * info stack:                           Backtrace.
  9523. * info target:                          Files.
  9524. * info terminal:                        Input/Output.
  9525. * info threads:                         Threads.
  9526. * info types:                           Symbols.
  9527. * info variables:                       Symbols.
  9528. * info watchpoints:                     Set Watchpoints.
  9529. * inheritance:                          Debugging C plus plus.
  9530. * init file:                            Command Files.
  9531. * init file name:                       Command Files.
  9532. * initial frame:                        Frames.
  9533. * innermost frame:                      Frames.
  9534. * inspect:                              Data.
  9535. * installation:                         Installing GDB.
  9536. * instructions, assembly:               Machine Code.
  9537. * Intel:                                Remote Serial.
  9538. * interaction, readline:                Readline Interaction.
  9539. * internal GDB breakpoints:             Set Breaks.
  9540. * interrupt:                            Quitting GDB.
  9541. * interrupting remote programs:         Debug Session.
  9542. * interrupting remote targets:          Bootstrapping.
  9543. * invalid input:                        Bug Criteria.
  9544. * jump:                                 Jumping.
  9545. * kill:                                 Kill Process.
  9546. * l:                                    List.
  9547. * languages:                            Languages.
  9548. * latest breakpoint:                    Set Breaks.
  9549. * leaving GDB:                          Quitting GDB.
  9550. * linespec:                             List.
  9551. * list:                                 List.
  9552. * listing machine instructions:         Machine Code.
  9553. * load FILENAME:                        Files.
  9554. * log file for EB29K:                   Remote Log.
  9555. * m680x0:                               Remote Serial.
  9556. * m68k-stub.c:                          Remote Serial.
  9557. * machine instructions:                 Machine Code.
  9558. * maint info breakpoints:               Set Breaks.
  9559. * maint print psymbols:                 Symbols.
  9560. * maint print symbols:                  Symbols.
  9561. * make:                                 Shell Commands.
  9562. * mapped:                               Files.
  9563. * mark-modified-lines:                  Readline Init Syntax.
  9564. * member functions:                     Cplus expressions.
  9565. * memory models, H8/500:                Hitachi Special.
  9566. * memory tracing:                       Breakpoints.
  9567. * memory, viewing as typed object:      Expressions.
  9568. * memory-mapped symbol file:            Files.
  9569. * memset:                               Bootstrapping.
  9570. * MIPS remotedebug protocol:            MIPS Remote.
  9571. * MIPS boards:                          MIPS Remote.
  9572. * MIPS remote floating point:           MIPS Remote.
  9573. * MIPS stack:                           MIPS Stack.
  9574. * Modula-2:                             Modula-2.
  9575. * Modula-2 built-ins:                   M2 Operators.
  9576. * Modula-2 checks:                      M2 Checks.
  9577. * Modula-2 constants:                   Built-In Func/Proc.
  9578. * Modula-2 defaults:                    M2 Defaults.
  9579. * Modula-2 operators:                   M2 Operators.
  9580. * Modula-2, deviations from:            Deviations.
  9581. * Motorola 680x0:                       Remote Serial.
  9582. * multiple processes:                   Processes.
  9583. * multiple targets:                     Active Targets.
  9584. * multiple threads:                     Threads.
  9585. * n:                                    Continuing and Stepping.
  9586. * names of symbols:                     Symbols.
  9587. * namespace in C++:                     Cplus expressions.
  9588. * negative breakpoint numbers:          Set Breaks.
  9589. * New SYSTAG:                           Threads.
  9590. * next:                                 Continuing and Stepping.
  9591. * nexti:                                Continuing and Stepping.
  9592. * ni:                                   Continuing and Stepping.
  9593. * Nindy:                                i960-Nindy Remote.
  9594. * number representation:                Numbers.
  9595. * numbers for breakpoints:              Breakpoints.
  9596. * object formats and C++:               Cplus expressions.
  9597. * online documentation:                 Help.
  9598. * optimized code, debugging:            Compilation.
  9599. * outermost frame:                      Frames.
  9600. * output:                               Output.
  9601. * output formats:                       Output Formats.
  9602. * overloading:                          Breakpoint Menus.
  9603. * overloading in C++:                   Debugging C plus plus.
  9604. * packets, reporting on stdout:         Protocol.
  9605. * partial symbol dump:                  Symbols.
  9606. * patching binaries:                    Patching.
  9607. * path:                                 Environment.
  9608. * pauses in output:                     Screen Size.
  9609. * pipes:                                Starting.
  9610. * pointer, finding referent:            Print Settings.
  9611. * prefer-visible-bell:                  Readline Init Syntax.
  9612. * print:                                Data.
  9613. * print settings:                       Print Settings.
  9614. * printf:                               Output.
  9615. * printing data:                        Data.
  9616. * process image:                        Process Information.
  9617. * processes, multiple:                  Processes.
  9618. * prompt:                               Prompt.
  9619. * protocol, GDB remote serial:          Protocol.
  9620. * ptype:                                Symbols.
  9621. * putDebugChar:                         Bootstrapping.
  9622. * pwd:                                  Working Directory.
  9623. * q:                                    Quitting GDB.
  9624. * quit [EXPRESSION]:                    Quitting GDB.
  9625. * quotes in commands:                   Completion.
  9626. * quoting names:                        Symbols.
  9627. * raise exceptions:                     Exception Handling.
  9628. * range checking:                       Type Checking.
  9629. * rbreak:                               Set Breaks.
  9630. * reading symbols immediately:          Files.
  9631. * readline:                             Editing.
  9632. * readnow:                              Files.
  9633. * redirection:                          Input/Output.
  9634. * reference card:                       Formatting Documentation.
  9635. * reference declarations:               Cplus expressions.
  9636. * register stack, AMD29K:               Registers.
  9637. * registers:                            Registers.
  9638. * regular expression:                   Set Breaks.
  9639. * reloading symbols:                    Symbols.
  9640. * remote connection without stubs:      Server.
  9641. * remote debugging:                     Remote.
  9642. * remote programs, interrupting:        Debug Session.
  9643. * remote serial debugging summary:      Debug Session.
  9644. * remote serial debugging, overview:    Remote Serial.
  9645. * remote serial protocol:               Protocol.
  9646. * remote serial stub:                   Stub Contents.
  9647. * remote serial stub list:              Remote Serial.
  9648. * remote serial stub, initialization:   Stub Contents.
  9649. * remote serial stub, main routine:     Stub Contents.
  9650. * remote stub, example:                 Protocol.
  9651. * remote stub, support routines:        Bootstrapping.
  9652. * repeating commands:                   Command Syntax.
  9653. * reporting bugs in GDB:                GDB Bugs.
  9654. * reset:                                Nindy Reset.
  9655. * response time, MIPS debugging:        MIPS Stack.
  9656. * resuming execution:                   Continuing and Stepping.
  9657. * RET:                                  Command Syntax.
  9658. * return:                               Returning.
  9659. * returning from a function:            Returning.
  9660. * reverse-search:                       Search.
  9661. * run:                                  Starting.
  9662. * running:                              Starting.
  9663. * running 29K programs:                 EB29K Remote.
  9664. * running VxWorks tasks:                VxWorks Attach.
  9665. * rwatch:                               Set Watchpoints.
  9666. * s:                                    Continuing and Stepping.
  9667. * saving symbol table:                  Files.
  9668. * scope:                                M2 Scope.
  9669. * search:                               Search.
  9670. * searching:                            Search.
  9671. * section:                              Files.
  9672. * select-frame:                         Frames.
  9673. * selected frame:                       Stack.
  9674. * serial connections, debugging:        Protocol.
  9675. * serial device, Hitachi micros:        Hitachi Boards.
  9676. * serial line speed, Hitachi micros:    Hitachi Boards.
  9677. * serial line, target remote:           Debug Session.
  9678. * serial protocol, GDB remote:          Protocol.
  9679. * set:                                  Help.
  9680. * set args:                             Arguments.
  9681. * set check <1>:                        Range Checking.
  9682. * set check:                            Type Checking.
  9683. * set check range:                      Range Checking.
  9684. * set check type:                       Type Checking.
  9685. * set complaints:                       Messages/Warnings.
  9686. * set confirm:                          Messages/Warnings.
  9687. * set demangle-style:                   Print Settings.
  9688. * set editing:                          Editing.
  9689. * set endian auto:                      Target Commands.
  9690. * set endian big:                       Target Commands.
  9691. * set endian little:                    Target Commands.
  9692. * set environment:                      Environment.
  9693. * set gnutarget:                        Target Commands.
  9694. * set height:                           Screen Size.
  9695. * set history expansion:                History.
  9696. * set history filename:                 History.
  9697. * set history save:                     History.
  9698. * set history size:                     History.
  9699. * set input-radix:                      Numbers.
  9700. * set language:                         Manually.
  9701. * set listsize:                         List.
  9702. * set machine:                          Hitachi Special.
  9703. * set memory MOD:                       Hitachi Special.
  9704. * set mipsfpu:                          MIPS Remote.
  9705. * set output-radix:                     Numbers.
  9706. * set print address:                    Print Settings.
  9707. * set print array:                      Print Settings.
  9708. * set print asm-demangle:               Print Settings.
  9709. * set print demangle:                   Print Settings.
  9710. * set print elements:                   Print Settings.
  9711. * set print max-symbolic-offset:        Print Settings.
  9712. * set print null-stop:                  Print Settings.
  9713. * set print object:                     Print Settings.
  9714. * set print pretty:                     Print Settings.
  9715. * set print sevenbit-strings:           Print Settings.
  9716. * set print static-members:             Print Settings.
  9717. * set print symbol-filename:            Print Settings.
  9718. * set print union:                      Print Settings.
  9719. * set print vtbl:                       Print Settings.
  9720. * set processor ARGS:                   MIPS Remote.
  9721. * set prompt:                           Prompt.
  9722. * set remotedebug <1>:                  Protocol.
  9723. * set remotedebug:                      MIPS Remote.
  9724. * set retransmit-timeout:               MIPS Remote.
  9725. * set rstack_high_address:              Registers.
  9726. * set symbol-reloading:                 Symbols.
  9727. * set timeout:                          MIPS Remote.
  9728. * set variable:                         Assignment.
  9729. * set verbose:                          Messages/Warnings.
  9730. * set width:                            Screen Size.
  9731. * set write:                            Patching.
  9732. * set_debug_traps:                      Stub Contents.
  9733. * setting variables:                    Assignment.
  9734. * setting watchpoints:                  Set Watchpoints.
  9735. * share:                                Files.
  9736. * shared libraries:                     Files.
  9737. * sharedlibrary:                        Files.
  9738. * shell:                                Shell Commands.
  9739. * shell escape:                         Shell Commands.
  9740. * show:                                 Help.
  9741. * show args:                            Arguments.
  9742. * show check range:                     Range Checking.
  9743. * show check type:                      Type Checking.
  9744. * show commands:                        History.
  9745. * show complaints:                      Messages/Warnings.
  9746. * show confirm:                         Messages/Warnings.
  9747. * show convenience:                     Convenience Vars.
  9748. * show copying:                         Help.
  9749. * show demangle-style:                  Print Settings.
  9750. * show directories:                     Source Path.
  9751. * show editing:                         Editing.
  9752. * show endian:                          Target Commands.
  9753. * show environment:                     Environment.
  9754. * show gnutarget:                       Target Commands.
  9755. * show height:                          Screen Size.
  9756. * show history:                         History.
  9757. * show input-radix:                     Numbers.
  9758. * show language:                        Show.
  9759. * show listsize:                        List.
  9760. * show machine:                         Hitachi Special.
  9761. * show mipsfpu:                         MIPS Remote.
  9762. * show output-radix:                    Numbers.
  9763. * show paths:                           Environment.
  9764. * show print address:                   Print Settings.
  9765. * show print array:                     Print Settings.
  9766. * show print asm-demangle:              Print Settings.
  9767. * show print demangle:                  Print Settings.
  9768. * show print elements:                  Print Settings.
  9769. * show print max-symbolic-offset:       Print Settings.
  9770. * show print object:                    Print Settings.
  9771. * show print pretty:                    Print Settings.
  9772. * show print sevenbit-strings:          Print Settings.
  9773. * show print static-members:            Print Settings.
  9774. * show print symbol-filename:           Print Settings.
  9775. * show print union:                     Print Settings.
  9776. * show print vtbl:                      Print Settings.
  9777. * show processor:                       MIPS Remote.
  9778. * show prompt:                          Prompt.
  9779. * show remotedebug <1>:                 Protocol.
  9780. * show remotedebug:                     MIPS Remote.
  9781. * show retransmit-timeout:              MIPS Remote.
  9782. * show rstack_high_address:             Registers.
  9783. * show symbol-reloading:                Symbols.
  9784. * show timeout:                         MIPS Remote.
  9785. * show user:                            Define.
  9786. * show values:                          Value History.
  9787. * show verbose:                         Messages/Warnings.
  9788. * show version:                         Help.
  9789. * show warranty:                        Help.
  9790. * show width:                           Screen Size.
  9791. * show write:                           Patching.
  9792. * si:                                   Continuing and Stepping.
  9793. * signal:                               Signaling.
  9794. * signals:                              Signals.
  9795. * silent:                               Break Commands.
  9796. * sim:                                  Simulator.
  9797. * simulator:                            Simulator.
  9798. * simulator, H8/300 or H8/500:          Simulator.
  9799. * simulator, Hitachi SH:                Simulator.
  9800. * simulator, Z8000:                     Simulator.
  9801. * size of screen:                       Screen Size.
  9802. * source:                               Command Files.
  9803. * source path:                          Source Path.
  9804. * sparc-stub.c:                         Remote Serial.
  9805. * speed:                                Hitachi Boards.
  9806. * st2000 CMD:                           ST2000 Remote.
  9807. * ST2000 auxiliary commands:            ST2000 Remote.
  9808. * stack frame:                          Frames.
  9809. * stack on MIPS:                        MIPS Stack.
  9810. * stacking targets:                     Active Targets.
  9811. * starting:                             Starting.
  9812. * STDBUG commands (ST2000):             ST2000 Remote.
  9813. * step:                                 Continuing and Stepping.
  9814. * stepi:                                Continuing and Stepping.
  9815. * stepping:                             Continuing and Stepping.
  9816. * stopped threads:                      Thread Stops.
  9817. * stub example, remote debugging:       Protocol.
  9818. * stupid questions:                     Messages/Warnings.
  9819. * switching threads:                    Threads.
  9820. * switching threads automatically:      Threads.
  9821. * symbol decoding style, C++:           Print Settings.
  9822. * symbol dump:                          Symbols.
  9823. * symbol names:                         Symbols.
  9824. * symbol overloading:                   Breakpoint Menus.
  9825. * symbol table:                         Files.
  9826. * symbol-file:                          Files.
  9827. * symbols, reading immediately:         Files.
  9828. * target:                               Targets.
  9829. * target amd-eb:                        Target Commands.
  9830. * target array:                         Target Commands.
  9831. * target byte order:                    Target Commands.
  9832. * target core:                          Target Commands.
  9833. * target cpu32bug:                      Target Commands.
  9834. * target e7000:                         Hitachi ICE.
  9835. * target est:                           Target Commands.
  9836. * target exec:                          Target Commands.
  9837. * target hms:                           Target Commands.
  9838. * target mips PORT:                     MIPS Remote.
  9839. * target nindy:                         Target Commands.
  9840. * target op50n:                         Target Commands.
  9841. * target remote:                        Target Commands.
  9842. * target rom68k:                        Target Commands.
  9843. * target sim <1>:                       Target Commands.
  9844. * target sim:                           Simulator.
  9845. * target sparclite:                     Target Commands.
  9846. * target st2000:                        Target Commands.
  9847. * target udi:                           Target Commands.
  9848. * target vxworks:                       Target Commands.
  9849. * target w89k:                          Target Commands.
  9850. * tbreak:                               Set Breaks.
  9851. * TCP port, target remote:              Debug Session.
  9852. * terminal:                             Input/Output.
  9853. * thbreak:                              Set Breaks.
  9854. * this:                                 Cplus expressions.
  9855. * thread THREADNO:                      Threads.
  9856. * thread apply:                         Threads.
  9857. * thread breakpoints:                   Thread Stops.
  9858. * thread identifier (GDB):              Threads.
  9859. * thread identifier (system):           Threads.
  9860. * thread number:                        Threads.
  9861. * threads and watchpoints:              Set Watchpoints.
  9862. * threads of execution:                 Threads.
  9863. * threads, automatic switching:         Threads.
  9864. * threads, continuing:                  Thread Stops.
  9865. * threads, stopped:                     Thread Stops.
  9866. * toggle-editing-mode:                  Readline vi Mode.
  9867. * tty:                                  Input/Output.
  9868. * type casting memory:                  Expressions.
  9869. * type checking:                        Checks.
  9870. * type conversions in C++:              Cplus expressions.
  9871. * u:                                    Continuing and Stepping.
  9872. * UDI:                                  UDI29K Remote.
  9873. * undisplay:                            Auto Display.
  9874. * unknown address, locating:            Output Formats.
  9875. * unset environment:                    Environment.
  9876. * until:                                Continuing and Stepping.
  9877. * up:                                   Selection.
  9878. * up-silently:                          Selection.
  9879. * user-defined command:                 Define.
  9880. * value history:                        Value History.
  9881. * variable name conflict:               Variables.
  9882. * variable values, wrong:               Variables.
  9883. * variables, setting:                   Assignment.
  9884. * version number:                       Help.
  9885. * VxWorks:                              VxWorks Remote.
  9886. * vxworks-timeout:                      VxWorks Remote.
  9887. * watch:                                Set Watchpoints.
  9888. * watchpoints:                          Breakpoints.
  9889. * watchpoints and threads:              Set Watchpoints.
  9890. * whatis:                               Symbols.
  9891. * where:                                Backtrace.
  9892. * while:                                Define.
  9893. * wild pointer, interpreting:           Print Settings.
  9894. * word completion:                      Completion.
  9895. * working directory:                    Source Path.
  9896. * working directory (of your program):  Working Directory.
  9897. * working language:                     Languages.
  9898. * writing into corefiles:               Patching.
  9899. * writing into executables:             Patching.
  9900. * wrong values:                         Variables.
  9901. * x:                                    Memory.
  9902. * Z8000 simulator:                      Simulator.
  9903.  
  9904.  
  9905. 
  9906. Tag Table:
  9907. Node: Top1012
  9908. Node: Summary2472
  9909. Node: Free Software4073
  9910. Node: Contributors4806
  9911. Node: Sample Session8899
  9912. Node: Invocation15764
  9913. Node: Invoking GDB16233
  9914. Node: File Options18104
  9915. Node: Mode Options21202
  9916. Node: Quitting GDB23372
  9917. Node: Shell Commands24233
  9918. Node: Commands24975
  9919. Node: Command Syntax25603
  9920. Node: Completion27453
  9921. Node: Help31496
  9922. Node: Running35798
  9923. Node: Compilation36908
  9924. Node: Starting38699
  9925. Node: Arguments41866
  9926. Node: Environment42865
  9927. Node: Working Directory45956
  9928. Node: Input/Output46691
  9929. Node: Attach48291
  9930. Node: Kill Process50532
  9931. Node: Process Information51497
  9932. Node: Threads52824
  9933. Node: Processes57437
  9934. Node: Stopping58664
  9935. Node: Breakpoints59794
  9936. Node: Set Breaks62050
  9937. Node: Set Watchpoints70508
  9938. Node: Exception Handling72979
  9939. Node: Delete Breaks75488
  9940. Node: Disabling77111
  9941. Node: Conditions79724
  9942. Node: Break Commands84245
  9943. Node: Breakpoint Menus87082
  9944. Node: Continuing and Stepping88753
  9945. Node: Signals96088
  9946. Node: Thread Stops99751
  9947. Node: Stack102072
  9948. Node: Frames103611
  9949. Node: Backtrace106322
  9950. Node: Selection108049
  9951. Node: Frame Info110780
  9952. Node: MIPS Stack113075
  9953. Node: Source114087
  9954. Node: List115031
  9955. Node: Search118549
  9956. Node: Source Path119347
  9957. Node: Machine Code122022
  9958. Node: Data124663
  9959. Node: Expressions126533
  9960. Node: Variables128460
  9961. Node: Arrays130992
  9962. Node: Output Formats133506
  9963. Node: Memory135573
  9964. Node: Auto Display139830
  9965. Node: Print Settings143576
  9966. Node: Value History153399
  9967. Node: Convenience Vars155801
  9968. Node: Registers158577
  9969. Node: Floating Point Hardware163275
  9970. Node: Languages163773
  9971. Node: Setting164872
  9972. Node: Filenames166457
  9973. Node: Manually167036
  9974. Node: Automatically168229
  9975. Node: Show169275
  9976. Node: Checks170172
  9977. Node: Type Checking171523
  9978. Node: Range Checking174215
  9979. Node: Support176551
  9980. Node: C177462
  9981. Node: C Operators178579
  9982. Node: C Constants182629
  9983. Node: Cplus expressions184533
  9984. Node: C Defaults187123
  9985. Node: C Checks187775
  9986. Node: Debugging C188477
  9987. Node: Debugging C plus plus188941
  9988. Node: Modula-2190948
  9989. Node: M2 Operators191831
  9990. Node: Built-In Func/Proc194822
  9991. Node: M2 Constants197556
  9992. Node: M2 Defaults199140
  9993. Node: Deviations199730
  9994. Node: M2 Checks200812
  9995. Node: M2 Scope201607
  9996. Node: GDB/M2202611
  9997. Node: Symbols203545
  9998. Node: Altering210402
  9999. Node: Assignment211365
  10000. Node: Jumping213470
  10001. Node: Signaling215469
  10002. Node: Returning216584
  10003. Node: Calling217771
  10004. Node: Patching218549
  10005. Node: GDB Files219614
  10006. Node: Files220074
  10007. Node: Symbol Errors230994
  10008. Node: Targets234568
  10009. Node: Active Targets235453
  10010. Node: Target Commands237020
  10011. Node: Remote242553
  10012. Node: Remote Serial243952
  10013. Node: Stub Contents246448
  10014. Node: Bootstrapping248544
  10015. Node: Debug Session252335
  10016. Node: Protocol255473
  10017. Node: Server258775
  10018. Node: NetWare262817
  10019. Node: i960-Nindy Remote264774
  10020. Node: Nindy Startup265589
  10021. Node: Nindy Options266269
  10022. Node: Nindy Reset267878
  10023. Node: UDI29K Remote268257
  10024. Node: EB29K Remote269157
  10025. Node: Comms (EB29K)269970
  10026. Node: gdb-EB29K273144
  10027. Node: Remote Log274505
  10028. Node: ST2000 Remote274975
  10029. Node: VxWorks Remote276432
  10030. Node: VxWorks Connection278387
  10031. Node: VxWorks Download279308
  10032. Node: VxWorks Attach281032
  10033. Node: Hitachi Remote281417
  10034. Node: Hitachi Boards282340
  10035. Node: Hitachi ICE283398
  10036. Node: Hitachi Special284181
  10037. Node: MIPS Remote284902
  10038. Node: Simulator289113
  10039. Node: Controlling GDB290594
  10040. Node: Prompt291200
  10041. Node: Editing291969
  10042. Node: History292733
  10043. Node: Screen Size295427
  10044. Node: Numbers296818
  10045. Node: Messages/Warnings298215
  10046. Node: Sequences300218
  10047. Node: Define300773
  10048. Node: Hooks303934
  10049. Node: Command Files305327
  10050. Node: Output307294
  10051. Node: Emacs309696
  10052. Node: GDB Bugs315637
  10053. Node: Bug Criteria316350
  10054. Node: Bug Reporting317099
  10055. Node: Command Line Editing324234
  10056. Node: Introduction and Notation324650
  10057. Node: Readline Interaction325662
  10058. Node: Readline Bare Essentials326785
  10059. Node: Readline Movement Commands328283
  10060. Node: Readline Killing Commands329164
  10061. Node: Readline Arguments330785
  10062. Node: Readline Init File331726
  10063. Node: Readline Init Syntax332546
  10064. Node: Commands For Moving336475
  10065. Node: Commands For History337090
  10066. Node: Commands For Text338154
  10067. Node: Commands For Killing339875
  10068. Node: Numeric Arguments341013
  10069. Node: Commands For Completion341450
  10070. Node: Miscellaneous Commands342157
  10071. Node: Readline vi Mode342904
  10072. Node: Using History Interactively343622
  10073. Node: History Interaction343982
  10074. Node: Event Designators344929
  10075. Node: Word Designators345565
  10076. Node: Modifiers346455
  10077. Node: Formatting Documentation347118
  10078. Node: Installing GDB350459
  10079. Node: Separate Objdir353933
  10080. Node: Config Names356475
  10081. Node: configure Options357898
  10082. Node: Index360217
  10083. 
  10084. End Tag Table
  10085.