home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / gdb.i06 < prev    next >
Encoding:
GNU Info File  |  1993-06-12  |  49.7 KB  |  1,252 lines

  1. This is Info file gdb.info, produced by Makeinfo-1.47 from the input
  2. file gdb-all.tex.
  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.06, October 1992, of `Debugging with GDB: the GNU
  10. Source-Level Debugger' for GDB Version 4.7.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation,
  13. 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 section entitled "GNU General Public License" is included
  22. exactly as in the original, and provided that the entire resulting
  23. derived work is distributed under the terms of a permission notice
  24. identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public License"
  29. may be included in a translation approved by the Free Software
  30. Foundation instead of in the original English.
  31.  
  32. 
  33. File: gdb.info,  Node: Hitachi H8/300 Remote,  Prev: ST2000 Remote,  Up: Remote
  34.  
  35. GDB and the Hitachi H8/300
  36. --------------------------
  37.  
  38.    GDB needs to know these things to talk to your H8/300:
  39.  
  40.   1. that you want to use `target hms', the remote debugging interface
  41.      for the H8/300 (this is the default when GDB is configured
  42.      specifically for the H8/300);
  43.  
  44.   2. what serial device connects your host to your H8/300 (the first
  45.      serial device available on your host is the default);
  46.  
  47.  
  48.    GDB depends on an auxiliary terminate-and-stay-resident program
  49. called `asynctsr' to communicate with the H8/300 development board
  50. through a PC serial port.  You must also use the DOS `mode' command to
  51. set up the serial port on the DOS side.
  52.  
  53.    The following sample session illustrates the steps needed to start a
  54. program under GDB control on your H8/300.  The example uses a sample
  55. H8/300 program called `t.x'.
  56.  
  57.    First hook up your H8/300 development board.  In this example, we
  58. use a board attached to serial port `COM2'; if you use a different
  59. serial port, substitute its name in the argument of the `mode' command.
  60. When you call `asynctsr', the auxiliary comms program used by the
  61. degugger, you give it just the numeric part of the serial port's name;
  62. for example, `asyncstr 2' below runs `asyncstr' on `COM2'.
  63.  
  64.      (eg-C:\H8300\TEST) mode com2:9600,n,8,1,p
  65.      
  66.      Resident portion of MODE loaded
  67.      
  68.      COM2: 9600, n, 8, 1, p
  69.      
  70.      (eg-C:\H8300\TEST) asynctsr 2
  71.  
  72.      *Warning:* We have noticed a bug in PC-NFS that conflicts with
  73.      `asynctsr'.  If you also run PC-NFS on your DOS host, you may need
  74.      to disable it, or even boot without it, to use `asynctsr' to
  75.      control your H8/300 board.
  76.  
  77.    Now that serial communications are set up, and the H8/300 is
  78. connected, you can start up GDB.  Call `gdb' with the name of your
  79. program as the argument.  `gdb' prompts you, as usual, with the prompt
  80. `(gdb)'.  Use two special commands to begin your debugging session:
  81. `target hms' to specify cross-debugging to the Hitachi board, and the
  82. `load' command to download your program to the board. `load' displays
  83. the names of the program's sections, and a `*' for each 2K of data
  84. downloaded.  (If you want to refresh GDB data on symbols or on the
  85. executable file without downloading, use the GDB commands `file' or
  86. `symbol-file'.  These commands, and `load' itself, are described in
  87. *Note Commands to Specify Files: Files.)
  88.  
  89.      (eg-C:\H8300\TEST) gdb t.x
  90.      GDB is free software and you are welcome to distribute copies
  91.       of it under certain conditions; type "show copying" to see
  92.       the conditions.
  93.      There is absolutely no warranty for GDB; type "show warranty"
  94.      for details.
  95.      GDB 4.7, Copyright 1992 Free Software Foundation, Inc...
  96.      (gdb) target hms
  97.      Connected to remote H8/300 HMS system.
  98.      (gdb) load t.x
  99.      .text   : 0x8000 .. 0xabde ***********
  100.      .data   : 0xabde .. 0xad30 *
  101.      .stack  : 0xf000 .. 0xf014 *
  102.  
  103.    At this point, you're ready to run or debug your program.  From here
  104. on, you can use all the usual GDB commands.  The `break' command sets
  105. breakpoints; the `run' command starts your program; `print' or `x'
  106. display data; the `continue' command resumes execution after stopping
  107. at a breakpoint.  You can use the `help' command at any time to find
  108. out more about GDB commands.
  109.  
  110.    Remember, however, that *operating system* facilities aren't
  111. available on your H8/300; for example, if your program hangs, you can't
  112. send an interrupt--but you can press the RESET switch!
  113.  
  114.    Use the RESET button on the H8/300 board
  115.    * to interrupt your program (don't use `ctl-C' on the DOS host--it
  116.      has no way to pass an interrupt signal to the H8/300); and
  117.  
  118.    * to return to the GDB command prompt after your program finishes
  119.      normally.  The communications protocol provides no other way for
  120.      GDB to detect program completion.
  121.  
  122.    In either case, GDB will see the effect of a RESET on the H8/300
  123. board as a "normal exit" of your program.
  124.  
  125. 
  126. File: gdb.info,  Node: Controlling GDB,  Next: Sequences,  Prev: Targets,  Up: Top
  127.  
  128. Controlling GDB
  129. ***************
  130.  
  131.    You can alter many aspects of GDB's interaction with you by using
  132. the `set' command.  For commands controlling how GDB displays data,
  133. *note Print Settings: Print Settings.; other settings are described
  134. here.
  135.  
  136. * Menu:
  137.  
  138. * Prompt::                      Prompt
  139. * Editing::                     Command Editing
  140. * History::                     Command History
  141. * Screen Size::                 Screen Size
  142. * Numbers::                     Numbers
  143. * Messages/Warnings::           Optional Warnings and Messages
  144.  
  145. 
  146. File: gdb.info,  Node: Prompt,  Next: Editing,  Up: Controlling GDB
  147.  
  148. Prompt
  149. ======
  150.  
  151.    GDB indicates its readiness to read a command by printing a string
  152. called the "prompt".  This string is normally `(gdb)'.  You can change
  153. the prompt string with the `set prompt' command.  For instance, when
  154. debugging GDB with GDB, it is useful to change the prompt in one of the
  155. GDBs so that you can always tell which one you are talking to.
  156.  
  157. `set prompt NEWPROMPT'
  158.      Directs GDB to use NEWPROMPT as its prompt string henceforth.
  159.  
  160. `show prompt'
  161.      Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
  162.  
  163. 
  164. File: gdb.info,  Node: Editing,  Next: History,  Prev: Prompt,  Up: Controlling GDB
  165.  
  166. Command Editing
  167. ===============
  168.  
  169.    GDB reads its input commands via the "readline" interface.  This GNU
  170. library provides consistent behavior for programs which provide a
  171. command line interface to the user.  Advantages are `emacs'-style or
  172. `vi'-style inline editing of commands, `csh'-like history substitution,
  173. and a storage and recall of command history across debugging sessions.
  174.  
  175.    You may control the behavior of command line editing in GDB with the
  176. command `set'.
  177.  
  178. `set editing'
  179. `set editing on'
  180.      Enable command line editing (enabled by default).
  181.  
  182. `set editing off'
  183.      Disable command line editing.
  184.  
  185. `show editing'
  186.      Show whether command line editing is enabled.
  187.  
  188. 
  189. File: gdb.info,  Node: History,  Next: Screen Size,  Prev: Editing,  Up: Controlling GDB
  190.  
  191. Command History
  192. ===============
  193.  
  194. `set history filename FNAME'
  195.      Set the name of the GDB command history file to FNAME.  This is
  196.      the file from which GDB will read an initial command history list
  197.      or to which it will write this list when it exits.  This list is
  198.      accessed through history expansion or through the history command
  199.      editing characters listed below.  This file defaults to the value
  200.      of the environment variable `GDBHISTFILE', or to `./.gdb_history'
  201.      if this variable is not set.
  202.  
  203. `set history save'
  204. `set history save on'
  205.      Record command history in a file, whose name may be specified with
  206.      the `set history filename' command.  By default, this option is
  207.      disabled.
  208.  
  209. `set history save off'
  210.      Stop recording command history in a file.
  211.  
  212. `set history size SIZE'
  213.      Set the number of commands which GDB will keep in its history list.
  214.      This defaults to the value of the environment variable `HISTSIZE',
  215.      or to 256 if this variable is not set.
  216.  
  217.    History expansion assigns special meaning to the character `!'.
  218. Since `!' is also the logical not operator in C, history expansion is
  219. off by default. If you decide to enable history expansion with the `set
  220. history expansion on' command, you may sometimes need to follow `!'
  221. (when it is used as logical not, in an expression) with a space or a
  222. tab to prevent it from being expanded.  The readline history facilities
  223. will not attempt substitution on the strings `!=' and `!(', even when
  224. history expansion is enabled.
  225.  
  226.    The commands to control history expansion are:
  227.  
  228. `set history expansion on'
  229. `set history expansion'
  230.      Enable history expansion.  History expansion is off by default.
  231.  
  232. `set history expansion off'
  233.      Disable history expansion.
  234.  
  235.      The readline code comes with more complete documentation of
  236.      editing and history expansion features.  Users unfamiliar with
  237.      `emacs' or `vi' may wish to read it.
  238.  
  239. `show history'
  240. `show history filename'
  241. `show history save'
  242. `show history size'
  243. `show history expansion'
  244.      These commands display the state of the GDB history parameters.
  245.      `show history' by itself displays all four states.
  246.  
  247. `show commands'
  248.      Display the last ten commands in the command history.
  249.  
  250. `show commands N'
  251.      Print ten commands centered on command number N.
  252.  
  253. `show commands +'
  254.      Print ten commands just after the commands last printed.
  255.  
  256. 
  257. File: gdb.info,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
  258.  
  259. Screen Size
  260. ===========
  261.  
  262.    Certain commands to GDB may produce large amounts of information
  263. output to the screen.  To help you read all of it, GDB pauses and asks
  264. you for input at the end of each page of output.  Type RET when you
  265. want to continue the output.  GDB also uses the screen width setting to
  266. determine when to wrap lines of output.  Depending on what is being
  267. printed, it tries to break the line at a readable place, rather than
  268. simply letting it overflow onto the following line.
  269.  
  270.    Normally GDB knows the size of the screen from the termcap data base
  271. together with the value of the `TERM' environment variable and the
  272. `stty rows' and `stty cols' settings. If this is not correct, you can
  273. override it with the `set height' and `set width' commands:
  274.  
  275. `set height LPP'
  276. `show height'
  277. `set width CPL'
  278. `show width'
  279.      These `set' commands specify a screen height of LPP lines and a
  280.      screen width of CPL characters.  The associated `show' commands
  281.      display the current settings.
  282.  
  283.      If you specify a height of zero lines, GDB will not pause during
  284.      output no matter how long the output is.  This is useful if output
  285.      is to a file or to an editor buffer.
  286.  
  287. 
  288. File: gdb.info,  Node: Numbers,  Next: Messages/Warnings,  Prev: Screen Size,  Up: Controlling GDB
  289.  
  290. Numbers
  291. =======
  292.  
  293.    You can always enter numbers in octal, decimal, or hexadecimal in
  294. GDB by the usual conventions: octal numbers begin with `0', decimal
  295. numbers end with `.', and hexadecimal numbers begin with `0x'. Numbers
  296. that begin with none of these are, by default, entered in base 10;
  297. likewise, the default display for numbers--when no particular format is
  298. specified--is base 10.  You can change the default base for both input
  299. and output with the `set radix' command.
  300.  
  301. `set radix BASE'
  302.      Set the default base for numeric input and display.  Supported
  303.      choices for BASE are decimal 2, 8, 10, 16.  BASE must itself be
  304.      specified either unambiguously or using the current default radix;
  305.      for example, any of
  306.  
  307.           set radix 1010
  308.           set radix 012
  309.           set radix 10.
  310.           set radix 0xa
  311.  
  312.      will set the base to decimal.  On the other hand, `set radix 10'
  313.      will leave the radix unchanged no matter what it was.
  314.  
  315. `show radix'
  316.      Display the current default base for numeric input and display.
  317.  
  318. 
  319. File: gdb.info,  Node: Messages/Warnings,  Prev: Numbers,  Up: Controlling GDB
  320.  
  321. Optional Warnings and Messages
  322. ==============================
  323.  
  324.    By default, GDB is silent about its inner workings.  If you are
  325. running on a slow machine, you may want to use the `set verbose'
  326. command. It will make GDB tell you when it does a lengthy internal
  327. operation, so you will not think it has crashed.
  328.  
  329.    Currently, the messages controlled by `set verbose' are those which
  330. announce that the symbol table for a source file is being read; see
  331. `symbol-file' in *Note Commands to Specify Files: Files.
  332.  
  333. `set verbose on'
  334.      Enables GDB's output of certain informational messages.
  335.  
  336. `set verbose off'
  337.      Disables GDB's output of certain informational messages.
  338.  
  339. `show verbose'
  340.      Displays whether `set verbose' is on or off.
  341.  
  342.    By default, if GDB encounters bugs in the symbol table of an object
  343. file, it is silent; but if you are debugging a compiler, you may find
  344. this information useful (*note Errors Reading Symbol Files: Symbol
  345. Errors.).
  346.  
  347. `set complaints LIMIT'
  348.      Permits GDB to output LIMIT complaints about each type of unusual
  349.      symbols before becoming silent about the problem.  Set LIMIT to
  350.      zero to suppress all complaints; set it to a large number to
  351.      prevent complaints from being suppressed.
  352.  
  353. `show complaints'
  354.      Displays how many symbol complaints GDB is permitted to produce.
  355.  
  356.    By default, GDB is cautious, and asks what sometimes seems to be a
  357. lot of stupid questions to confirm certain commands.  For example, if
  358. you try to run a program which is already running:
  359.  
  360.      (gdb) run
  361.      The program being debugged has been started already.
  362.      Start it from the beginning? (y or n)
  363.  
  364.    If you are willing to unflinchingly face the consequences of your own
  365. commands, you can disable this "feature":
  366.  
  367. `set confirm off'
  368.      Disables confirmation requests.
  369.  
  370. `set confirm on'
  371.      Enables confirmation requests (the default).
  372.  
  373. `show confirm'
  374.      Displays state of confirmation requests.
  375.  
  376.    Some systems allow individual object files that make up your program
  377. to be replaced without stopping and restarting your program. For
  378. example, in VxWorks you can simply recompile a defective object file
  379. and keep on running. If you are running on one of these systems, you
  380. can allow GDB to reload the symbols for automatically relinked modules:
  381.  
  382. `set symbol-reloading on'
  383.      Replace symbol definitions for the corresponding source file when
  384.      an object file with a particular name is seen again.
  385.  
  386. `set symbol-reloading off'
  387.      Do not replace symbol definitions when re-encountering object
  388.      files of the same name.  This is the default state; if you are not
  389.      running on a system that permits automatically relinking modules,
  390.      you should leave `symbol-reloading' off, since otherwise GDB may
  391.      discard symbols when linking large programs, that may contain
  392.      several modules (from different directories or libraries) with the
  393.      same name.
  394.  
  395. `show symbol-reloading'
  396.      Show the current `on' or `off' setting.
  397.  
  398. 
  399. File: gdb.info,  Node: Sequences,  Next: Emacs,  Prev: Controlling GDB,  Up: Top
  400.  
  401. Canned Sequences of Commands
  402. ****************************
  403.  
  404.    Aside from breakpoint commands (*note Breakpoint Command Lists:
  405. Break Commands.), GDB provides two ways to store sequences of commands
  406. for execution as a unit: user-defined commands and command files.
  407.  
  408. * Menu:
  409.  
  410. * Define::                      User-Defined Commands
  411. * Hooks::            User-Defined Command Hooks
  412. * Command Files::               Command Files
  413. * Output::                      Commands for Controlled Output
  414.  
  415. 
  416. File: gdb.info,  Node: Define,  Next: Hooks,  Up: Sequences
  417.  
  418. User-Defined Commands
  419. =====================
  420.  
  421.    A "user-defined command" is a sequence of GDB commands to which you
  422. assign a new name as a command.  This is done with the `define' command.
  423.  
  424. `define COMMANDNAME'
  425.      Define a command named COMMANDNAME.  If there is already a command
  426.      by that name, you are asked to confirm that you want to redefine
  427.      it.
  428.  
  429.      The definition of the command is made up of other GDB command
  430.      lines, which are given following the `define' command.  The end of
  431.      these commands is marked by a line containing `end'.
  432.  
  433. `document COMMANDNAME'
  434.      Give documentation to the user-defined command COMMANDNAME.  The
  435.      command COMMANDNAME must already be defined.  This command reads
  436.      lines of documentation just as `define' reads the lines of the
  437.      command definition, ending with `end'.  After the `document'
  438.      command is finished, `help' on command COMMANDNAME will print the
  439.      documentation you have specified.
  440.  
  441.      You may use the `document' command again to change the
  442.      documentation of a command.  Redefining the command with `define'
  443.      does not change the documentation.
  444.  
  445. `help user-defined'
  446.      List all user-defined commands, with the first line of the
  447.      documentation (if any) for each.
  448.  
  449. `show user'
  450. `show user COMMANDNAME'
  451.      Display the GDB commands used to define COMMANDNAME (but not its
  452.      documentation).  If no COMMANDNAME is given, display the
  453.      definitions for all user-defined commands.
  454.  
  455.    User-defined commands do not take arguments.  When they are
  456. executed, the commands of the definition are not printed.  An error in
  457. any command stops execution of the user-defined command.
  458.  
  459.    Commands that would ask for confirmation if used interactively
  460. proceed without asking when used inside a user-defined command.  Many
  461. GDB commands that normally print messages to say what they are doing
  462. omit the messages when used in a user-defined command.
  463.  
  464. 
  465. File: gdb.info,  Node: Hooks,  Next: Command Files,  Prev: Define,  Up: Sequences
  466.  
  467. User-Defined Command Hooks
  468. ==========================
  469.  
  470.    You may define *hooks*, which are a special kind of user-defined
  471. command.  Whenever you run the command `foo', if the user-defined
  472. command `hook-foo' exists, it is executed (with no arguments) before
  473. that command.
  474.  
  475.    In addition, a pseudo-command, `stop' exists.  Hooking this command
  476. will cause your hook to be executed every time execution stops in the
  477. inferior program, before breakpoint commands are run, displays are
  478. printed, or the stack frame is printed.
  479.  
  480.    For example, to cause `SIGALRM' signals to be ignored while
  481. single-stepping, but cause them to be resumed during normal execution,
  482. you could do:
  483.  
  484.      define hook-stop
  485.      handle SIGALRM nopass
  486.      end
  487.      
  488.      define hook-run
  489.      handle SIGALRM pass
  490.      end
  491.      
  492.      define hook-continue
  493.      handle SIGLARM pass
  494.      end
  495.  
  496.    Any single-word command in GDB can be hooked.  Aliases for other
  497. commands cannot be hooked (you should hook the basic command name, e.g.
  498. `backtrace' rather than `bt').  If an error occurs during the execution
  499. of your hook, execution of GDB commands stops and you are returned to
  500. the GDB prompt (before the command that you actually typed had a chance
  501. to run).
  502.  
  503.    If you try to define a hook which doesn't match any known command,
  504. you will get a warning from the `define' command.
  505.  
  506. 
  507. File: gdb.info,  Node: Command Files,  Next: Output,  Prev: Hooks,  Up: Sequences
  508.  
  509. Command Files
  510. =============
  511.  
  512.    A command file for GDB is a file of lines that are GDB commands. 
  513. Comments (lines starting with `#') may also be included.  An empty line
  514. in a command file does nothing; it does not mean to repeat the last
  515. command, as it would from the terminal.
  516.  
  517.    When you start GDB, it automatically executes commands from its
  518. "init files".  These are files named `.gdbinit'.  GDB reads the init
  519. file (if any) in your home directory and then the init file (if any) in
  520. the current working directory.  (The init files are not executed if you
  521. use the `-nx' option; *note Choosing Modes: Mode Options..)  You can
  522. also request the execution of a command file with the `source' command:
  523.  
  524. `source FILENAME'
  525.      Execute the command file FILENAME.
  526.  
  527.    The lines in a command file are executed sequentially.  They are not
  528. printed as they are executed.  An error in any command terminates
  529. execution of the command file.
  530.  
  531.    Commands that would ask for confirmation if used interactively
  532. proceed without asking when used in a command file.  Many GDB commands
  533. that normally print messages to say what they are doing omit the
  534. messages when called from command files.
  535.  
  536. 
  537. File: gdb.info,  Node: Output,  Prev: Command Files,  Up: Sequences
  538.  
  539. Commands for Controlled Output
  540. ==============================
  541.  
  542.    During the execution of a command file or a user-defined command,
  543. normal GDB output is suppressed; the only output that appears is what is
  544. explicitly printed by the commands in the definition.  This section
  545. describes three commands useful for generating exactly the output you
  546. want.
  547.  
  548. `echo TEXT'
  549.      Print TEXT.  Nonprinting characters can be included in TEXT using
  550.      C escape sequences, such as `\n' to print a newline.  *No newline
  551.      will be printed unless you specify one.* In addition to the
  552.      standard C escape sequences, a backslash followed by a space
  553.      stands for a space.  This is useful for outputting a string with
  554.      spaces at the beginning or the end, since leading and trailing
  555.      spaces are otherwise trimmed from all arguments. To print ` and
  556.      foo = ', use the command `echo \ and foo = \ '.
  557.  
  558.      A backslash at the end of TEXT can be used, as in C, to continue
  559.      the command onto subsequent lines.  For example,
  560.  
  561.           echo This is some text\n\
  562.           which is continued\n\
  563.           onto several lines.\n
  564.  
  565.      produces the same output as
  566.  
  567.           echo This is some text\n
  568.           echo which is continued\n
  569.           echo onto several lines.\n
  570.  
  571. `output EXPRESSION'
  572.      Print the value of EXPRESSION and nothing but that value: no
  573.      newlines, no `$NN = '.  The value is not entered in the value
  574.      history either.  *Note Expressions: Expressions, for more
  575.      information on expressions.
  576.  
  577. `output/FMT EXPRESSION'
  578.      Print the value of EXPRESSION in format FMT.  You can use the same
  579.      formats as for `print'; *note Output formats::., for more
  580.      information.
  581.  
  582. `printf STRING, EXPRESSIONS...'
  583.      Print the values of the EXPRESSIONS under the control of STRING. 
  584.      The EXPRESSIONS are separated by commas and may be either numbers
  585.      or pointers.  Their values are printed as specified by STRING,
  586.      exactly as if your program were to execute
  587.  
  588.           printf (STRING, EXPRESSIONS...);
  589.  
  590.      For example, you can print two values in hex like this:
  591.  
  592.           printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  593.  
  594.      The only backslash-escape sequences that you can use in the format
  595.      string are the simple ones that consist of backslash followed by a
  596.      letter.
  597.  
  598. 
  599. File: gdb.info,  Node: Emacs,  Next: GDB Bugs,  Prev: Sequences,  Up: Top
  600.  
  601. Using GDB under GNU Emacs
  602. *************************
  603.  
  604.    A special interface allows you to use GNU Emacs to view (and edit)
  605. the source files for the program you are debugging with GDB.
  606.  
  607.    To use this interface, use the command `M-x gdb' in Emacs.  Give the
  608. executable file you want to debug as an argument.  This command starts
  609. GDB as a subprocess of Emacs, with input and output through a newly
  610. created Emacs buffer.
  611.  
  612.    Using GDB under Emacs is just like using GDB normally except for two
  613. things:
  614.  
  615.    * All "terminal" input and output goes through the Emacs buffer.
  616.  
  617.    This applies both to GDB commands and their output, and to the input
  618. and output done by the program you are debugging.
  619.  
  620.    This is useful because it means that you can copy the text of
  621. previous commands and input them again; you can even use parts of the
  622. output in this way.
  623.  
  624.    All the facilities of Emacs' Shell mode are available for interacting
  625. with your program.  In particular, you can send signals the usual
  626. way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
  627.  
  628.    * GDB displays source code through Emacs.
  629.  
  630.    Each time GDB displays a stack frame, Emacs automatically finds the
  631. source file for that frame and puts an arrow (`=>') at the left margin
  632. of the current line.  Emacs uses a separate buffer for source display,
  633. and splits the window to show both your GDB session and the source.
  634.  
  635.    Explicit GDB `list' or search commands still produce output as
  636. usual, but you probably will have no reason to use them.
  637.  
  638.      *Warning:* If the directory where your program resides is not your
  639.      current directory, it can be easy to confuse Emacs about the
  640.      location of the source files, in which case the auxiliary display
  641.      buffer will not appear to show your source.  GDB can find programs
  642.      by searching your environment's `PATH' variable, so the GDB input
  643.      and output session will proceed normally; but Emacs does not get
  644.      enough information back from GDB to locate the source files in
  645.      this situation.  To avoid this problem, either start GDB mode from
  646.      the directory where your program resides, or specify a full path
  647.      name when prompted for the `M-x gdb' argument.
  648.  
  649.      A similar confusion can result if you use the GDB `file' command to
  650.      switch to debugging a program in some other location, from an
  651.      existing GDB buffer in Emacs.
  652.  
  653.    By default, `M-x gdb' calls the program called `gdb'.  If you need
  654. to call GDB by a different name (for example, if you keep several
  655. configurations around, with different names) you can set the Emacs
  656. variable `gdb-command-name'; for example,
  657.  
  658.      (setq gdb-command-name "mygdb")
  659.  
  660. (preceded by `ESC ESC', or typed in the `*scratch*' buffer, or in your
  661. `.emacs' file) will make Emacs call the program named "`mygdb'" instead.
  662.  
  663.    In the GDB I/O buffer, you can use these special Emacs commands in
  664. addition to the standard Shell mode commands:
  665.  
  666. `C-h m'
  667.      Describe the features of Emacs' GDB Mode.
  668.  
  669. `M-s'
  670.      Execute to another source line, like the GDB `step' command; also
  671.      update the display window to show the current file and location.
  672.  
  673. `M-n'
  674.      Execute to next source line in this function, skipping all function
  675.      calls, like the GDB `next' command.  Then update the display window
  676.      to show the current file and location.
  677.  
  678. `M-i'
  679.      Execute one instruction, like the GDB `stepi' command; update
  680.      display window accordingly.
  681.  
  682. `M-x gdb-nexti'
  683.      Execute to next instruction, using the GDB `nexti' command; update
  684.      display window accordingly.
  685.  
  686. `C-c C-f'
  687.      Execute until exit from the selected stack frame, like the GDB
  688.      `finish' command.
  689.  
  690. `M-c'
  691.      Continue execution of your program, like the GDB `continue'
  692.      command.
  693.  
  694.      *Warning:* In Emacs v19, this command is `C-c C-p'.
  695.  
  696. `M-u'
  697.      Go up the number of frames indicated by the numeric argument
  698.      (*note Numeric Arguments: (emacs)Arguments.), like the GDB `up'
  699.      command.
  700.  
  701.      *Warning:* In Emacs v19, this command is `C-c C-u'.
  702.  
  703. `M-d'
  704.      Go down the number of frames indicated by the numeric argument,
  705.      like the GDB `down' command.
  706.  
  707.      *Warning:* In Emacs v19, this command is `C-c C-d'.
  708.  
  709. `C-x &'
  710.      Read the number where the cursor is positioned, and insert it at
  711.      the end of the GDB I/O buffer.  For example, if you wish to
  712.      disassemble code around an address that was displayed earlier,
  713.      type `disassemble'; then move the cursor to the address display,
  714.      and pick up the argument for `disassemble' by typing `C-x &'.
  715.  
  716.      You can customize this further on the fly by defining elements of
  717.      the list `gdb-print-command'; once it is defined, you can format or
  718.      otherwise process numbers picked up by `C-x &' before they are
  719.      inserted.  A numeric argument to `C-x &' will both indicate that
  720.      you wish special formatting, and act as an index to pick an
  721.      element of the list.  If the list element is a string, the number
  722.      to be inserted is formatted using the Emacs function `format';
  723.      otherwise the number is passed as an argument to the corresponding
  724.      list element.
  725.  
  726.    In any source file, the Emacs command `C-x SPC' (`gdb-break') tells
  727. GDB to set a breakpoint on the source line point is on.
  728.  
  729.    If you accidentally delete the source-display buffer, an easy way to
  730. get it back is to type the command `f' in the GDB buffer, to request a
  731. frame display; when you run under Emacs, this will recreate the source
  732. buffer if necessary to show you the context of the current frame.
  733.  
  734.    The source files displayed in Emacs are in ordinary Emacs buffers
  735. which are visiting the source files in the usual way.  You can edit the
  736. files with these buffers if you wish; but keep in mind that GDB
  737. communicates with Emacs in terms of line numbers.  If you add or delete
  738. lines from the text, the line numbers that GDB knows will cease to
  739. correspond properly to the code.
  740.  
  741. 
  742. File: gdb.info,  Node: GDB Bugs,  Next: Renamed Commands,  Prev: Emacs,  Up: Top
  743.  
  744. Reporting Bugs in GDB
  745. *********************
  746.  
  747.    Your bug reports play an essential role in making GDB reliable.
  748.  
  749.    Reporting a bug may help you by bringing a solution to your problem,
  750. or it may not.  But in any case the principal function of a bug report
  751. is to help the entire community by making the next version of GDB work
  752. better.  Bug reports are your contribution to the maintenance of GDB.
  753.  
  754.    In order for a bug report to serve its purpose, you must include the
  755. information that enables us to fix the bug.
  756.  
  757. * Menu:
  758.  
  759. * Bug Criteria::                Have You Found a Bug?
  760. * Bug Reporting::               How to Report Bugs
  761.  
  762. 
  763. File: gdb.info,  Node: Bug Criteria,  Next: Bug Reporting,  Up: GDB Bugs
  764.  
  765. Have You Found a Bug?
  766. =====================
  767.  
  768.    If you are not sure whether you have found a bug, here are some
  769. guidelines:
  770.  
  771.    * If the debugger gets a fatal signal, for any input whatever, that
  772.      is a GDB bug.  Reliable debuggers never crash.
  773.  
  774.    * If GDB produces an error message for valid input, that is a bug.
  775.  
  776.    * If GDB does not produce an error message for invalid input, that
  777.      is a bug.  However, you should note that your idea of "invalid
  778.      input" might be our idea of "an extension" or "support for
  779.      traditional practice".
  780.  
  781.    * If you are an experienced user of debugging tools, your suggestions
  782.      for improvement of GDB are welcome in any case.
  783.  
  784. 
  785. File: gdb.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: GDB Bugs
  786.  
  787. How to Report Bugs
  788. ==================
  789.  
  790.    A number of companies and individuals offer support for GNU products.
  791. If you obtained GDB from a support organization, we recommend you
  792. contact that organization first.
  793.  
  794.    Contact information for many support companies and individuals is
  795. available in the file `etc/SERVICE' in the GNU Emacs distribution.
  796.  
  797.    In any event, we also recommend that you send bug reports for GDB to
  798. one of these addresses:
  799.  
  800.      bug-gdb@prep.ai.mit.edu
  801.      {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-gdb
  802.  
  803.    *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
  804. newsgroups.* Most users of GDB do not want to receive bug reports. 
  805. Those that do, have arranged to receive `bug-gdb'.
  806.  
  807.    The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
  808. serves as a repeater.  The mailing list and the newsgroup carry exactly
  809. the same messages.  Often people think of posting bug reports to the
  810. newsgroup instead of mailing them.  This appears to work, but it has one
  811. problem which can be crucial: a newsgroup posting often lacks a mail
  812. path back to the sender.  Thus, if we need to ask for more information,
  813. we may be unable to reach you.  For this reason, it is better to send
  814. bug reports to the mailing list.
  815.  
  816.    As a last resort, send bug reports on paper to:
  817.  
  818.      GNU Debugger Bugs
  819.      Free Software Foundation
  820.      545 Tech Square
  821.      Cambridge, MA 02139
  822.  
  823.    The fundamental principle of reporting bugs usefully is this:
  824. *report all the facts*.  If you are not sure whether to state a fact or
  825. leave it out, state it!
  826.  
  827.    Often people omit facts because they think they know what causes the
  828. problem and assume that some details do not matter.  Thus, you might
  829. assume that the name of the variable you use in an example does not
  830. matter. Well, probably it does not, but one cannot be sure.  Perhaps
  831. the bug is a stray memory reference which happens to fetch from the
  832. location where that name is stored in memory; perhaps, if the name were
  833. different, the contents of that location would fool the debugger into
  834. doing the right thing despite the bug.  Play it safe and give a
  835. specific, complete example.  That is the easiest thing for you to do,
  836. and the most helpful.
  837.  
  838.    Keep in mind that the purpose of a bug report is to enable us to fix
  839. the bug if it is new to us.  It is not as important as what happens if
  840. the bug is already known.  Therefore, always write your bug reports on
  841. the assumption that the bug has not been reported previously.
  842.  
  843.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  844. bell?"  Those bug reports are useless, and we urge everyone to *refuse
  845. to respond to them* except to chide the sender to report bugs properly.
  846.  
  847.    To enable us to fix the bug, you should include all these things:
  848.  
  849.    * The version of GDB.  GDB announces it if you start with no
  850.      arguments; you can also print it at any time using `show version'.
  851.  
  852.      Without this, we will not know whether there is any point in
  853.      looking for the bug in the current version of GDB.
  854.  
  855.    * The type of machine you are using, and the operating system name
  856.      and version number.
  857.  
  858.    * What compiler (and its version) was used to compile GDB--e.g.
  859.      "gcc-2.0".
  860.  
  861.    * What compiler (and its version) was used to compile the program you
  862.      are debugging--e.g.  "gcc-2.0".
  863.  
  864.    * The command arguments you gave the compiler to compile your
  865.      example and observe the bug.  For example, did you use `-O'?  To
  866.      guarantee you will not omit something important, list them all.  A
  867.      copy of the Makefile (or the output from make) is sufficient.
  868.  
  869.      If we were to try to guess the arguments, we would probably guess
  870.      wrong and then we might not encounter the bug.
  871.  
  872.    * A complete input script, and all necessary source files, that will
  873.      reproduce the bug.
  874.  
  875.    * A description of what behavior you observe that you believe is
  876.      incorrect.  For example, "It gets a fatal signal."
  877.  
  878.      Of course, if the bug is that GDB gets a fatal signal, then we will
  879.      certainly notice it.  But if the bug is incorrect output, we might
  880.      not notice unless it is glaringly wrong.  We are human, after all.
  881.       You might as well not give us a chance to make a mistake.
  882.  
  883.      Even if the problem you experience is a fatal signal, you should
  884.      still say so explicitly.  Suppose something strange is going on,
  885.      such as, your copy of GDB is out of synch, or you have encountered
  886.      a bug in the C library on your system.  (This has happened!)  Your
  887.      copy might crash and ours would not.  If you told us to expect a
  888.      crash, then when ours fails to crash, we would know that the bug
  889.      was not happening for us.  If you had not told us to expect a
  890.      crash, then we would not be able to draw any conclusion from our
  891.      observations.
  892.  
  893.    * If you wish to suggest changes to the GDB source, send us context
  894.      diffs.  If you even discuss something in the GDB source, refer to
  895.      it by context, not by line number.
  896.  
  897.      The line numbers in our development sources will not match those
  898.      in your sources.  Your line numbers would convey no useful
  899.      information to us.
  900.  
  901.    Here are some things that are not necessary:
  902.  
  903.    * A description of the envelope of the bug.
  904.  
  905.      Often people who encounter a bug spend a lot of time investigating
  906.      which changes to the input file will make the bug go away and which
  907.      changes will not affect it.
  908.  
  909.      This is often time consuming and not very useful, because the way
  910.      we will find the bug is by running a single example under the
  911.      debugger with breakpoints, not by pure deduction from a series of
  912.      examples. We recommend that you save your time for something else.
  913.  
  914.      Of course, if you can find a simpler example to report *instead*
  915.      of the original one, that is a convenience for us.  Errors in the
  916.      output will be easier to spot, running under the debugger will take
  917.      less time, etc.
  918.  
  919.      However, simplification is not vital; if you do not want to do
  920.      this, report the bug anyway and send us the entire test case you
  921.      used.
  922.  
  923.    * A patch for the bug.
  924.  
  925.      A patch for the bug does help us if it is a good one.  But do not
  926.      omit the necessary information, such as the test case, on the
  927.      assumption that a patch is all we need.  We might see problems
  928.      with your patch and decide to fix the problem another way, or we
  929.      might not understand it at all.
  930.  
  931.      Sometimes with a program as complicated as GDB it is very hard to
  932.      construct an example that will make the program follow a certain
  933.      path through the code.  If you do not send us the example, we will
  934.      not be able to construct one, so we will not be able to verify
  935.      that the bug is fixed.
  936.  
  937.      And if we cannot understand what bug you are trying to fix, or why
  938.      your patch should be an improvement, we will not install it.  A
  939.      test case will help us to understand.
  940.  
  941.    * A guess about what the bug is or what it depends on.
  942.  
  943.      Such guesses are usually wrong.  Even we cannot guess right about
  944.      such things without first using the debugger to find the facts.
  945.  
  946. 
  947. File: gdb.info,  Node: Renamed Commands,  Next: Formatting Documentation,  Prev: GDB Bugs,  Up: Top
  948.  
  949. Renamed Commands
  950. ****************
  951.  
  952.    The following commands were renamed in GDB 4, in order to make the
  953. command set as a whole more consistent and easier to use and remember:
  954.  
  955.      OLD COMMAND               NEW COMMAND
  956.      ---------------           -------------------------------
  957.      add-syms                  add-symbol-file
  958.      delete environment        unset environment
  959.      info convenience          show convenience
  960.      info copying              show copying
  961.      info directories          show directories
  962.      info editing              show commands
  963.      info history              show values
  964.      info targets              help target
  965.      info values               show values
  966.      info version              show version
  967.      info warranty             show warranty
  968.      set/show addressprint     set/show print address
  969.      set/show array-max        set/show print elements
  970.      set/show arrayprint       set/show print array
  971.      set/show asm-demangle     set/show print asm-demangle
  972.      set/show caution          set/show confirm
  973.      set/show demangle         set/show print demangle
  974.      set/show history write    set/show history save
  975.      set/show prettyprint      set/show print pretty
  976.      set/show screen-height    set/show height
  977.      set/show screen-width     set/show width
  978.      set/show sevenbit-strings set/show print sevenbit-strings
  979.      set/show unionprint       set/show print union
  980.      set/show vtblprint        set/show print vtbl
  981.      
  982.      unset                     [No longer an alias for delete]
  983.  
  984. 
  985. File: gdb.info,  Node: Formatting Documentation,  Next: Installing GDB,  Prev: Renamed Commands,  Up: Top
  986.  
  987. Formatting the Documentation
  988. ****************************
  989.  
  990.    The GDB 4 release includes an already-formatted reference card, ready
  991. for printing with PostScript or GhostScript, in the `gdb' subdirectory
  992. of the main source directory--in `gdb-4.7/gdb/refcard.ps' of the
  993. version 4.7 release. If you can use PostScript or GhostScript with your
  994. printer, you can print the reference card immediately with `refcard.ps'.
  995.  
  996.    The release also includes the source for the reference card.  You
  997. can format it, using TeX, by typing:
  998.  
  999.      make refcard.dvi
  1000.  
  1001.    The GDB reference card is designed to print in landscape mode on US
  1002. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  1003. high.  You will need to specify this form of printing as an option to
  1004. your DVI output program.
  1005.  
  1006.    All the documentation for GDB comes as part of the machine-readable
  1007. distribution.  The documentation is written in Texinfo format, which is
  1008. a documentation system that uses a single source file to produce both
  1009. on-line information and a printed manual.  You can use one of the Info
  1010. formatting commands to create the on-line version of the documentation
  1011. and TeX (or `texi2roff') to typeset the printed version.
  1012.  
  1013.    GDB includes an already formatted copy of the on-line Info version of
  1014. this manual in the `gdb' subdirectory.  The main Info file is
  1015. `gdb-VERSION-NUMBER/gdb/gdb.info', and it refers to subordinate files
  1016. matching `gdb.info*' in the same directory.  If necessary, you can
  1017. print out these files, or read them with any editor; but they are
  1018. easier to read using the `info' subsystem in GNU Emacs or the
  1019. standalone `info' program, available as part of the GNU Texinfo
  1020. distribution.
  1021.  
  1022.    If you want to format these Info files yourself, you need one of the
  1023. Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
  1024.  
  1025.    If you have `makeinfo' installed, and are in the top level GDB
  1026. source directory (`gdb-4.7', in the case of version 4.7), you can make
  1027. the Info file by typing:
  1028.  
  1029.      cd gdb
  1030.      make gdb.info
  1031.  
  1032.    If you want to typeset and print copies of this manual, you need
  1033. TeX, a printing program such as `lpr', and `texinfo.tex', the Texinfo
  1034. definitions file.
  1035.  
  1036.    TeX is typesetting program; it does not print files directly, but
  1037. produces output files called DVI files.  To print a typeset document,
  1038. you need a program to print DVI files.  If your system has TeX
  1039. installed, chances are it has such a program.  The precise command to
  1040. use depends on your system; `lpr -d' is common; another is `dvips'. 
  1041. The DVI print command may require a file name without any extension or
  1042. a `.dvi' extension.
  1043.  
  1044.    TeX also requires a macro definitions file called `texinfo.tex'. 
  1045. This file tells TeX how to typeset a document written in Texinfo
  1046. format.  On its own, TeX cannot read, much less typeset a Texinfo file.
  1047.  `texinfo.tex' is distributed with GDB and is located in the
  1048. `gdb-VERSION-NUMBER/texinfo' directory.
  1049.  
  1050.    If you have TeX and a DVI printer program installed, you can typeset
  1051. and print this manual.  First switch to the the `gdb' subdirectory of
  1052. the main source directory (for example, to `gdb-4.7/gdb') and then type:
  1053.  
  1054.      make gdb.dvi
  1055.  
  1056. 
  1057. File: gdb.info,  Node: Installing GDB,  Next: Copying,  Prev: Formatting Documentation,  Up: Top
  1058.  
  1059. Installing GDB
  1060. **************
  1061.  
  1062.    GDB comes with a `configure' script that automates the process of
  1063. preparing GDB for installation; you can then use `make' to build the
  1064. program.
  1065.  
  1066.    The GDB distribution includes all the source code you need for GDB in
  1067. a single directory, whose name is usually composed by appending the
  1068. version number to `gdb'.
  1069.  
  1070.    For example, the GDB version 4.7 distribution is in the `gdb-4.7'
  1071. directory.  That directory contains:
  1072.  
  1073. `gdb-4.7/configure (and supporting files)'
  1074.      script for configuring GDB and all its supporting libraries.
  1075.  
  1076. `gdb-4.7/gdb'
  1077.      the source specific to GDB itself
  1078.  
  1079. `gdb-4.7/bfd'
  1080.      source for the Binary File Descriptor library
  1081.  
  1082. `gdb-4.7/include'
  1083.      GNU include files
  1084.  
  1085. `gdb-4.7/libiberty'
  1086.      source for the `-liberty' free software library
  1087.  
  1088. `gdb-4.7/opcodes'
  1089.      source for the library of opcode tables and disassemblers
  1090.  
  1091. `gdb-4.7/readline'
  1092.      source for the GNU command-line interface
  1093.  
  1094. `gdb-4.7/glob'
  1095.      source for the GNU filename pattern-matching subroutine
  1096.  
  1097. `gdb-4.7/mmalloc'
  1098.      source for the GNU memory-mapped malloc package
  1099.  
  1100.    The simplest way to configure and build GDB is to run `configure'
  1101. from the `gdb-VERSION-NUMBER' source directory, which in this example
  1102. is the `gdb-4.7' directory.
  1103.  
  1104.    First switch to the `gdb-VERSION-NUMBER' source directory if you are
  1105. not already in it; then run `configure'.  Pass the identifier for the
  1106. platform on which GDB will run as an argument.
  1107.  
  1108.    For example:
  1109.  
  1110.      cd gdb-4.7
  1111.      ./configure HOST
  1112.      make
  1113.  
  1114. where HOST is an identifier such as `sun4' or `decstation', that
  1115. identifies the platform where GDB will run.
  1116.  
  1117.    Running `configure HOST' followed by `make' builds the `bfd',
  1118. `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself. 
  1119. The configured source files, and the binaries, are left in the
  1120. corresponding source directories.
  1121.  
  1122.    `configure' is a Bourne-shell (`/bin/sh') script; if your system
  1123. does not recognize this automatically when you run a different shell,
  1124. you may need to run `sh' on it explicitly:
  1125.  
  1126.      sh configure HOST
  1127.  
  1128.    If you run `configure' from a directory that contains source
  1129. directories for multiple libraries or programs, such as the `gdb-4.7'
  1130. source directory for version 4.7, `configure' creates configuration
  1131. files for every directory level underneath (unless you tell it not to,
  1132. with the `--norecursion' option).
  1133.  
  1134.    You can run the `configure' script from any of the subordinate
  1135. directories in the GDB distribution, if you only want to configure that
  1136. subdirectory; but be sure to specify a path to it.
  1137.  
  1138.    For example, with version 4.7, type the following to configure only
  1139. the `bfd' subdirectory:
  1140.  
  1141.      cd gdb-4.7/bfd
  1142.      ../configure HOST
  1143.  
  1144.    You can install `gdb' anywhere; it has no hardwired paths. However,
  1145. you should make sure that the shell on your path (named by the `SHELL'
  1146. environment variable) is publicly readable.  Remember that GDB uses the
  1147. shell to start your program--some systems refuse to let GDB debug child
  1148. processes whose programs are not readable.
  1149.  
  1150. * Menu:
  1151.  
  1152. * Separate Objdir::             Compiling GDB in another directory
  1153. * Config Names::                Specifying names for hosts and targets
  1154. * configure Options::           Summary of options for configure
  1155.  
  1156. 
  1157. File: gdb.info,  Node: Separate Objdir,  Next: Config Names,  Up: Installing GDB
  1158.  
  1159. Compiling GDB in Another Directory
  1160. ==================================
  1161.  
  1162.    If you want to run GDB versions for several host or target machines,
  1163. you'll need a different `gdb' compiled for each combination of host and
  1164. target.  `configure' is designed to make this easy by allowing you to
  1165. generate each configuration in a separate subdirectory, rather than in
  1166. the source directory.  If your `make' program handles the `VPATH'
  1167. feature (GNU `make' does), running `make' in each of these directories
  1168. then builds the `gdb' program specified there.
  1169.  
  1170.    To build `gdb' in a separate directory, run `configure' with the
  1171. `--srcdir' option to specify where to find the source. (You'll also
  1172. need to specify a path to find `configure' itself from your working
  1173. directory.  If the path to `configure' would be the same as the
  1174. argument to `--srcdir', you can leave out the `--srcdir' option; it
  1175. will be assumed.)
  1176.  
  1177.    For example, with version 4.7, you can build GDB in a separate
  1178. directory for a Sun 4 like this:
  1179.  
  1180.      cd gdb-4.7
  1181.      mkdir ../gdb-sun4
  1182.      cd ../gdb-sun4
  1183.      ../gdb-4.7/configure sun4
  1184.      make
  1185.  
  1186.    When `configure' builds a configuration using a remote source
  1187. directory, it creates a tree for the binaries with the same structure
  1188. (and using the same names) as the tree under the source directory.  In
  1189. the example, you'd find the Sun 4 library `libiberty.a' in the
  1190. directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
  1191.  
  1192.    One popular reason to build several GDB configurations in separate
  1193. directories is to configure GDB for cross-compiling (where GDB runs on
  1194. one machine--the host--while debugging programs that run on another
  1195. machine--the target).  You specify a cross-debugging target by giving
  1196. the `--target=TARGET' option to `configure'.
  1197.  
  1198.    When you run `make' to build a program or library, you must run it
  1199. in a configured directory--whatever directory you were in when you
  1200. called `configure' (or one of its subdirectories).
  1201.  
  1202.    The `Makefile' generated by `configure' for each source directory
  1203. also runs recursively.  If you type `make' in a source directory such
  1204. as `gdb-4.7' (or in a separate configured directory configured with
  1205. `--srcdir=PATH/gdb-4.7'), you will build all the required libraries,
  1206. then build GDB.
  1207.  
  1208.    When you have multiple hosts or targets configured in separate
  1209. directories, you can run `make' on them in parallel (for example, if
  1210. they are NFS-mounted on each of the hosts); they will not interfere
  1211. with each other.
  1212.  
  1213. 
  1214. File: gdb.info,  Node: Config Names,  Next: configure Options,  Prev: Separate Objdir,  Up: Installing GDB
  1215.  
  1216. Specifying Names for Hosts and Targets
  1217. ======================================
  1218.  
  1219.    The specifications used for hosts and targets in the `configure'
  1220. script are based on a three-part naming scheme, but some short
  1221. predefined aliases are also supported.  The full naming scheme encodes
  1222. three pieces of information in the following pattern:
  1223.  
  1224.      ARCHITECTURE-VENDOR-OS
  1225.  
  1226.    For example, you can use the alias `sun4' as a HOST argument or in a
  1227. `--target=TARGET' option, but the equivalent full name is
  1228. `sparc-sun-sunos4'.
  1229.  
  1230.    The `configure' script accompanying GDB does not provide any query
  1231. facility to list all supported host and target names or aliases. 
  1232. `configure' calls the Bourne shell script `config.sub' to map
  1233. abbreviations to full names; you can read the script, if you wish, or
  1234. you can use it to test your guesses on abbreviations--for example:
  1235.  
  1236.      % sh config.sub sun4
  1237.      sparc-sun-sunos411
  1238.      % sh config.sub sun3
  1239.      m68k-sun-sunos411
  1240.      % sh config.sub decstation
  1241.      mips-dec-ultrix42
  1242.      % sh config.sub hp300bsd
  1243.      m68k-hp-bsd
  1244.      % sh config.sub i386v
  1245.      i386-unknown-sysv
  1246.      % sh config.sub i786v
  1247.      Invalid configuration `i786v': machine `i786v' not recognized
  1248.  
  1249. `config.sub' is also distributed in the GDB source directory
  1250. (`gdb-4.7', for version 4.7).
  1251.  
  1252.