home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / gdb.info-5 < prev    next >
Encoding:
GNU Info File  |  1993-05-12  |  49.3 KB  |  1,253 lines

  1. This is Info file ./gdb.info, produced by Makeinfo-1.52 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.09, April 1993, of `Debugging with GDB: the GNU
  10. Source-Level Debugger' for GDB Version 4.9.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software
  13. 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 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: Altering,  Next: GDB Files,  Prev: Symbols,  Up: Top
  34.  
  35. Altering Execution
  36. ******************
  37.  
  38.    Once you think you have found an error in your program, you might
  39. want to find out for certain whether correcting the apparent error
  40. would lead to correct results in the rest of the run.  You can find the
  41. answer by experiment, using the GDB features for altering execution of
  42. the program.
  43.  
  44.    For example, you can store new values into variables or memory
  45. locations, give your program a signal, restart it at a different
  46. address, or even return prematurely from a function to its caller.
  47.  
  48. * Menu:
  49.  
  50. * Assignment::                  Assignment to variables
  51. * Jumping::                     Continuing at a different address
  52.  
  53. * Signaling::                   Giving your program a signal
  54.  
  55. * Returning::                   Returning from a function
  56. * Calling::                     Calling your program's functions
  57. * Patching::                    Patching your program
  58.  
  59. 
  60. File: gdb.info,  Node: Assignment,  Next: Jumping,  Up: Altering
  61.  
  62. Assignment to variables
  63. =======================
  64.  
  65.    To alter the value of a variable, evaluate an assignment expression.
  66. *Note Expressions: Expressions.  For example,
  67.  
  68.      print x=4
  69.  
  70. stores the value 4 into the variable `x', and then prints the value of
  71. the assignment expression (which is 4).  *Note Using GDB with Different
  72. Languages: Languages, for more information on operators in supported
  73. languages.
  74.  
  75.    If you are not interested in seeing the value of the assignment, use
  76. the `set' command instead of the `print' command.  `set' is really the
  77. same as `print' except that the expression's value is not printed and
  78. is not put in the value history (*note Value history: Value History.).
  79. The expression is evaluated only for its effects.
  80.  
  81.    If the beginning of the argument string of the `set' command appears
  82. identical to a `set' subcommand, use the `set variable' command instead
  83. of just `set'.  This command is identical to `set' except for its lack
  84. of subcommands.  For example, if your program has a variable `width',
  85. you get an error if you try to set a new value with just `set width=13',
  86. because GDB has the command `set width':
  87.  
  88.      (gdb) whatis width
  89.      type = double
  90.      (gdb) p width
  91.      $4 = 13
  92.      (gdb) set width=47
  93.      Invalid syntax in expression.
  94.  
  95. The invalid expression, of course, is `=47'.  In order to actually set
  96. the program's variable `width', use
  97.  
  98.      (gdb) set var width=47
  99.  
  100.    GDB allows more implicit conversions in assignments than C; you can
  101. freely store an integer value into a pointer variable or vice versa,
  102. and you can convert any structure to any other structure that is the
  103. same length or shorter.
  104.  
  105.    To store values into arbitrary places in memory, use the `{...}'
  106. construct to generate a value of specified type at a specified address
  107. (*note Expressions: Expressions.).  For example, `{int}0x83040' refers
  108. to memory location `0x83040' as an integer (which implies a certain size
  109. and representation in memory), and
  110.  
  111.      set {int}0x83040 = 4
  112.  
  113. stores the value 4 into that memory location.
  114.  
  115. 
  116. File: gdb.info,  Node: Jumping,  Next: Signaling,  Prev: Assignment,  Up: Altering
  117.  
  118. Continuing at a different address
  119. =================================
  120.  
  121.    Ordinarily, when you continue your program, you do so at the place
  122. where it stopped, with the `continue' command.  You can instead
  123. continue at an address of your own choosing, with the following
  124. commands:
  125.  
  126. `jump LINESPEC'
  127.      Resume execution at line LINESPEC.  Execution will stop
  128.      immediately if there is a breakpoint there.  *Note Printing source
  129.      lines: List, for a description of the different forms of LINESPEC.
  130.  
  131.      The `jump' command does not change the current stack frame, or the
  132.      stack pointer, or the contents of any memory location or any
  133.      register other than the program counter.  If line LINESPEC is in a
  134.      different function from the one currently executing, the results
  135.      may be bizarre if the two functions expect different patterns of
  136.      arguments or of local variables.  For this reason, the `jump'
  137.      command requests confirmation if the specified line is not in the
  138.      function currently executing.  However, even bizarre results are
  139.      predictable if you are well acquainted with the machine-language
  140.      code of your program.
  141.  
  142. `jump *ADDRESS'
  143.      Resume execution at the instruction at address ADDRESS.
  144.  
  145.    You can get much the same effect as the `jump' command by storing a
  146. new value into the register `$pc'.  The difference is that this does
  147. not start your program running; it only changes the address where it
  148. *will* run when it is continued.  For example,
  149.  
  150.      set $pc = 0x485
  151.  
  152. causes the next `continue' command or stepping command to execute at
  153. address `0x485', rather than at the address where your program stopped.
  154. *Note Continuing and stepping: Continuing and Stepping.
  155.  
  156.    The most common occasion to use the `jump' command is to back up,
  157. perhaps with more breakpoints set, over a portion of a program that has
  158. already executed, in order to examine its execution in more detail.
  159.  
  160. 
  161. File: gdb.info,  Node: Signaling,  Next: Returning,  Prev: Jumping,  Up: Altering
  162.  
  163. Giving your program a signal
  164. ============================
  165.  
  166. `signal SIGNALNUM'
  167.      Resume execution where your program stopped, but give it
  168.      immediately the signal number SIGNALNUM.
  169.  
  170.      Alternatively, if SIGNALNUM is zero, continue execution without
  171.      giving a signal.  This is useful when your program stopped on
  172.      account of a signal and would ordinary see the signal when resumed
  173.      with the `continue' command; `signal 0' causes it to resume
  174.      without a signal.
  175.  
  176.      `signal' does not repeat when you press RET a second time after
  177.      executing the command.
  178.  
  179. 
  180. File: gdb.info,  Node: Returning,  Next: Calling,  Prev: Signaling,  Up: Altering
  181.  
  182. Returning from a function
  183. =========================
  184.  
  185. `return'
  186. `return EXPRESSION'
  187.      You can cancel execution of a function call with the `return'
  188.      command.  If you give an EXPRESSION argument, its value is used as
  189.      the function's return value.
  190.  
  191.    When you use `return', GDB discards the selected stack frame (and
  192. all frames within it).  You can think of this as making the discarded
  193. frame return prematurely.  If you wish to specify a value to be
  194. returned, give that value as the argument to `return'.
  195.  
  196.    This pops the selected stack frame (*note Selecting a frame:
  197. Selection.), and any other frames inside of it, leaving its caller as
  198. the innermost remaining frame.  That frame becomes selected.  The
  199. specified value is stored in the registers used for returning values of
  200. functions.
  201.  
  202.    The `return' command does not resume execution; it leaves the
  203. program stopped in the state that would exist if the function had just
  204. returned.  In contrast, the `finish' command (*note Continuing and
  205. stepping: Continuing and Stepping.) resumes execution until the
  206. selected stack frame returns naturally.
  207.  
  208. 
  209. File: gdb.info,  Node: Calling,  Next: Patching,  Prev: Returning,  Up: Altering
  210.  
  211. Calling program functions
  212. =========================
  213.  
  214. `call EXPR'
  215.      Evaluate the expression EXPR without displaying `void' returned
  216.      values.
  217.  
  218.    You can use this variant of the `print' command if you want to
  219. execute a function from your program, but without cluttering the output
  220. with `void' returned values.  The result is printed and saved in the
  221. value history, if it is not void.
  222.  
  223. 
  224. File: gdb.info,  Node: Patching,  Prev: Calling,  Up: Altering
  225.  
  226. Patching programs
  227. =================
  228.  
  229.    By default, GDB opens the file containing your program's executable
  230. code (or the corefile) read-only.  This prevents accidental alterations
  231. to machine code; but it also prevents you from intentionally patching
  232. your program's binary.
  233.  
  234.    If you'd like to be able to patch the binary, you can specify that
  235. explicitly with the `set write' command.  For example, you might want
  236. to turn on internal debugging flags, or even to make emergency repairs.
  237.  
  238. `set write on'
  239. `set write off'
  240.      If you specify `set write on', GDB will open executable and core
  241.      files for both reading and writing; if you specify `set write off'
  242.      (the default), GDB will open them read-only.
  243.  
  244.      If you have already loaded a file, you must load it again (using
  245.      the `exec-file' or `core-file' command) after changing `set
  246.      write', for your new setting to take effect.
  247.  
  248. `show write'
  249.      Display whether executable files and core files will be opened for
  250.      writing as well as reading.
  251.  
  252. 
  253. File: gdb.info,  Node: GDB Files,  Next: Targets,  Prev: Altering,  Up: Top
  254.  
  255. GDB Files
  256. *********
  257.  
  258.    GDB needs to know the file name of the program to be debugged, both
  259. in order to read its symbol table and in order to start your program.
  260. To debug a core dump of a previous run, you must also tell GDB the name
  261. of the core dump file.
  262.  
  263. * Menu:
  264.  
  265. * Files::                       Commands to specify files
  266. * Symbol Errors::               Errors reading symbol files
  267.  
  268. 
  269. File: gdb.info,  Node: Files,  Next: Symbol Errors,  Up: GDB Files
  270.  
  271. Commands to specify files
  272. =========================
  273.  
  274.    The usual way to specify executable and core dump file names is with
  275. the command arguments given when you start GDB (*note Getting In and
  276. Out of GDB: Invocation..
  277.  
  278.    Occasionally it is necessary to change to a different file during a
  279. GDB session.  Or you may run GDB and forget to specify a file you want
  280. to use.  In these situations the GDB commands to specify new files are
  281. useful.
  282.  
  283. `file FILENAME'
  284.      Use FILENAME as the program to be debugged.  It is read for its
  285.      symbols and for the contents of pure memory.  It is also the
  286.      program executed when you use the `run' command.  If you do not
  287.      specify a directory and the file is not found in the GDB working
  288.      directory, GDB uses the environment variable `PATH' as a list of
  289.      directories to search, just as the shell does when looking for a
  290.      program to run.  You can change the value of this variable, for
  291.      both GDB and your program, using the `path' command.
  292.  
  293.      On systems with memory-mapped files, an auxiliary symbol table file
  294.      `FILENAME.syms' may be available for FILENAME.  If it is, GDB will
  295.      map in the symbol table from `FILENAME.syms', starting up more
  296.      quickly.  See the descriptions of the options `-mapped' and
  297.      `-readnow' (available on the command line, and with the commands
  298.      `file', `symbol-file', or `add-symbol-file'), for more information.
  299.  
  300. `file'
  301.      `file' with no argument makes GDB discard any information it has
  302.      on both executable file and the symbol table.
  303.  
  304. `exec-file [ FILENAME ]'
  305.      Specify that the program to be run (but not the symbol table) is
  306.      found in FILENAME.  GDB will search the environment variable `PATH'
  307.      if necessary to locate your program.  Omitting FILENAME means to
  308.      discard information on the executable file.
  309.  
  310. `symbol-file [ FILENAME ]'
  311.      Read symbol table information from file FILENAME.  `PATH' is
  312.      searched when necessary.  Use the `file' command to get both symbol
  313.      table and program to run from the same file.
  314.  
  315.      `symbol-file' with no argument clears out GDB information on your
  316.      program's symbol table.
  317.  
  318.      The `symbol-file' command causes GDB to forget the contents of its
  319.      convenience variables, the value history, and all breakpoints and
  320.      auto-display expressions.  This is because they may contain
  321.      pointers to the internal data recording symbols and data types,
  322.      which are part of the old symbol table data being discarded inside
  323.      GDB.
  324.  
  325.      `symbol-file' will not repeat if you press RET again after
  326.      executing it once.
  327.  
  328.      When GDB is configured for a particular environment, it will
  329.      understand debugging information in whatever format is the standard
  330.      generated for that environment; you may use either a GNU compiler,
  331.      or other compilers that adhere to the local conventions.  Best
  332.      results are usually obtained from GNU compilers; for example,
  333.      using `gcc' you can generate debugging information for optimized
  334.      code.
  335.  
  336.      On some kinds of object files, the `symbol-file' command does not
  337.      normally read the symbol table in full right away.  Instead, it
  338.      scans the symbol table quickly to find which source files and
  339.      which symbols are present.  The details are read later, one source
  340.      file at a time, as they are needed.
  341.  
  342.      The purpose of this two-stage reading strategy is to make GDB
  343.      start up faster.  For the most part, it is invisible except for
  344.      occasional pauses while the symbol table details for a particular
  345.      source file are being read.  (The `set verbose' command can turn
  346.      these pauses into messages if desired.  *Note Optional warnings
  347.      and messages: Messages/Warnings.)
  348.  
  349.      We have not implemented the two-stage strategy for COFF yet.  When
  350.      the symbol table is stored in COFF format, `symbol-file' reads the
  351.      symbol table data in full right away.
  352.  
  353. `symbol-file FILENAME [ -readnow ] [ -mapped ]'
  354. `file FILENAME [ -readnow ] [ -mapped ]'
  355.      You can override the GDB two-stage strategy for reading symbol
  356.      tables by using the `-readnow' option with any of the commands that
  357.      load symbol table information, if you want to be sure GDB has the
  358.      entire symbol table available.
  359.  
  360.      If memory-mapped files are available on your system through the
  361.      `mmap' system call, you can use another option, `-mapped', to
  362.      cause GDB to write the symbols for your program into a reusable
  363.      file.  Future GDB debugging sessions will map in symbol information
  364.      from this auxiliary symbol file (if the program has not changed),
  365.      rather than spending time reading the symbol table from the
  366.      executable program.  Using the `-mapped' option has the same
  367.      effect as starting GDB with the `-mapped' command-line option.
  368.  
  369.      You can use both options together, to make sure the auxiliary
  370.      symbol file has all the symbol information for your program.
  371.  
  372.      The auxiliary symbol file for a program called MYPROG is called
  373.      `MYPROG.syms'.  Once this file exists (so long as it is newer than
  374.      the corresponding executable), GDB will always attempt to use it
  375.      when you debug MYPROG; no special options or commands are needed.
  376.  
  377.      The `.syms' file is specific to the host machine where you run
  378.      GDB.  It holds an exact image of the internal GDB symbol table.
  379.      It cannot be shared across multiple host platforms.
  380.  
  381. `core-file [ FILENAME ]'
  382.      Specify the whereabouts of a core dump file to be used as the
  383.      "contents of memory".  Traditionally, core files contain only some
  384.      parts of the address space of the process that generated them; GDB
  385.      can access the executable file itself for other parts.
  386.  
  387.      `core-file' with no argument specifies that no core file is to be
  388.      used.
  389.  
  390.      Note that the core file is ignored when your program is actually
  391.      running under GDB.  So, if you have been running your program and
  392.      you wish to debug a core file instead, you must kill the
  393.      subprocess in which the program is running.  To do this, use the
  394.      `kill' command (*note Killing the child process: Kill Process.).
  395.  
  396. `load FILENAME'
  397.      Depending on what remote debugging facilities are configured into
  398.      GDB, the `load' command may be available.  Where it exists, it is
  399.      meant to make FILENAME (an executable) available for debugging on
  400.      the remote system--by downloading, or dynamic linking, for example.
  401.      `load' also records the FILENAME symbol table in GDB, like the
  402.      `add-symbol-file' command.
  403.  
  404.      If your GDB does not have a `load' command, attempting to execute
  405.      it gets the error message "`You can't do that when your target is
  406.      ...'"
  407.  
  408.      On VxWorks, `load' will dynamically link FILENAME on the current
  409.      target system as well as adding its symbols in GDB.
  410.  
  411.      With the Nindy interface to an Intel 960 board, `load' will
  412.      download FILENAME to the 960 as well as adding its symbols in GDB.
  413.  
  414.      When you select remote debugging to a Hitachi SH, H8/300, or
  415.      H8/500 board (*note GDB and Hitachi Microprocessors: Hitachi
  416.      Remote.), the `load' command downloads your program to the Hitachi
  417.      board and also opens it as the current executable target for GDB
  418.      on your host (like the `file' command).
  419.  
  420.      `load' will not repeat if you press RET again after using it.
  421.  
  422. `add-symbol-file FILENAME ADDRESS'
  423. `add-symbol-file FILENAME ADDRESS [ -readnow ] [ -mapped ]'
  424.      The `add-symbol-file' command reads additional symbol table
  425.      information from the file FILENAME.  You would use this command
  426.      when FILENAME has been dynamically loaded (by some other means)
  427.      into the program that is running.  ADDRESS should be the memory
  428.      address at which the file has been loaded; GDB cannot figure this
  429.      out for itself.
  430.  
  431.      The symbol table of the file FILENAME is added to the symbol table
  432.      originally read with the `symbol-file' command.  You can use the
  433.      `add-symbol-file' command any number of times; the new symbol data
  434.      thus read keeps adding to the old.  To discard all old symbol data
  435.      instead, use the `symbol-file' command.
  436.  
  437.      `add-symbol-file' will not repeat if you press RET after using it.
  438.  
  439.      You can use the `-mapped' and `-readnow' options just as with the
  440.      `symbol-file' command, to change how GDB manages the symbol table
  441.      information for FILENAME.
  442.  
  443. `info files'
  444. `info target'
  445.      `info files' and `info target' are synonymous; both print the
  446.      current target (*note Specifying a Debugging Target: Targets.),
  447.      including the names of the executable and core dump files
  448.      currently in use by GDB, and the files from which symbols were
  449.      loaded.  The command `help targets' lists all possible targets
  450.      rather than current ones.
  451.  
  452.    All file-specifying commands allow both absolute and relative file
  453. names as arguments.  GDB always converts the file name to an absolute
  454. path name and remembers it that way.
  455.  
  456.    GDB supports SunOS, SVR4, and IBM RS/6000 shared libraries.  GDB
  457. automatically loads symbol definitions from shared libraries when you
  458. use the `run' command, or when you examine a core file.  (Before you
  459. issue the `run' command, GDB will not understand references to a
  460. function in a shared library, however--unless you are debugging a core
  461. file).
  462.  
  463. `info share'
  464. `info sharedlibrary'
  465.      Print the names of the shared libraries which are currently loaded.
  466.  
  467. `sharedlibrary REGEX'
  468. `share REGEX'
  469.      This is an obsolescent command; you can use it to explicitly load
  470.      shared object library symbols for files matching a UNIX regular
  471.      expression, but as with files loaded automatically, it will only
  472.      load shared libraries required by your program for a core file or
  473.      after typing `run'.  If REGEX is omitted all shared libraries
  474.      required by your program are loaded.
  475.  
  476. 
  477. File: gdb.info,  Node: Symbol Errors,  Prev: Files,  Up: GDB Files
  478.  
  479. Errors reading symbol files
  480. ===========================
  481.  
  482.    While reading a symbol file, GDB will occasionally encounter
  483. problems, such as symbol types it does not recognize, or known bugs in
  484. compiler output.  By default, GDB does not notify you of such problems,
  485. since they are relatively common and primarily of interest to people
  486. debugging compilers.  If you are interested in seeing information about
  487. ill-constructed symbol tables, you can either ask GDB to print only one
  488. message about each such type of problem, no matter how many times the
  489. problem occurs; or you can ask GDB to print more messages, to see how
  490. many times the problems occur, with the `set complaints' command (*note
  491. Optional warnings and messages: Messages/Warnings.).
  492.  
  493.    The messages currently printed, and their meanings, are:
  494.  
  495. `inner block not inside outer block in SYMBOL'
  496.      The symbol information shows where symbol scopes begin and end
  497.      (such as at the start of a function or a block of statements).
  498.      This error indicates that an inner scope block is not fully
  499.      contained in its outer scope blocks.
  500.  
  501.      GDB circumvents the problem by treating the inner block as if it
  502.      had the same scope as the outer block.  In the error message,
  503.      SYMBOL may be shown as "`(don't know)'" if the outer block is not a
  504.      function.
  505.  
  506. `block at ADDRESS out of order'
  507.      The symbol information for symbol scope blocks should occur in
  508.      order of increasing addresses.  This error indicates that it does
  509.      not do so.
  510.  
  511.      GDB does not circumvent this problem, and will have trouble
  512.      locating symbols in the source file whose symbols it is reading.
  513.      (You can often determine what source file is affected by specifying
  514.      `set verbose on'.  *Note Optional warnings and messages:
  515.      Messages/Warnings.)
  516.  
  517. `bad block start address patched'
  518.      The symbol information for a symbol scope block has a start address
  519.      smaller than the address of the preceding source line.  This is
  520.      known to occur in the SunOS 4.1.1 (and earlier) C compiler.
  521.  
  522.      GDB circumvents the problem by treating the symbol scope block as
  523.      starting on the previous source line.
  524.  
  525. `bad string table offset in symbol N'
  526.      Symbol number N contains a pointer into the string table which is
  527.      larger than the size of the string table.
  528.  
  529.      GDB circumvents the problem by considering the symbol to have the
  530.      name `foo', which may cause other problems if many symbols end up
  531.      with this name.
  532.  
  533. `unknown symbol type `0xNN''
  534.      The symbol information contains new data types that GDB does not
  535.      yet know how to read.  `0xNN' is the symbol type of the
  536.      misunderstood information, in hexadecimal.
  537.  
  538.      GDB circumvents the error by ignoring this symbol information.
  539.      This will usually allow your program to be debugged, though
  540.      certain symbols will not be accessible.  If you encounter such a
  541.      problem and feel like debugging it, you can debug `gdb' with
  542.      itself, breakpoint on `complain', then go up to the function
  543.      `read_dbx_symtab' and examine `*bufp' to see the symbol.
  544.  
  545. `stub type has NULL name'
  546.      GDB could not find the full definition for a struct or class.
  547.  
  548. `const/volatile indicator missing (ok if using g++ v1.x), got...'
  549.      The symbol information for a C++ member function is missing some
  550.      information that recent versions of the compiler should have output
  551.      for it.
  552.  
  553. `info mismatch between compiler and debugger'
  554.      GDB could not parse a type specification output by the compiler.
  555.  
  556. 
  557. File: gdb.info,  Node: Targets,  Next: Controlling GDB,  Prev: GDB Files,  Up: Top
  558.  
  559. Specifying a Debugging Target
  560. *****************************
  561.  
  562.    A "target" is the execution environment occupied by your program.
  563. Often, GDB runs in the same host environment as your program; in that
  564. case, the debugging target is specified as a side effect when you use
  565. the `file' or `core' commands.  When you need more flexibility--for
  566. example, running GDB on a physically separate host, or controlling a
  567. standalone system over a serial port or a realtime system over a TCP/IP
  568. connection--you can use the `target' command to specify one of the
  569. target types configured for GDB (*note Commands for managing targets:
  570. Target Commands.).
  571.  
  572. * Menu:
  573.  
  574. * Active Targets::              Active targets
  575. * Target Commands::             Commands for managing targets
  576. * Remote::                      Remote debugging
  577.  
  578. 
  579. File: gdb.info,  Node: Active Targets,  Next: Target Commands,  Up: Targets
  580.  
  581. Active targets
  582. ==============
  583.  
  584.    There are three classes of targets: processes, core files, and
  585. executable files.  GDB can work concurrently on up to three active
  586. targets, one in each class.  This allows you to (for example) start a
  587. process and inspect its activity without abandoning your work on a core
  588. file.
  589.  
  590.    For example, if you execute `gdb a.out', then the executable file
  591. `a.out' is the only active target.  If you designate a core file as
  592. well--presumably from a prior run that crashed and coredumped--then GDB
  593. has two active targets and will use them in tandem, looking first in
  594. the corefile target, then in the executable file, to satisfy requests
  595. for memory addresses.  (Typically, these two classes of target are
  596. complementary, since core files contain only a program's read-write
  597. memory--variables and so on--plus machine status, while executable
  598. files contain only the program text and initialized data.)
  599.  
  600.    When you type `run', your executable file becomes an active process
  601. target as well.  When a process target is active, all GDB commands
  602. requesting memory addresses refer to that target; addresses in an
  603. active core file or executable file target are obscured while the
  604. process target is active.
  605.  
  606.    Use the `core-file' and `exec-file' commands to select a new core
  607. file or executable target (*note Commands to specify files: Files.).
  608. To specify as a target a process that is already running, use the
  609. `attach' command (*note Debugging an already-running process: Attach.).
  610.  
  611. 
  612. File: gdb.info,  Node: Target Commands,  Next: Remote,  Prev: Active Targets,  Up: Targets
  613.  
  614. Commands for managing targets
  615. =============================
  616.  
  617. `target TYPE PARAMETERS'
  618.      Connects the GDB host environment to a target machine or process.
  619.      A target is typically a protocol for talking to debugging
  620.      facilities.  You use the argument TYPE to specify the type or
  621.      protocol of the target machine.
  622.  
  623.      Further PARAMETERS are interpreted by the target protocol, but
  624.      typically include things like device names or host names to connect
  625.      with, process numbers, and baud rates.
  626.  
  627.      The `target' command will not repeat if you press RET again after
  628.      executing the command.
  629.  
  630. `help target'
  631.      Displays the names of all targets available.  To display targets
  632.      currently selected, use either `info target' or `info files'
  633.      (*note Commands to specify files: Files.).
  634.  
  635. `help target NAME'
  636.      Describe a particular target, including any parameters necessary to
  637.      select it.
  638.  
  639.    Here are some common targets (available, or not, depending on the GDB
  640. configuration):
  641.  
  642. `target exec PROGRAM'
  643.      An executable file.  `target exec PROGRAM' is the same as
  644.      `exec-file PROGRAM'.
  645.  
  646. `target core FILENAME'
  647.      A core dump file.  `target core FILENAME' is the same as
  648.      `core-file FILENAME'.
  649.  
  650. `target remote DEV'
  651.      Remote serial target in GDB-specific protocol.  The argument DEV
  652.      specifies what serial device to use for the connection (e.g.
  653.      `/dev/ttya'). *Note Remote debugging: Remote.
  654.  
  655. `target sim'
  656.      CPU simulator.  *Note Simulated CPU Target: Simulator.
  657.  
  658. `target udi KEYWORD'
  659.      Remote AMD29K target, using the AMD UDI protocol.  The KEYWORD
  660.      argument specifies which 29K board or simulator to use.  *Note GDB
  661.      and the UDI protocol for AMD29K: UDI29K Remote.
  662.  
  663. `target amd-eb DEV SPEED PROG'
  664.      Remote PC-resident AMD EB29K board, attached over serial lines.
  665.      dEV is the serial device, as for `target remote'; SPEED allows you
  666.      to specify the linespeed; and PROG is the name of the program to
  667.      be debugged, as it appears to DOS on the PC.  *Note GDB with a
  668.      remote EB29K: EB29K Remote.
  669.  
  670. `target hms'
  671.      A Hitachi SH, H8/300, or H8/500 board, attached via serial line to
  672.      your host.  Use special commands `device' and `speed' to control
  673.      the serial line and the communications speed used.  *Note GDB and
  674.      Hitachi Microprocessors: Hitachi Remote.
  675.  
  676. `target nindy DEVICENAME'
  677.      An Intel 960 board controlled by a Nindy Monitor.  DEVICENAME is
  678.      the name of the serial device to use for the connection, e.g.
  679.      `/dev/ttya'.  *Note GDB with a remote i960 (Nindy): i960-Nindy
  680.      Remote.
  681.  
  682. `target st2000 DEV SPEED'
  683.      A Tandem ST2000 phone switch, running Tandem's STDBUG protocol.
  684.      dEV is the name of the device attached to the ST2000 serial line;
  685.      SPEED is the communication line speed.  The arguments are not used
  686.      if GDB is configured to connect to the ST2000 using TCP or Telnet.
  687.      *Note GDB with a Tandem ST2000: ST2000 Remote.
  688.  
  689. `target vxworks MACHINENAME'
  690.      A VxWorks system, attached via TCP/IP.  The argument MACHINENAME
  691.      is the target system's machine name or IP address.  *Note GDB and
  692.      VxWorks: VxWorks Remote.
  693.  
  694.    Different targets are available on different configurations of GDB;
  695. your configuration may have more or fewer targets.
  696.  
  697. 
  698. File: gdb.info,  Node: Remote,  Prev: Target Commands,  Up: Targets
  699.  
  700. Remote debugging
  701. ================
  702.  
  703.    If you are trying to debug a program running on a machine that
  704. cannot run GDB in the usual way, it is often useful to use remote
  705. debugging.  For example, you might use remote debugging on an operating
  706. system kernel, or on a small system which does not have a general
  707. purpose operating system powerful enough to run a full-featured
  708. debugger.
  709.  
  710.    Some configurations of GDB have special serial or TCP/IP interfaces
  711. to make this work with particular debugging targets.  In addition, GDB
  712. comes with a generic serial protocol (specific to GDB, but not specific
  713. to any particular target system) which you can use if you write the
  714. remote stubs--the code that will run on the remote system to
  715. communicate with GDB.
  716.  
  717.    Other remote targets may be available in your configuration of GDB;
  718. use `help targets' to list them.
  719.  
  720. * Menu:
  721.  
  722.  
  723. * Remote Serial::               GDB remote serial protocol
  724.  
  725. * i960-Nindy Remote::        GDB with a remote i960 (Nindy)
  726.  
  727. * UDI29K Remote::               GDB and the UDI protocol for AMD29K
  728. * EB29K Remote::        GDB with a remote EB29K
  729.  
  730. * VxWorks Remote::        GDB and VxWorks
  731.  
  732. * ST2000 Remote::               GDB with a Tandem ST2000
  733.  
  734. * Hitachi Remote::              GDB and Hitachi Microprocessors
  735.  
  736. * MIPS Remote::            GDB and MIPS boards
  737.  
  738. * Simulator::                   Simulated CPU target
  739.  
  740. 
  741. File: gdb.info,  Node: Remote Serial,  Next: i960-Nindy Remote,  Up: Remote
  742.  
  743. The GDB remote serial protocol
  744. ------------------------------
  745.  
  746.    To debug a program running on another machine (the debugging
  747. "target" machine), you must first arrange for all the usual
  748. prerequisites for the program to run by itself.  For example, for a C
  749. program, you need
  750.  
  751.   1. A startup routine to set up the C runtime environment; these
  752.      usually have a name like `crt0'.  The startup routine may be
  753.      supplied by your hardware supplier, or you may have to write your
  754.      own.
  755.  
  756.   2. You probably need a C subroutine library to support your program's
  757.      subroutine calls, notably managing input and output.
  758.  
  759.   3. A way of getting your program to the other machine--for example, a
  760.      download program.  These are often supplied by the hardware
  761.      manufacturer, but you may have to write your own from hardware
  762.      documentation.
  763.  
  764.    The next step is to arrange for your program to use a serial port to
  765. communicate with the machine where GDB is running (the "host" machine).
  766. In general terms, the scheme looks like this:
  767.  
  768. *On the host,*
  769.      GDB already understands how to use this protocol; when everything
  770.      else is set up, you can simply use the `target remote' command
  771.      (*note Specifying a Debugging Target: Targets.).
  772.  
  773. *On the target,*
  774.      you must link with your program a few special-purpose subroutines
  775.      that implement the GDB remote serial protocol.  The file
  776.      containing these subroutines is called  a "debugging stub".
  777.  
  778.    The debugging stub is specific to the architecture of the remote
  779. machine; for example, use `sparc-stub.c' to debug programs on SPARC
  780. boards.
  781.  
  782.    These working remote stubs are distributed with GDB:
  783.  
  784. `sparc-stub.c'
  785.      For SPARC architectures.
  786.  
  787. `m68k-stub.c'
  788.      For Motorola 680x0 architectures.
  789.  
  790. `i386-stub.c'
  791.      For Intel 386 and compatible architectures.
  792.  
  793.    The `README' file in the GDB distribution may list other recently
  794. added stubs.
  795.  
  796. * Menu:
  797.  
  798. * Stub Contents::       What the stub can do for you
  799. * Bootstrapping::       What you must do for the stub
  800. * Debug Session::       Putting it all together
  801. * Protocol::            Outline of the communication protocol
  802.  
  803. 
  804. File: gdb.info,  Node: Stub Contents,  Next: Bootstrapping,  Up: Remote Serial
  805.  
  806. What the stub can do for you
  807. ----------------------------
  808.  
  809.    The debugging stub for your architecture supplies these three
  810. subroutines:
  811.  
  812. `set_debug_traps'
  813.      This routine arranges for `handle_exception' to run when your
  814.      program stops.  You must call this subroutine explicitly near the
  815.      beginning of your program.
  816.  
  817. `handle_exception'
  818.      This is the central workhorse, but your program never calls it
  819.      explicitly--the setup code arranges for `handle_exception' to run
  820.      when a trap is triggered.
  821.  
  822.      `handle_exception' takes control when your program stops during
  823.      execution (for example, on a breakpoint), and mediates
  824.      communications with GDB on the host machine.  This is where the
  825.      communications protocol is implemented; `handle_exception' acts as
  826.      the GDB representative on the target machine; it begins by sending
  827.      summary information on the state of your program, then continues
  828.      to execute, retrieving and transmitting any information GDB needs,
  829.      until you execute a GDB command that makes your program resume; at
  830.      that point, `handle_exception' returns control to your own code on
  831.      the target machine.
  832.  
  833. `breakpoint'
  834.      Use this auxiliary subroutine to make your program contain a
  835.      breakpoint.  Depending on the particular situation, this may be
  836.      the only way for GDB to get control.  For instance, if your target
  837.      machine has some sort of interrupt button, you won't need to call
  838.      this; pressing the interrupt button will transfer control to
  839.      `handle_exception'--in efect, to GDB.  On some machines, simply
  840.      receiving characters on the serial port may also trigger a trap;
  841.      again, in that situation, you don't need to call `breakpoint' from
  842.      your own program--simply running `target remote' from the host GDB
  843.      session will get control.
  844.  
  845.      Call `breakpoint' if none of these is true, or if you simply want
  846.      to make certain your program stops at a predetermined point for the
  847.      start of your debugging session.
  848.  
  849. 
  850. File: gdb.info,  Node: Bootstrapping,  Next: Debug Session,  Prev: Stub Contents,  Up: Remote Serial
  851.  
  852. What you must do for the stub
  853. -----------------------------
  854.  
  855.    The debugging stubs that come with GDB are set up for a particular
  856. chip architecture, but they have no information about the rest of your
  857. debugging target machine.  To allow the stub to work, you must supply
  858. these special low-level subroutines:
  859.  
  860. `int getDebugChar()'
  861.      Write this subroutine to read a single character from the serial
  862.      port.  It may be identical to `getchar' for your target system; a
  863.      different name is used to allow you to distinguish the two if you
  864.      wish.
  865.  
  866. `void putDebugChar(int)'
  867.      Write this subroutine to write a single character to the serial
  868.      port.  It may be identical to `putchar' for your target system; a
  869.      different name is used to allow you to distinguish the two if you
  870.      wish.
  871.  
  872. `void flush_i_cache()'
  873.      Write this subroutine to flush the instruction cache, if any, on
  874.      your target machine.  If there is no instruction cache, this
  875.      subroutine may be a no-op.
  876.  
  877.      On target machines that have instruction caches, GDB requires this
  878.      function to make certain that the state of your program is stable.
  879.  
  880. You must also make sure this library routine is available:
  881.  
  882. `void *memset(void *, int, int)'
  883.      This is the standard library function `memset' that sets an area of
  884.      memory to a known value.  If you have one of the free versions of
  885.      `libc.a', `memset' can be found there; otherwise, you must either
  886.      obtain it from your hardware manufacturer, or write your own.
  887.  
  888.    If you do not use the GNU C compiler, you may need other standard
  889. library subroutines as well; this will vary from one stub to another,
  890. but in general the stubs are likely to use any of the common library
  891. subroutines which `gcc' generates as inline code.
  892.  
  893. 
  894. File: gdb.info,  Node: Debug Session,  Next: Protocol,  Prev: Bootstrapping,  Up: Remote Serial
  895.  
  896. Putting it all together
  897. -----------------------
  898.  
  899.    In summary, when your program is ready to debug, you must follow
  900. these steps.
  901.  
  902.   1. Make sure you have the supporting low-level routines:
  903.           `getDebugChar', `putDebugChar',
  904.           `flush_i_cache', `memset'.
  905.  
  906.   2. Insert these lines near the top of your program:
  907.  
  908.           set_debug_traps();
  909.           breakpoint();
  910.  
  911.   3. Compile and link together: your program, the GDB debugging stub for
  912.      your target architecture, and the supporting subroutines.
  913.  
  914.   4. Make sure you have a serial connection between your target machine
  915.      and the GDB host, and identify the serial port used for this on
  916.      the host.
  917.  
  918.   5. Download your program to your target machine (or get it there by
  919.      whatever means the manufacturer provides), and start it.
  920.  
  921.   6. To start remote debugging, run GDB on the host machine, and specify
  922.      as an executable file the program that is running in the remote
  923.      machine.  This tells GDB how to find your program's symbols and
  924.      the contents of its pure text.
  925.  
  926.      Then establish communication using the `target remote' command.
  927.      Its argument is the name of the device you're using to control the
  928.      target machine.  For example:
  929.  
  930.           target remote /dev/ttyb
  931.  
  932.      if the serial line is connected to the device named `/dev/ttyb'.
  933.  
  934.    Now you can use all the usual commands to examine and change data
  935. and to step and continue the remote program.
  936.  
  937.    To resume the remote program and stop debugging it, use the `detach'
  938. command.
  939.  
  940.    Whenever GDB is waiting for the remote program, if you type the
  941. interrupt character (often C-C), GDB attempts to stop the program.
  942. This may or may not succeed, depending in part on the hardware and the
  943. serial drivers the remote system uses.  If you type the interrupt
  944. character once again, GDB displays this prompt:
  945.  
  946.      Interrupted while waiting for the program.
  947.      Give up (and stop debugging it)?  (y or n)
  948.  
  949.    If you type `y', GDB abandons the remote debugging session.  (If you
  950. decide you want to try again later, you can use `target remote' again
  951. to connect once more.)  If you type `n', GDB goes back to waiting.
  952.  
  953. 
  954. File: gdb.info,  Node: Protocol,  Prev: Debug Session,  Up: Remote Serial
  955.  
  956. Outline of the communication protocol
  957. -------------------------------------
  958.  
  959.    The stub files provided with GDB implement the target side of the
  960. communication protocol, and the GDB side is implemented in the GDB
  961. source file `remote.c'.  Normally, you can simply allow these
  962. subroutines to communicate, and ignore the details.  (If you're
  963. implementing your own stub file, you can still ignore the details: start
  964. with one of the existing stub files.  `sparc-stub.c' is the best
  965. organized, and therefore the easiest to read.)
  966.  
  967.    However, there may be occasions when you need to know something about
  968. the protocol--for example, if there is only one serial port to your
  969. target machine, you might want your program to do something special if
  970. it recognizes a packet meant for GDB.
  971.  
  972.    All GDB commands and responses (other than acknowledgements, which
  973. are single characters) are sent as a packet which includes a checksum.
  974. A packet is introduced with the character `$', and ends with the
  975. character `#' followed by a two-digit checksum:
  976.  
  977.      $PACKET INFO#CHECKSUM
  978.  
  979. CHECKSUM is computed as the modulo 256 sum of the PACKET INFO
  980. characters.
  981.  
  982.    When either the host or the target machine receives a packet, the
  983. first response expected is an acknowledgement: a single character,
  984. either `+' (to indicate the package was received correctly) or `-' (to
  985. request retransmission).
  986.  
  987.    The host (GDB) sends commands, and the target (the debugging stub
  988. incorporated in your program) sends data in response.  The target also
  989. sends data when your program stops.
  990.  
  991.    Command packets are distinguished by their first character, which
  992. identifies the kind of command.
  993.  
  994.    These are the commands currently supported:
  995.  
  996. `g'
  997.      Requests the values of CPU registers.
  998.  
  999. `G'
  1000.      Sets the values of CPU registers.
  1001.  
  1002. `mADDR,COUNT'
  1003.      Read COUNT bytes at location ADDR.
  1004.  
  1005. `MADDR,COUNT:...'
  1006.      Write COUNT bytes at location ADDR.
  1007.  
  1008. `c'
  1009. `cADDR'
  1010.      Resume execution at the current address (or at ADDR if supplied).
  1011.  
  1012. `s'
  1013. `sADDR'
  1014.      Step the target program for one instruction, from either the
  1015.      current program counter or from ADDR if supplied.
  1016.  
  1017. `k'
  1018.      Kill the target program.
  1019.  
  1020. `?'
  1021.      Report the most recent signal.  To allow you to take advantage of
  1022.      the GDB signal handling commands, one of the functions of the
  1023.      debugging stub is to report CPU traps as the corresponding POSIX
  1024.      signal values.
  1025.  
  1026.    If you have trouble with the serial connection, you can use the
  1027. command `set remotedebug'.  This makes GDB report on all packets sent
  1028. back and forth across the serial line to the remote machine.  The
  1029. packet-debugging information is printed on the GDB standard output
  1030. stream.  `set remotedebug off' turns it off, and `show remotedebug'
  1031. will show you its current state.
  1032.  
  1033. 
  1034. File: gdb.info,  Node: i960-Nindy Remote,  Next: UDI29K Remote,  Prev: Remote Serial,  Up: Remote
  1035.  
  1036. GDB with a remote i960 (Nindy)
  1037. ------------------------------
  1038.  
  1039.    "Nindy" is a ROM Monitor program for Intel 960 target systems.  When
  1040. GDB is configured to control a remote Intel 960 using Nindy, you can
  1041. tell GDB how to connect to the 960 in several ways:
  1042.  
  1043.    * Through command line options specifying serial port, version of the
  1044.      Nindy protocol, and communications speed;
  1045.  
  1046.    * By responding to a prompt on startup;
  1047.  
  1048.    * By using the `target' command at any point during your GDB
  1049.      session.  *Note Commands for managing targets: Target Commands.
  1050.  
  1051. * Menu:
  1052.  
  1053. * Nindy Startup::               Startup with Nindy
  1054. * Nindy Options::               Options for Nindy
  1055. * Nindy Reset::                 Nindy reset command
  1056.  
  1057. 
  1058. File: gdb.info,  Node: Nindy Startup,  Next: Nindy Options,  Up: i960-Nindy Remote
  1059.  
  1060. Startup with Nindy
  1061. ------------------
  1062.  
  1063.    If you simply start `gdb' without using any command-line options,
  1064. you are prompted for what serial port to use, *before* you reach the
  1065. ordinary GDB prompt:
  1066.  
  1067.      Attach /dev/ttyNN -- specify NN, or "quit" to quit:
  1068.  
  1069. Respond to the prompt with whatever suffix (after `/dev/tty')
  1070. identifies the serial port you want to use.  You can, if you choose,
  1071. simply start up with no Nindy connection by responding to the prompt
  1072. with an empty line.  If you do this and later wish to attach to Nindy,
  1073. use `target' (*note Commands for managing targets: Target Commands.).
  1074.  
  1075. 
  1076. File: gdb.info,  Node: Nindy Options,  Next: Nindy Reset,  Prev: Nindy Startup,  Up: i960-Nindy Remote
  1077.  
  1078. Options for Nindy
  1079. -----------------
  1080.  
  1081.    These are the startup options for beginning your GDB session with a
  1082. Nindy-960 board attached:
  1083.  
  1084. `-r PORT'
  1085.      Specify the serial port name of a serial interface to be used to
  1086.      connect to the target system.  This option is only available when
  1087.      GDB is configured for the Intel 960 target architecture.  You may
  1088.      specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
  1089.      device name in `/dev' (e.g. `-r ttya'), or simply the unique
  1090.      suffix for a specific `tty' (e.g. `-r a').
  1091.  
  1092. `-O'
  1093.      (An uppercase letter "O", not a zero.)  Specify that GDB should use
  1094.      the "old" Nindy monitor protocol to connect to the target system.
  1095.      This option is only available when GDB is configured for the Intel
  1096.      960 target architecture.
  1097.  
  1098.           *Warning:* if you specify `-O', but are actually trying to
  1099.           connect to a target system that expects the newer protocol,
  1100.           the connection fails, appearing to be a speed mismatch.  GDB
  1101.           repeatedly attempts to reconnect at several different line
  1102.           speeds.  You can abort this process with an interrupt.
  1103.  
  1104. `-brk'
  1105.      Specify that GDB should first send a `BREAK' signal to the target
  1106.      system, in an attempt to reset it, before connecting to a Nindy
  1107.      target.
  1108.  
  1109.           *Warning:* Many target systems do not have the hardware that
  1110.           this requires; it only works with a few boards.
  1111.  
  1112.    The standard `-b' option controls the line speed used on the serial
  1113. port.
  1114.  
  1115. 
  1116. File: gdb.info,  Node: Nindy Reset,  Prev: Nindy Options,  Up: i960-Nindy Remote
  1117.  
  1118. Nindy reset command
  1119. -------------------
  1120.  
  1121. `reset'
  1122.      For a Nindy target, this command sends a "break" to the remote
  1123.      target system; this is only useful if the target has been equipped
  1124.      with a circuit to perform a hard reset (or some other interesting
  1125.      action) when a break is detected.
  1126.  
  1127. 
  1128. File: gdb.info,  Node: UDI29K Remote,  Next: EB29K Remote,  Prev: i960-Nindy Remote,  Up: Remote
  1129.  
  1130. GDB and the UDI protocol for AMD29K
  1131. -----------------------------------
  1132.  
  1133.    GDB supports AMD's UDI ("Universal Debugger Interface") protocol for
  1134. debugging the a29k processor family.  To use this configuration with
  1135. AMD targets running the MiniMON monitor, you need the program `MONTIP',
  1136. available from AMD at no charge.  You can also use GDB with the UDI
  1137. conformant a29k simulator program `ISSTIP', also available from AMD.
  1138.  
  1139. `target udi KEYWORD'
  1140.      Select the UDI interface to a remote a29k board or simulator, where
  1141.      KEYWORD is an entry in the AMD configuration file `udi_soc'.  This
  1142.      file contains keyword entries which specify parameters used to
  1143.      connect to a29k targets.  If the `udi_soc' file is not in your
  1144.      working directory, you must set the environment variable `UDICONF'
  1145.      to its pathname.
  1146.  
  1147. 
  1148. File: gdb.info,  Node: EB29K Remote,  Next: VxWorks Remote,  Prev: UDI29K Remote,  Up: Remote
  1149.  
  1150. GDB with a remote EB29K
  1151. -----------------------
  1152.  
  1153.    To use GDB from a Unix system to run programs on AMD's EB29K board
  1154. in a PC, you must first connect a serial cable between the PC and a
  1155. serial port on the Unix system.  In the following, we assume you've
  1156. hooked the cable between the PC's `COM1' port and `/dev/ttya' on the
  1157. Unix system.
  1158.  
  1159. * Menu:
  1160.  
  1161. * Comms (EB29K)::               Communications setup
  1162. * gdb-EB29K::                   EB29K cross-debugging
  1163. * Remote Log::                  Remote log
  1164.  
  1165. 
  1166. File: gdb.info,  Node: Comms (EB29K),  Next: gdb-EB29K,  Up: EB29K Remote
  1167.  
  1168. Communications setup
  1169. --------------------
  1170.  
  1171.    The next step is to set up the PC's port, by doing something like
  1172. this in DOS on the PC:
  1173.  
  1174.      C:\> MODE com1:9600,n,8,1,none
  1175.  
  1176. This example--run on an MS DOS 4.0 system--sets the PC port to 9600
  1177. bps, no parity, eight data bits, one stop bit, and no "retry" action;
  1178. you must match the communications parameters when establishing the Unix
  1179. end of the connection as well.
  1180.  
  1181.    To give control of the PC to the Unix side of the serial line, type
  1182. the following at the DOS console:
  1183.  
  1184.      C:\> CTTY com1
  1185.  
  1186. (Later, if you wish to return control to the DOS console, you can use
  1187. the command `CTTY con'--but you must send it over the device that had
  1188. control, in our example over the `COM1' serial line).
  1189.  
  1190.    From the Unix host, use a communications program such as `tip' or
  1191. `cu' to communicate with the PC; for example,
  1192.  
  1193.      cu -s 9600 -l /dev/ttya
  1194.  
  1195. The `cu' options shown specify, respectively, the linespeed and the
  1196. serial port to use.  If you use `tip' instead, your command line may
  1197. look something like the following:
  1198.  
  1199.      tip -9600 /dev/ttya
  1200.  
  1201. Your system may require a different name where we show `/dev/ttya' as
  1202. the argument to `tip'.  The communications parameters, including which
  1203. port to use, are associated with the `tip' argument in the "remote"
  1204. descriptions file--normally the system table `/etc/remote'.
  1205.  
  1206.    Using the `tip' or `cu' connection, change the DOS working directory
  1207. to the directory containing a copy of your 29K program, then start the
  1208. PC program `EBMON' (an EB29K control program supplied with your board
  1209. by AMD).  You should see an initial display from `EBMON' similar to the
  1210. one that follows, ending with the `EBMON' prompt `#'--
  1211.  
  1212.      C:\> G:
  1213.      
  1214.      G:\> CD \usr\joe\work29k
  1215.      
  1216.      G:\USR\JOE\WORK29K> EBMON
  1217.      Am29000 PC Coprocessor Board Monitor, version 3.0-18
  1218.      Copyright 1990 Advanced Micro Devices, Inc.
  1219.      Written by Gibbons and Associates, Inc.
  1220.      
  1221.      Enter '?' or 'H' for help
  1222.      
  1223.      PC Coprocessor Type   = EB29K
  1224.      I/O Base              = 0x208
  1225.      Memory Base           = 0xd0000
  1226.      
  1227.      Data Memory Size      = 2048KB
  1228.      Available I-RAM Range = 0x8000 to 0x1fffff
  1229.      Available D-RAM Range = 0x80002000 to 0x801fffff
  1230.      
  1231.      PageSize              = 0x400
  1232.      Register Stack Size   = 0x800
  1233.      Memory Stack Size     = 0x1800
  1234.      
  1235.      CPU PRL               = 0x3
  1236.      Am29027 Available     = No
  1237.      Byte Write Available  = Yes
  1238.      
  1239.      # ~.
  1240.  
  1241.    Then exit the `cu' or `tip' program (done in the example by typing
  1242. `~.' at the `EBMON' prompt).  `EBMON' will keep running, ready for GDB
  1243. to take over.
  1244.  
  1245.    For this example, we've assumed what is probably the most convenient
  1246. way to make sure the same 29K program is on both the PC and the Unix
  1247. system: a PC/NFS connection that establishes "drive `G:'" on the PC as
  1248. a file system on the Unix host.  If you do not have PC/NFS or something
  1249. similar connecting the two systems, you must arrange some other
  1250. way--perhaps floppy-disk transfer--of getting the 29K program from the
  1251. Unix system to the PC; GDB will *not* download it over the serial line.
  1252.  
  1253.