home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / gdb.info-6 < prev    next >
Encoding:
GNU Info File  |  1995-03-04  |  49.5 KB  |  1,307 lines

  1. This is Info file ./gdb.info, produced by Makeinfo-1.55 from the input
  2. file gdb.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                     The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.12, January 1994, of `Debugging with GDB: the GNU
  10. Source-Level Debugger' for GDB Version 4.14.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free
  13. Software Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of this
  16. manual provided the copyright notice and this permission notice are
  17. preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the entire resulting derived work is distributed under the terms
  22. of a permission notice identical to this one.
  23.  
  24.    Permission is granted to copy and distribute translations of this
  25. manual into another language, under the above conditions for modified
  26. versions.
  27.  
  28. 
  29. File: gdb.info,  Node: Bootstrapping,  Next: Debug Session,  Prev: Stub Contents,  Up: Remote Serial
  30.  
  31. What you must do for the stub
  32. .............................
  33.  
  34.    The debugging stubs that come with GDB are set up for a particular
  35. chip architecture, but they have no information about the rest of your
  36. debugging target machine.
  37.  
  38.    First of all you need to tell the stub how to communicate with the
  39. serial port.
  40.  
  41. `int getDebugChar()'
  42.      Write this subroutine to read a single character from the serial
  43.      port.  It may be identical to `getchar' for your target system; a
  44.      different name is used to allow you to distinguish the two if you
  45.      wish.
  46.  
  47. `void putDebugChar(int)'
  48.      Write this subroutine to write a single character to the serial
  49.      port.  It may be identical to `putchar' for your target system; a
  50.      different name is used to allow you to distinguish the two if you
  51.      wish.
  52.  
  53.    If you want GDB to be able to stop your program while it is running,
  54. you need to use an interrupt-driven serial driver, and arrange for it
  55. to stop when it receives a `^C' (`\003', the control-C character).
  56. That is the character which GDB uses to tell the remote system to stop.
  57.  
  58.    Getting the debugging target to return the proper status to GDB
  59. probably requires changes to the standard stub; one quick and dirty way
  60. is to just execute a breakpoint instruction (the "dirty" part is that
  61. GDB reports a `SIGTRAP' instead of a `SIGINT').
  62.  
  63.    Other routines you need to supply are:
  64.  
  65. `void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
  66.      Write this function to install EXCEPTION_ADDRESS in the exception
  67.      handling tables.  You need to do this because the stub does not
  68.      have any way of knowing what the exception handling tables on your
  69.      target system are like (for example, the processor's table might
  70.      be in ROM, containing entries which point to a table in RAM).
  71.      eXCEPTION_NUMBER is the exception number which should be changed;
  72.      its meaning is architecture-dependent (for example, different
  73.      numbers might represent divide by zero, misaligned access, etc).
  74.      When this exception occurs, control should be transferred directly
  75.      to EXCEPTION_ADDRESS, and the processor state (stack, registers,
  76.      and so on) should be just as it is when a processor exception
  77.      occurs.  So if you want to use a jump instruction to reach
  78.      EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
  79.      subroutine.
  80.  
  81.      For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
  82.      gate so that interrupts are masked while the handler runs.  The
  83.      gate should be at privilege level 0 (the most privileged level).
  84.      The SPARC and 68k stubs are able to mask interrupts themself
  85.      without help from `exceptionHandler'.
  86.  
  87. `void flush_i_cache()'
  88.      Write this subroutine to flush the instruction cache, if any, on
  89.      your target machine.  If there is no instruction cache, this
  90.      subroutine may be a no-op.
  91.  
  92.      On target machines that have instruction caches, GDB requires this
  93.      function to make certain that the state of your program is stable.
  94.  
  95. You must also make sure this library routine is available:
  96.  
  97. `void *memset(void *, int, int)'
  98.      This is the standard library function `memset' that sets an area of
  99.      memory to a known value.  If you have one of the free versions of
  100.      `libc.a', `memset' can be found there; otherwise, you must either
  101.      obtain it from your hardware manufacturer, or write your own.
  102.  
  103.    If you do not use the GNU C compiler, you may need other standard
  104. library subroutines as well; this varies from one stub to another, but
  105. in general the stubs are likely to use any of the common library
  106. subroutines which `gcc' generates as inline code.
  107.  
  108. 
  109. File: gdb.info,  Node: Debug Session,  Next: Protocol,  Prev: Bootstrapping,  Up: Remote Serial
  110.  
  111. Putting it all together
  112. .......................
  113.  
  114.    In summary, when your program is ready to debug, you must follow
  115. these steps.
  116.  
  117.   1. Make sure you have the supporting low-level routines (*note What
  118.      you must do for the stub: Bootstrapping.):
  119.           `getDebugChar', `putDebugChar',
  120.           `flush_i_cache', `memset', `exceptionHandler'.
  121.  
  122.   2. Insert these lines near the top of your program:
  123.  
  124.           set_debug_traps();
  125.           breakpoint();
  126.  
  127.   3. For the 680x0 stub only, you need to provide a variable called
  128.      `exceptionHook'.  Normally you just use
  129.  
  130.           void (*exceptionHook)() = 0;
  131.  
  132.      but if before calling `set_debug_traps', you set it to point to a
  133.      function in your program, that function is called when `GDB'
  134.      continues after stopping on a trap (for example, bus error).  The
  135.      function indicated by `exceptionHook' is called with one
  136.      parameter: an `int' which is the exception number.
  137.  
  138.   4. Compile and link together: your program, the GDB debugging stub for
  139.      your target architecture, and the supporting subroutines.
  140.  
  141.   5. Make sure you have a serial connection between your target machine
  142.      and the GDB host, and identify the serial port used for this on
  143.      the host.
  144.  
  145.   6. Download your program to your target machine (or get it there by
  146.      whatever means the manufacturer provides), and start it.
  147.  
  148.   7. To start remote debugging, run GDB on the host machine, and specify
  149.      as an executable file the program that is running in the remote
  150.      machine.  This tells GDB how to find your program's symbols and
  151.      the contents of its pure text.
  152.  
  153.      Then establish communication using the `target remote' command.
  154.      Its argument specifies how to communicate with the target
  155.      machine--either via a devicename attached to a direct serial line,
  156.      or a TCP port (usually to a terminal server which in turn has a
  157.      serial line to the target).  For example, to use a serial line
  158.      connected to the device named `/dev/ttyb':
  159.  
  160.           target remote /dev/ttyb
  161.  
  162.      To use a TCP connection, use an argument of the form `HOST:port'.
  163.      For example, to connect to port 2828 on a terminal server named
  164.      `manyfarms':
  165.  
  166.           target remote manyfarms:2828
  167.  
  168.    Now you can use all the usual commands to examine and change data
  169. and to step and continue the remote program.
  170.  
  171.    To resume the remote program and stop debugging it, use the `detach'
  172. command.
  173.  
  174.    Whenever GDB is waiting for the remote program, if you type the
  175. interrupt character (often C-C), GDB attempts to stop the program.
  176. This may or may not succeed, depending in part on the hardware and the
  177. serial drivers the remote system uses.  If you type the interrupt
  178. character once again, GDB displays this prompt:
  179.  
  180.      Interrupted while waiting for the program.
  181.      Give up (and stop debugging it)?  (y or n)
  182.  
  183.    If you type `y', GDB abandons the remote debugging session.  (If you
  184. decide you want to try again later, you can use `target remote' again
  185. to connect once more.)  If you type `n', GDB goes back to waiting.
  186.  
  187. 
  188. File: gdb.info,  Node: Protocol,  Next: Server,  Prev: Debug Session,  Up: Remote Serial
  189.  
  190. Communication protocol
  191. ......................
  192.  
  193.    The stub files provided with GDB implement the target side of the
  194. communication protocol, and the GDB side is implemented in the GDB
  195. source file `remote.c'.  Normally, you can simply allow these
  196. subroutines to communicate, and ignore the details.  (If you're
  197. implementing your own stub file, you can still ignore the details: start
  198. with one of the existing stub files.  `sparc-stub.c' is the best
  199. organized, and therefore the easiest to read.)
  200.  
  201.    However, there may be occasions when you need to know something about
  202. the protocol--for example, if there is only one serial port to your
  203. target machine, you might want your program to do something special if
  204. it recognizes a packet meant for GDB.
  205.  
  206.    All GDB commands and responses (other than acknowledgements, which
  207. are single characters) are sent as a packet which includes a checksum.
  208. A packet is introduced with the character `$', and ends with the
  209. character `#' followed by a two-digit checksum:
  210.  
  211.      $PACKET INFO#CHECKSUM
  212.  
  213. CHECKSUM is computed as the modulo 256 sum of the PACKET INFO
  214. characters.
  215.  
  216.    When either the host or the target machine receives a packet, the
  217. first response expected is an acknowledgement: a single character,
  218. either `+' (to indicate the package was received correctly) or `-' (to
  219. request retransmission).
  220.  
  221.    The host (GDB) sends commands, and the target (the debugging stub
  222. incorporated in your program) sends data in response.  The target also
  223. sends data when your program stops.
  224.  
  225.    Command packets are distinguished by their first character, which
  226. identifies the kind of command.
  227.  
  228.    These are the commands currently supported:
  229.  
  230. `g'
  231.      Requests the values of CPU registers.
  232.  
  233. `G'
  234.      Sets the values of CPU registers.
  235.  
  236. `mADDR,COUNT'
  237.      Read COUNT bytes at location ADDR.
  238.  
  239. `MADDR,COUNT:...'
  240.      Write COUNT bytes at location ADDR.
  241.  
  242. `c'
  243. `cADDR'
  244.      Resume execution at the current address (or at ADDR if supplied).
  245.  
  246. `s'
  247. `sADDR'
  248.      Step the target program for one instruction, from either the
  249.      current program counter or from ADDR if supplied.
  250.  
  251. `k'
  252.      Kill the target program.
  253.  
  254. `?'
  255.      Report the most recent signal.  To allow you to take advantage of
  256.      the GDB signal handling commands, one of the functions of the
  257.      debugging stub is to report CPU traps as the corresponding POSIX
  258.      signal values.
  259.  
  260.    If you have trouble with the serial connection, you can use the
  261. command `set remotedebug'.  This makes GDB report on all packets sent
  262. back and forth across the serial line to the remote machine.  The
  263. packet-debugging information is printed on the GDB standard output
  264. stream.  `set remotedebug off' turns it off, and `show remotedebug'
  265. shows you its current state.
  266.  
  267. 
  268. File: gdb.info,  Node: Server,  Prev: Protocol,  Up: Remote Serial
  269.  
  270. Using the `gdbserver' program
  271. .............................
  272.  
  273.    `gdbserver' is a control program for Unix-like systems, which allows
  274. you to connect your program with a remote GDB via `target remote'--but
  275. without linking in the usual debugging stub.
  276.  
  277.    `gdbserver' is not a complete replacement for the debugging stubs,
  278. because it requires essentially the same operating-system facilities
  279. that GDB itself does.  In fact, a system that can run `gdbserver' to
  280. connect to a remote GDB could also run GDB locally!  `gdbserver' is
  281. sometimes useful nevertheless, because it is a much smaller program
  282. than GDB itself.  It is also easier to port than all of GDB, so you may
  283. be able to get started more quickly on a new system by using
  284. `gdbserver'.  Finally, if you develop code for real-time systems, you
  285. may find that the tradeoffs involved in real-time operation make it
  286. more convenient to do as much development work as possible on another
  287. system, for example by cross-compiling.  You can use `gdbserver' to
  288. make a similar choice for debugging.
  289.  
  290.    GDB and `gdbserver' communicate via either a serial line or a TCP
  291. connection, using the standard GDB remote serial protocol.
  292.  
  293. *On the target machine,*
  294.      you need to have a copy of the program you want to debug.
  295.      `gdbserver' does not need your program's symbol table, so you can
  296.      strip the program if necessary to save space.  GDB on the host
  297.      system does all the symbol handling.
  298.  
  299.      To use the server, you must tell it how to communicate with GDB;
  300.      the name of your program; and the arguments for your program.  The
  301.      syntax is:
  302.  
  303.           target> gdbserver COMM PROGRAM [ ARGS ... ]
  304.  
  305.      COMM is either a device name (to use a serial line) or a TCP
  306.      hostname and portnumber.  For example, to debug Emacs with the
  307.      argument `foo.txt' and communicate with GDB over the serial port
  308.      `/dev/com1':
  309.  
  310.           target> gdbserver /dev/com1 emacs foo.txt
  311.  
  312.      `gdbserver' waits passively for the host GDB to communicate with
  313.      it.
  314.  
  315.      To use a TCP connection instead of a serial line:
  316.  
  317.           target> gdbserver host:2345 emacs foo.txt
  318.  
  319.      The only difference from the previous example is the first
  320.      argument, specifying that you are communicating with the host GDB
  321.      via TCP.  The `host:2345' argument means that `gdbserver' is to
  322.      expect a TCP connection from machine `host' to local TCP port 2345.
  323.      (Currently, the `host' part is ignored.)  You can choose any number
  324.      you want for the port number as long as it does not conflict with
  325.      any TCP ports already in use on the target system (for example,
  326.      `23' is reserved for `telnet').(1) You must use the same port
  327.      number with the host GDB `target remote' command.
  328.  
  329. *On the GDB host machine,*
  330.      you need an unstripped copy of your program, since GDB needs
  331.      symbols and debugging information.  Start up GDB as usual, using
  332.      the name of the local copy of your program as the first argument.
  333.      (You may also need the `--baud' option if the serial line is
  334.      running at anything other than 9600 bps.)  After that, use `target
  335.      remote' to establish communications with `gdbserver'.  Its argument
  336.      is either a device name (usually a serial device, like
  337.      `/dev/ttyb'), or a TCP port descriptor in the form `HOST:PORT'.
  338.      For example:
  339.  
  340.           (gdb) target remote /dev/ttyb
  341.  
  342.      communicates with the server via serial line `/dev/ttyb', and
  343.  
  344.           (gdb) target remote the-target:2345
  345.  
  346.      communicates via a TCP connection to port 2345 on host
  347.      `the-target'.  For TCP connections, you must start up `gdbserver'
  348.      prior to using the `target remote' command.  Otherwise you may get
  349.      an error whose text depends on the host system, but which usually
  350.      looks something like `Connection refused'.
  351.  
  352.    ---------- Footnotes ----------
  353.  
  354.    (1)  If you choose a port number that conflicts with another
  355. service, `gdbserver' prints an error message and exits.
  356.  
  357. 
  358. File: gdb.info,  Node: i960-Nindy Remote,  Next: UDI29K Remote,  Prev: Remote Serial,  Up: Remote
  359.  
  360. GDB with a remote i960 (Nindy)
  361. ------------------------------
  362.  
  363.    "Nindy" is a ROM Monitor program for Intel 960 target systems.  When
  364. GDB is configured to control a remote Intel 960 using Nindy, you can
  365. tell GDB how to connect to the 960 in several ways:
  366.  
  367.    * Through command line options specifying serial port, version of the
  368.      Nindy protocol, and communications speed;
  369.  
  370.    * By responding to a prompt on startup;
  371.  
  372.    * By using the `target' command at any point during your GDB
  373.      session.  *Note Commands for managing targets: Target Commands.
  374.  
  375. * Menu:
  376.  
  377. * Nindy Startup::               Startup with Nindy
  378. * Nindy Options::               Options for Nindy
  379. * Nindy Reset::                 Nindy reset command
  380.  
  381. 
  382. File: gdb.info,  Node: Nindy Startup,  Next: Nindy Options,  Up: i960-Nindy Remote
  383.  
  384. Startup with Nindy
  385. ..................
  386.  
  387.    If you simply start `gdb' without using any command-line options,
  388. you are prompted for what serial port to use, *before* you reach the
  389. ordinary GDB prompt:
  390.  
  391.      Attach /dev/ttyNN -- specify NN, or "quit" to quit:
  392.  
  393. Respond to the prompt with whatever suffix (after `/dev/tty')
  394. identifies the serial port you want to use.  You can, if you choose,
  395. simply start up with no Nindy connection by responding to the prompt
  396. with an empty line.  If you do this and later wish to attach to Nindy,
  397. use `target' (*note Commands for managing targets: Target Commands.).
  398.  
  399. 
  400. File: gdb.info,  Node: Nindy Options,  Next: Nindy Reset,  Prev: Nindy Startup,  Up: i960-Nindy Remote
  401.  
  402. Options for Nindy
  403. .................
  404.  
  405.    These are the startup options for beginning your GDB session with a
  406. Nindy-960 board attached:
  407.  
  408. `-r PORT'
  409.      Specify the serial port name of a serial interface to be used to
  410.      connect to the target system.  This option is only available when
  411.      GDB is configured for the Intel 960 target architecture.  You may
  412.      specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
  413.      device name in `/dev' (e.g. `-r ttya'), or simply the unique
  414.      suffix for a specific `tty' (e.g. `-r a').
  415.  
  416. `-O'
  417.      (An uppercase letter "O", not a zero.)  Specify that GDB should use
  418.      the "old" Nindy monitor protocol to connect to the target system.
  419.      This option is only available when GDB is configured for the Intel
  420.      960 target architecture.
  421.  
  422.           *Warning:* if you specify `-O', but are actually trying to
  423.           connect to a target system that expects the newer protocol,
  424.           the connection fails, appearing to be a speed mismatch.  GDB
  425.           repeatedly attempts to reconnect at several different line
  426.           speeds.  You can abort this process with an interrupt.
  427.  
  428. `-brk'
  429.      Specify that GDB should first send a `BREAK' signal to the target
  430.      system, in an attempt to reset it, before connecting to a Nindy
  431.      target.
  432.  
  433.           *Warning:* Many target systems do not have the hardware that
  434.           this requires; it only works with a few boards.
  435.  
  436.    The standard `-b' option controls the line speed used on the serial
  437. port.
  438.  
  439. 
  440. File: gdb.info,  Node: Nindy Reset,  Prev: Nindy Options,  Up: i960-Nindy Remote
  441.  
  442. Nindy reset command
  443. ...................
  444.  
  445. `reset'
  446.      For a Nindy target, this command sends a "break" to the remote
  447.      target system; this is only useful if the target has been equipped
  448.      with a circuit to perform a hard reset (or some other interesting
  449.      action) when a break is detected.
  450.  
  451. 
  452. File: gdb.info,  Node: UDI29K Remote,  Next: EB29K Remote,  Prev: i960-Nindy Remote,  Up: Remote
  453.  
  454. The UDI protocol for AMD29K
  455. ---------------------------
  456.  
  457.    GDB supports AMD's UDI ("Universal Debugger Interface") protocol for
  458. debugging the a29k processor family.  To use this configuration with
  459. AMD targets running the MiniMON monitor, you need the program `MONTIP',
  460. available from AMD at no charge.  You can also use GDB with the UDI
  461. conformant a29k simulator program `ISSTIP', also available from AMD.
  462.  
  463. `target udi KEYWORD'
  464.      Select the UDI interface to a remote a29k board or simulator, where
  465.      KEYWORD is an entry in the AMD configuration file `udi_soc'.  This
  466.      file contains keyword entries which specify parameters used to
  467.      connect to a29k targets.  If the `udi_soc' file is not in your
  468.      working directory, you must set the environment variable `UDICONF'
  469.      to its pathname.
  470.  
  471. 
  472. File: gdb.info,  Node: EB29K Remote,  Next: VxWorks Remote,  Prev: UDI29K Remote,  Up: Remote
  473.  
  474. The EBMON protocol for AMD29K
  475. -----------------------------
  476.  
  477.    AMD distributes a 29K development board meant to fit in a PC,
  478. together with a DOS-hosted monitor program called `EBMON'.  As a
  479. shorthand term, this development system is called the "EB29K".  To use
  480. GDB from a Unix system to run programs on the EB29K board, you must
  481. first connect a serial cable between the PC (which hosts the EB29K
  482. board) and a serial port on the Unix system.  In the following, we
  483. assume you've hooked the cable between the PC's `COM1' port and
  484. `/dev/ttya' on the Unix system.
  485.  
  486. * Menu:
  487.  
  488. * Comms (EB29K)::               Communications setup
  489. * gdb-EB29K::                   EB29K cross-debugging
  490. * Remote Log::                  Remote log
  491.  
  492. 
  493. File: gdb.info,  Node: Comms (EB29K),  Next: gdb-EB29K,  Up: EB29K Remote
  494.  
  495. Communications setup
  496. ....................
  497.  
  498.    The next step is to set up the PC's port, by doing something like
  499. this in DOS on the PC:
  500.  
  501.      C:\> MODE com1:9600,n,8,1,none
  502.  
  503. This example--run on an MS DOS 4.0 system--sets the PC port to 9600
  504. bps, no parity, eight data bits, one stop bit, and no "retry" action;
  505. you must match the communications parameters when establishing the Unix
  506. end of the connection as well.
  507.  
  508.    To give control of the PC to the Unix side of the serial line, type
  509. the following at the DOS console:
  510.  
  511.      C:\> CTTY com1
  512.  
  513. (Later, if you wish to return control to the DOS console, you can use
  514. the command `CTTY con'--but you must send it over the device that had
  515. control, in our example over the `COM1' serial line).
  516.  
  517.    From the Unix host, use a communications program such as `tip' or
  518. `cu' to communicate with the PC; for example,
  519.  
  520.      cu -s 9600 -l /dev/ttya
  521.  
  522. The `cu' options shown specify, respectively, the linespeed and the
  523. serial port to use.  If you use `tip' instead, your command line may
  524. look something like the following:
  525.  
  526.      tip -9600 /dev/ttya
  527.  
  528. Your system may require a different name where we show `/dev/ttya' as
  529. the argument to `tip'.  The communications parameters, including which
  530. port to use, are associated with the `tip' argument in the "remote"
  531. descriptions file--normally the system table `/etc/remote'.
  532.  
  533.    Using the `tip' or `cu' connection, change the DOS working directory
  534. to the directory containing a copy of your 29K program, then start the
  535. PC program `EBMON' (an EB29K control program supplied with your board
  536. by AMD).  You should see an initial display from `EBMON' similar to the
  537. one that follows, ending with the `EBMON' prompt `#'--
  538.  
  539.      C:\> G:
  540.      
  541.      G:\> CD \usr\joe\work29k
  542.      
  543.      G:\USR\JOE\WORK29K> EBMON
  544.      Am29000 PC Coprocessor Board Monitor, version 3.0-18
  545.      Copyright 1990 Advanced Micro Devices, Inc.
  546.      Written by Gibbons and Associates, Inc.
  547.      
  548.      Enter '?' or 'H' for help
  549.      
  550.      PC Coprocessor Type   = EB29K
  551.      I/O Base              = 0x208
  552.      Memory Base           = 0xd0000
  553.      
  554.      Data Memory Size      = 2048KB
  555.      Available I-RAM Range = 0x8000 to 0x1fffff
  556.      Available D-RAM Range = 0x80002000 to 0x801fffff
  557.      
  558.      PageSize              = 0x400
  559.      Register Stack Size   = 0x800
  560.      Memory Stack Size     = 0x1800
  561.      
  562.      CPU PRL               = 0x3
  563.      Am29027 Available     = No
  564.      Byte Write Available  = Yes
  565.      
  566.      # ~.
  567.  
  568.    Then exit the `cu' or `tip' program (done in the example by typing
  569. `~.' at the `EBMON' prompt).  `EBMON' keeps running, ready for GDB to
  570. take over.
  571.  
  572.    For this example, we've assumed what is probably the most convenient
  573. way to make sure the same 29K program is on both the PC and the Unix
  574. system: a PC/NFS connection that establishes "drive `G:'" on the PC as
  575. a file system on the Unix host.  If you do not have PC/NFS or something
  576. similar connecting the two systems, you must arrange some other
  577. way--perhaps floppy-disk transfer--of getting the 29K program from the
  578. Unix system to the PC; GDB does *not* download it over the serial line.
  579.  
  580. 
  581. File: gdb.info,  Node: gdb-EB29K,  Next: Remote Log,  Prev: Comms (EB29K),  Up: EB29K Remote
  582.  
  583. EB29K cross-debugging
  584. .....................
  585.  
  586.    Finally, `cd' to the directory containing an image of your 29K
  587. program on the Unix system, and start GDB--specifying as argument the
  588. name of your 29K program:
  589.  
  590.      cd /usr/joe/work29k
  591.      gdb myfoo
  592.  
  593.    Now you can use the `target' command:
  594.  
  595.      target amd-eb /dev/ttya 9600 MYFOO
  596.  
  597. In this example, we've assumed your program is in a file called
  598. `myfoo'.  Note that the filename given as the last argument to `target
  599. amd-eb' should be the name of the program as it appears to DOS.  In our
  600. example this is simply `MYFOO', but in general it can include a DOS
  601. path, and depending on your transfer mechanism may not resemble the
  602. name on the Unix side.
  603.  
  604.    At this point, you can set any breakpoints you wish; when you are
  605. ready to see your program run on the 29K board, use the GDB command
  606. `run'.
  607.  
  608.    To stop debugging the remote program, use the GDB `detach' command.
  609.  
  610.    To return control of the PC to its console, use `tip' or `cu' once
  611. again, after your GDB session has concluded, to attach to `EBMON'.  You
  612. can then type the command `q' to shut down `EBMON', returning control
  613. to the DOS command-line interpreter.  Type `CTTY con' to return command
  614. input to the main DOS console, and type `~.' to leave `tip' or `cu'.
  615.  
  616. 
  617. File: gdb.info,  Node: Remote Log,  Prev: gdb-EB29K,  Up: EB29K Remote
  618.  
  619. Remote log
  620. ..........
  621.  
  622.    The `target amd-eb' command creates a file `eb.log' in the current
  623. working directory, to help debug problems with the connection.
  624. `eb.log' records all the output from `EBMON', including echoes of the
  625. commands sent to it.  Running `tail -f' on this file in another window
  626. often helps to understand trouble with `EBMON', or unexpected events on
  627. the PC side of the connection.
  628.  
  629. 
  630. File: gdb.info,  Node: ST2000 Remote,  Next: Hitachi Remote,  Prev: VxWorks Remote,  Up: Remote
  631.  
  632. GDB with a Tandem ST2000
  633. ------------------------
  634.  
  635.    To connect your ST2000 to the host system, see the manufacturer's
  636. manual.  Once the ST2000 is physically attached, you can run
  637.  
  638.      target st2000 DEV SPEED
  639.  
  640. to establish it as your debugging environment.  DEV is normally the
  641. name of a serial device, such as `/dev/ttya', connected to the ST2000
  642. via a serial line.  You can instead specify DEV as a TCP connection
  643. (for example, to a serial line attached via a terminal concentrator)
  644. using the syntax `HOSTNAME:PORTNUMBER'.
  645.  
  646.    The `load' and `attach' commands are *not* defined for this target;
  647. you must load your program into the ST2000 as you normally would for
  648. standalone operation.  GDB reads debugging information (such as
  649. symbols) from a separate, debugging version of the program available on
  650. your host computer.
  651.  
  652.    These auxiliary GDB commands are available to help you with the
  653. ST2000 environment:
  654.  
  655. `st2000 COMMAND'
  656.      Send a COMMAND to the STDBUG monitor.  See the manufacturer's
  657.      manual for available commands.
  658.  
  659. `connect'
  660.      Connect the controlling terminal to the STDBUG command monitor.
  661.      When you are done interacting with STDBUG, typing either of two
  662.      character sequences gets you back to the GDB command prompt:
  663.      `RET~.' (Return, followed by tilde and period) or `RET~C-d'
  664.      (Return, followed by tilde and control-D).
  665.  
  666. 
  667. File: gdb.info,  Node: VxWorks Remote,  Next: ST2000 Remote,  Prev: EB29K Remote,  Up: Remote
  668.  
  669. GDB and VxWorks
  670. ---------------
  671.  
  672.    GDB enables developers to spawn and debug tasks running on networked
  673. VxWorks targets from a Unix host.  Already-running tasks spawned from
  674. the VxWorks shell can also be debugged.  GDB uses code that runs on
  675. both the Unix host and on the VxWorks target.  The program `gdb' is
  676. installed and executed on the Unix host.  (It may be installed with the
  677. name `vxgdb', to distinguish it from a GDB for debugging programs on
  678. the host itself.)
  679.  
  680.    The following information on connecting to VxWorks was current when
  681. this manual was produced; newer releases of VxWorks may use revised
  682. procedures.
  683.  
  684.    To use GDB with VxWorks, you must rebuild your VxWorks kernel to
  685. include the remote debugging interface routines in the VxWorks library
  686. `rdb.a'.  To do this, define `INCLUDE_RDB' in the VxWorks configuration
  687. file `configAll.h' and rebuild your VxWorks kernel.  The resulting
  688. kernel contains `rdb.a', and spawns the source debugging task
  689. `tRdbTask' when VxWorks is booted.  For more information on configuring
  690. and remaking VxWorks, see the manufacturer's manual.
  691.  
  692.    Once you have included `rdb.a' in your VxWorks system image and set
  693. your Unix execution search path to find GDB, you are ready to run GDB.
  694. From your Unix host, run `gdb' (or `vxgdb', depending on your
  695. installation).
  696.  
  697.    GDB comes up showing the prompt:
  698.  
  699.      (vxgdb)
  700.  
  701. * Menu:
  702.  
  703. * VxWorks Connection::          Connecting to VxWorks
  704. * VxWorks Download::            VxWorks download
  705. * VxWorks Attach::              Running tasks
  706.  
  707. 
  708. File: gdb.info,  Node: VxWorks Connection,  Next: VxWorks Download,  Up: VxWorks Remote
  709.  
  710. Connecting to VxWorks
  711. .....................
  712.  
  713.    The GDB command `target' lets you connect to a VxWorks target on the
  714. network.  To connect to a target whose host name is "`tt'", type:
  715.  
  716.      (vxgdb) target vxworks tt
  717.  
  718.    GDB displays messages like these:
  719.  
  720.      Attaching remote machine across net...
  721.      Connected to tt.
  722.  
  723.    GDB then attempts to read the symbol tables of any object modules
  724. loaded into the VxWorks target since it was last booted.  GDB locates
  725. these files by searching the directories listed in the command search
  726. path (*note Your program's environment: Environment.); if it fails to
  727. find an object file, it displays a message such as:
  728.  
  729.      prog.o: No such file or directory.
  730.  
  731.    When this happens, add the appropriate directory to the search path
  732. with the GDB command `path', and execute the `target' command again.
  733.  
  734. 
  735. File: gdb.info,  Node: VxWorks Download,  Next: VxWorks Attach,  Prev: VxWorks Connection,  Up: VxWorks Remote
  736.  
  737. VxWorks download
  738. ................
  739.  
  740.    If you have connected to the VxWorks target and you want to debug an
  741. object that has not yet been loaded, you can use the GDB `load' command
  742. to download a file from Unix to VxWorks incrementally.  The object file
  743. given as an argument to the `load' command is actually opened twice:
  744. first by the VxWorks target in order to download the code, then by GDB
  745. in order to read the symbol table.  This can lead to problems if the
  746. current working directories on the two systems differ.  If both systems
  747. have NFS mounted the same filesystems, you can avoid these problems by
  748. using absolute paths.  Otherwise, it is simplest to set the working
  749. directory on both systems to the directory in which the object file
  750. resides, and then to reference the file by its name, without any path.
  751. For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
  752. VxWorks and in `HOSTPATH/vw/demo/rdb' on the host.  To load this
  753. program, type this on VxWorks:
  754.  
  755.      -> cd "VXPATH/vw/demo/rdb"
  756.  
  757.    Then, in GDB, type:
  758.  
  759.      (vxgdb) cd HOSTPATH/vw/demo/rdb
  760.      (vxgdb) load prog.o
  761.  
  762.    GDB displays a response similar to this:
  763.  
  764.      Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
  765.  
  766.    You can also use the `load' command to reload an object module after
  767. editing and recompiling the corresponding source file.  Note that this
  768. makes GDB delete all currently-defined breakpoints, auto-displays, and
  769. convenience variables, and to clear the value history.  (This is
  770. necessary in order to preserve the integrity of debugger data
  771. structures that reference the target system's symbol table.)
  772.  
  773. 
  774. File: gdb.info,  Node: VxWorks Attach,  Prev: VxWorks Download,  Up: VxWorks Remote
  775.  
  776. Running tasks
  777. .............
  778.  
  779.    You can also attach to an existing task using the `attach' command as
  780. follows:
  781.  
  782.      (vxgdb) attach TASK
  783.  
  784. where TASK is the VxWorks hexadecimal task ID.  The task can be running
  785. or suspended when you attach to it.  Running tasks are suspended at the
  786. time of attachment.
  787.  
  788. 
  789. File: gdb.info,  Node: Hitachi Remote,  Next: MIPS Remote,  Prev: ST2000 Remote,  Up: Remote
  790.  
  791. GDB and Hitachi microprocessors
  792. -------------------------------
  793.  
  794.    GDB needs to know these things to talk to your Hitachi SH, H8/300,
  795. or H8/500:
  796.  
  797.   1. that you want to use `target hms', the remote debugging interface
  798.      for Hitachi microprocessors, or `target e7000', the in-circuit
  799.      emulator for the Hitachi SH and the Hitachi 300H.  (`target hms' is
  800.      the default when GDB is configured specifically for the Hitachi SH,
  801.      H8/300, or H8/500.)
  802.  
  803.   2. what serial device connects your host to your Hitachi board (the
  804.      first serial device available on your host is the default).
  805.  
  806.   3. what speed to use over the serial device.
  807.  
  808. * Menu:
  809.  
  810. * Hitachi Boards::      Connecting to Hitachi boards.
  811. * Hitachi ICE::         Using the E7000 In-Circuit Emulator.
  812. * Hitachi Special::     Special GDB commands for Hitachi micros.
  813.  
  814. 
  815. File: gdb.info,  Node: Hitachi Boards,  Next: Hitachi ICE,  Up: Hitachi Remote
  816.  
  817. Connecting to Hitachi boards
  818. ............................
  819.  
  820.    Use the special `gdb' command `device PORT' if you need to
  821. explicitly set the serial device.  The default PORT is the first
  822. available port on your host.  This is only necessary on Unix hosts,
  823. where it is typically something like `/dev/ttya'.
  824.  
  825.    `gdb' has another special command to set the communications speed:
  826. `speed BPS'.  This command also is only used from Unix hosts; on DOS
  827. hosts, set the line speed as usual from outside GDB with the DOS `mode'
  828. command (for instance, `mode com2:9600,n,8,1,p' for a 9600 bps
  829. connection).
  830.  
  831.    The `device' and `speed' commands are available only when you use a
  832. Unix host to debug your Hitachi microprocessor programs.  If you use a
  833. DOS host, GDB depends on an auxiliary terminate-and-stay-resident
  834. program called `asynctsr' to communicate with the development board
  835. through a PC serial port.  You must also use the DOS `mode' command to
  836. set up the serial port on the DOS side.
  837.  
  838. 
  839. File: gdb.info,  Node: Hitachi ICE,  Next: Hitachi Special,  Prev: Hitachi Boards,  Up: Hitachi Remote
  840.  
  841. Using the E7000 in-circuit emulator
  842. ...................................
  843.  
  844.    You can use the E7000 in-circuit emulator to develop code for either
  845. the Hitachi SH or the H8/300H.  Use one of these forms of the `target
  846. e7000' command to connect GDB to your E7000:
  847.  
  848. `target e7000 PORT SPEED'
  849.      Use this form if your E7000 is connected to a serial port.  The
  850.      PORT argument identifies what serial port to use (for example,
  851.      `com2').  The third argument is the line speed in bits per second
  852.      (for example, `9600').
  853.  
  854. `target e7000 HOSTNAME'
  855.      If your E7000 is installed as a host on a TCP/IP network, you can
  856.      just specify its hostname; GDB uses `telnet' to connect.
  857.  
  858. 
  859. File: gdb.info,  Node: Hitachi Special,  Prev: Hitachi ICE,  Up: Hitachi Remote
  860.  
  861. Special GDB commands for Hitachi micros
  862. .......................................
  863.  
  864.    Some GDB commands are available only on the H8/300 or the H8/500
  865. configurations:
  866.  
  867. `set machine h8300'
  868. `set machine h8300h'
  869.      Condition GDB for one of the two variants of the H8/300
  870.      architecture with `set machine'.  You can use `show machine' to
  871.      check which variant is currently in effect.
  872.  
  873. `set memory MOD'
  874. `show memory'
  875.      Specify which H8/500 memory model (MOD) you are using with `set
  876.      memory'; check which memory model is in effect with `show memory'.
  877.      The accepted values for MOD are `small', `big', `medium', and
  878.      `compact'.
  879.  
  880. 
  881. File: gdb.info,  Node: MIPS Remote,  Next: Simulator,  Prev: Hitachi Remote,  Up: Remote
  882.  
  883. GDB and remote MIPS boards
  884. --------------------------
  885.  
  886.    GDB can use the MIPS remote debugging protocol to talk to a MIPS
  887. board attached to a serial line.  This is available when you configure
  888. GDB with `--target=mips-idt-ecoff'.
  889.  
  890.    Use these GDB commands to specify the connection to your target
  891. board:
  892.  
  893. `target mips PORT'
  894.      To run a program on the board, start up `gdb' with the name of
  895.      your program as the argument.  To connect to the board, use the
  896.      command `target mips PORT', where PORT is the name of the serial
  897.      port connected to the board.  If the program has not already been
  898.      downloaded to the board, you may use the `load' command to
  899.      download it.  You can then use all the usual GDB commands.
  900.  
  901.      For example, this sequence connects to the target board through a
  902.      serial port, and loads and runs a program called PROG through the
  903.      debugger:
  904.  
  905.           host$ gdb PROG
  906.           GDB is free software and ...
  907.           (gdb) target mips /dev/ttyb
  908.           (gdb) load PROG
  909.           (gdb) run
  910.  
  911. `target mips HOSTNAME:PORTNUMBER'
  912.      On some GDB host configurations, you can specify a TCP connection
  913.      (for instance, to a serial line managed by a terminal
  914.      concentrator) instead of a serial port, using the syntax
  915.      `HOSTNAME:PORTNUMBER'.
  916.  
  917. GDB also supports these special commands for MIPS targets:
  918.  
  919. `set mipsfpu double'
  920. `set mipsfpu single'
  921. `set mipsfpu none'
  922. `show mipsfpu'
  923.      If your target board does not support the MIPS floating point
  924.      coprocessor, you should use the command `set mipsfpu none' (if you
  925.      need this, you may wish to put the command in your .gdbinit file).
  926.      This tells GDB how to find the return value of functions which
  927.      return floating point values.  It also allows GDB to avoid saving
  928.      the floating point registers when calling functions on the board.
  929.      If you are using a floating point coprocessor with only single
  930.      precision floating point support, as on the R4650 processor, use
  931.      the command `set mipsfpu single'.  The default double precision
  932.      floating point coprocessor may be selected using `set mipsfpu
  933.      double'.
  934.  
  935.      In previous versions the only choices were double precision or no
  936.      floating point, so `set mipsfpu on' will select double precision
  937.      and `set mipsfpu off' will select no floating point.
  938.  
  939.      As usual, you can inquire about the `mipsfpu' variable with `show
  940.      mipsfpu'.
  941.  
  942. `set remotedebug N'
  943. `show remotedebug'
  944.      You can see some debugging information about communications with
  945.      the board by setting the `remotedebug' variable.  If you set it to
  946.      `1' using `set remotedebug 1', every packet is displayed.  If you
  947.      set it to `2', every character is displayed.  You can check the
  948.      current value at any time with the command `show remotedebug'.
  949.  
  950. `set timeout SECONDS'
  951. `set retransmit-timeout SECONDS'
  952. `show timeout'
  953. `show retransmit-timeout'
  954.      You can control the timeout used while waiting for a packet, in
  955.      the MIPS remote protocol, with the `set timeout SECONDS' command.
  956.      The default is 5 seconds.  Similarly, you can control the timeout
  957.      used while waiting for an acknowledgement of a packet with the `set
  958.      retransmit-timeout SECONDS' command.  The default is 3 seconds.
  959.      You can inspect both values with `show timeout' and `show
  960.      retransmit-timeout'.  (These commands are *only* available when
  961.      GDB is configured for `--target=mips-idt-ecoff'.)
  962.  
  963.      The timeout set by `set timeout' does not apply when GDB is
  964.      waiting for your program to stop.  In that case, GDB waits forever
  965.      because it has no way of knowing how long the program is going to
  966.      run before stopping.
  967.  
  968. 
  969. File: gdb.info,  Node: Simulator,  Prev: MIPS Remote,  Up: Remote
  970.  
  971. Simulated CPU target
  972. --------------------
  973.  
  974.    For some configurations, GDB includes a CPU simulator that you can
  975. use instead of a hardware CPU to debug your programs.  Currently, a
  976. simulator is available when GDB is configured to debug Zilog Z8000 or
  977. Hitachi microprocessor targets.
  978.  
  979.    For the Z8000 family, `target sim' simulates either the Z8002 (the
  980. unsegmented variant of the Z8000 architecture) or the Z8001 (the
  981. segmented variant).  The simulator recognizes which architecture is
  982. appropriate by inspecting the object code.
  983.  
  984. `target sim'
  985.      Debug programs on a simulated CPU (which CPU depends on the GDB
  986.      configuration)
  987.  
  988. After specifying this target, you can debug programs for the simulated
  989. CPU in the same style as programs for your host computer; use the
  990. `file' command to load a new program image, the `run' command to run
  991. your program, and so on.
  992.  
  993.    As well as making available all the usual machine registers (see
  994. `info reg'), this debugging target provides three additional items of
  995. information as specially named registers:
  996.  
  997. `cycles'
  998.      Counts clock-ticks in the simulator.
  999.  
  1000. `insts'
  1001.      Counts instructions run in the simulator.
  1002.  
  1003. `time'
  1004.      Execution time in 60ths of a second.
  1005.  
  1006.    You can refer to these values in GDB expressions with the usual
  1007. conventions; for example, `b fputc if $cycles>5000' sets a conditional
  1008. breakpoint that suspends only after at least 5000 simulated clock ticks.
  1009.  
  1010. 
  1011. File: gdb.info,  Node: Controlling GDB,  Next: Sequences,  Prev: Targets,  Up: Top
  1012.  
  1013. Controlling GDB
  1014. ***************
  1015.  
  1016.    You can alter the way GDB interacts with you by using the `set'
  1017. command.  For commands controlling how GDB displays data, *note Print
  1018. settings: Print Settings.; other settings are described here.
  1019.  
  1020. * Menu:
  1021.  
  1022. * Prompt::                      Prompt
  1023. * Editing::                     Command editing
  1024. * History::                     Command history
  1025. * Screen Size::                 Screen size
  1026. * Numbers::                     Numbers
  1027. * Messages/Warnings::           Optional warnings and messages
  1028.  
  1029. 
  1030. File: gdb.info,  Node: Prompt,  Next: Editing,  Up: Controlling GDB
  1031.  
  1032. Prompt
  1033. ======
  1034.  
  1035.    GDB indicates its readiness to read a command by printing a string
  1036. called the "prompt".  This string is normally `(gdb)'.  You can change
  1037. the prompt string with the `set prompt' command.  For instance, when
  1038. debugging GDB with GDB, it is useful to change the prompt in one of the
  1039. GDB sessions so that you can always tell which one you are talking to.
  1040.  
  1041. `set prompt NEWPROMPT'
  1042.      Directs GDB to use NEWPROMPT as its prompt string henceforth.
  1043.  
  1044. `show prompt'
  1045.      Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
  1046.  
  1047. 
  1048. File: gdb.info,  Node: Editing,  Next: History,  Prev: Prompt,  Up: Controlling GDB
  1049.  
  1050. Command editing
  1051. ===============
  1052.  
  1053.    GDB reads its input commands via the "readline" interface.  This GNU
  1054. library provides consistent behavior for programs which provide a
  1055. command line interface to the user.  Advantages are `emacs'-style or
  1056. `vi'-style inline editing of commands, `csh'-like history substitution,
  1057. and a storage and recall of command history across debugging sessions.
  1058.  
  1059.    You may control the behavior of command line editing in GDB with the
  1060. command `set'.
  1061.  
  1062. `set editing'
  1063. `set editing on'
  1064.      Enable command line editing (enabled by default).
  1065.  
  1066. `set editing off'
  1067.      Disable command line editing.
  1068.  
  1069. `show editing'
  1070.      Show whether command line editing is enabled.
  1071.  
  1072. 
  1073. File: gdb.info,  Node: History,  Next: Screen Size,  Prev: Editing,  Up: Controlling GDB
  1074.  
  1075. Command history
  1076. ===============
  1077.  
  1078.    GDB can keep track of the commands you type during your debugging
  1079. sessions, so that you can be certain of precisely what happened.  Use
  1080. these commands to manage the GDB command history facility.
  1081.  
  1082. `set history filename FNAME'
  1083.      Set the name of the GDB command history file to FNAME.  This is
  1084.      the file where GDB reads an initial command history list, and
  1085.      where it writes the command history from this session when it
  1086.      exits.  You can access this list through history expansion or
  1087.      through the history command editing characters listed below.  This
  1088.      file defaults to the value of the environment variable
  1089.      `GDBHISTFILE', or to `./.gdb_history' if this variable is not set.
  1090.  
  1091. `set history save'
  1092. `set history save on'
  1093.      Record command history in a file, whose name may be specified with
  1094.      the `set history filename' command.  By default, this option is
  1095.      disabled.
  1096.  
  1097. `set history save off'
  1098.      Stop recording command history in a file.
  1099.  
  1100. `set history size SIZE'
  1101.      Set the number of commands which GDB keeps in its history list.
  1102.      This defaults to the value of the environment variable `HISTSIZE',
  1103.      or to 256 if this variable is not set.
  1104.  
  1105.    History expansion assigns special meaning to the character `!'.
  1106.  
  1107.    Since `!' is also the logical not operator in C, history expansion
  1108. is off by default. If you decide to enable history expansion with the
  1109. `set history expansion on' command, you may sometimes need to follow
  1110. `!' (when it is used as logical not, in an expression) with a space or
  1111. a tab to prevent it from being expanded.  The readline history
  1112. facilities do not attempt substitution on the strings `!=' and `!(',
  1113. even when history expansion is enabled.
  1114.  
  1115.    The commands to control history expansion are:
  1116.  
  1117. `set history expansion on'
  1118. `set history expansion'
  1119.      Enable history expansion.  History expansion is off by default.
  1120.  
  1121. `set history expansion off'
  1122.      Disable history expansion.
  1123.  
  1124.      The readline code comes with more complete documentation of
  1125.      editing and history expansion features.  Users unfamiliar with
  1126.      `emacs' or `vi' may wish to read it.
  1127.  
  1128. `show history'
  1129. `show history filename'
  1130. `show history save'
  1131. `show history size'
  1132. `show history expansion'
  1133.      These commands display the state of the GDB history parameters.
  1134.      `show history' by itself displays all four states.
  1135.  
  1136. `show commands'
  1137.      Display the last ten commands in the command history.
  1138.  
  1139. `show commands N'
  1140.      Print ten commands centered on command number N.
  1141.  
  1142. `show commands +'
  1143.      Print ten commands just after the commands last printed.
  1144.  
  1145. 
  1146. File: gdb.info,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
  1147.  
  1148. Screen size
  1149. ===========
  1150.  
  1151.    Certain commands to GDB may produce large amounts of information
  1152. output to the screen.  To help you read all of it, GDB pauses and asks
  1153. you for input at the end of each page of output.  Type RET when you
  1154. want to continue the output, or `q' to discard the remaining output.
  1155. Also, the screen width setting determines when to wrap lines of output.
  1156. Depending on what is being printed, GDB tries to break the line at a
  1157. readable place, rather than simply letting it overflow onto the
  1158. following line.
  1159.  
  1160.    Normally GDB knows the size of the screen from the termcap data base
  1161. together with the value of the `TERM' environment variable and the
  1162. `stty rows' and `stty cols' settings. If this is not correct, you can
  1163. override it with the `set height' and `set width' commands:
  1164.  
  1165. `set height LPP'
  1166. `show height'
  1167. `set width CPL'
  1168. `show width'
  1169.      These `set' commands specify a screen height of LPP lines and a
  1170.      screen width of CPL characters.  The associated `show' commands
  1171.      display the current settings.
  1172.  
  1173.      If you specify a height of zero lines, GDB does not pause during
  1174.      output no matter how long the output is.  This is useful if output
  1175.      is to a file or to an editor buffer.
  1176.  
  1177.      Likewise, you can specify `set width 0' to prevent GDB from
  1178.      wrapping its output.
  1179.  
  1180. 
  1181. File: gdb.info,  Node: Numbers,  Next: Messages/Warnings,  Prev: Screen Size,  Up: Controlling GDB
  1182.  
  1183. Numbers
  1184. =======
  1185.  
  1186.    You can always enter numbers in octal, decimal, or hexadecimal in
  1187. GDB by the usual conventions: octal numbers begin with `0', decimal
  1188. numbers end with `.', and hexadecimal numbers begin with `0x'.  Numbers
  1189. that begin with none of these are, by default, entered in base 10;
  1190. likewise, the default display for numbers--when no particular format is
  1191. specified--is base 10.  You can change the default base for both input
  1192. and output with the `set radix' command.
  1193.  
  1194. `set radix BASE'
  1195.      Set the default base for numeric input and display.  Supported
  1196.      choices for BASE are decimal 8, 10, or 16.  BASE must itself be
  1197.      specified either unambiguously or using the current default radix;
  1198.      for example, any of
  1199.  
  1200.           set radix 012
  1201.           set radix 10.
  1202.           set radix 0xa
  1203.  
  1204.      sets the base to decimal.  On the other hand, `set radix 10'
  1205.      leaves the radix unchanged no matter what it was.
  1206.  
  1207. `show radix'
  1208.      Display the current default base for numeric input and display.
  1209.  
  1210. 
  1211. File: gdb.info,  Node: Messages/Warnings,  Prev: Numbers,  Up: Controlling GDB
  1212.  
  1213. Optional warnings and messages
  1214. ==============================
  1215.  
  1216.    By default, GDB is silent about its inner workings.  If you are
  1217. running on a slow machine, you may want to use the `set verbose'
  1218. command.  It makes GDB tell you when it does a lengthy internal
  1219. operation, so you will not think it has crashed.
  1220.  
  1221.    Currently, the messages controlled by `set verbose' are those which
  1222. announce that the symbol table for a source file is being read; see
  1223. `symbol-file' in *Note Commands to specify files: Files.
  1224.  
  1225. `set verbose on'
  1226.      Enables GDB output of certain informational messages.
  1227.  
  1228. `set verbose off'
  1229.      Disables GDB output of certain informational messages.
  1230.  
  1231. `show verbose'
  1232.      Displays whether `set verbose' is on or off.
  1233.  
  1234.    By default, if GDB encounters bugs in the symbol table of an object
  1235. file, it is silent; but if you are debugging a compiler, you may find
  1236. this information useful (*note Errors reading symbol files: Symbol
  1237. Errors.).
  1238.  
  1239. `set complaints LIMIT'
  1240.      Permits GDB to output LIMIT complaints about each type of unusual
  1241.      symbols before becoming silent about the problem.  Set LIMIT to
  1242.      zero to suppress all complaints; set it to a large number to
  1243.      prevent complaints from being suppressed.
  1244.  
  1245. `show complaints'
  1246.      Displays how many symbol complaints GDB is permitted to produce.
  1247.  
  1248.    By default, GDB is cautious, and asks what sometimes seems to be a
  1249. lot of stupid questions to confirm certain commands.  For example, if
  1250. you try to run a program which is already running:
  1251.  
  1252.      (gdb) run
  1253.      The program being debugged has been started already.
  1254.      Start it from the beginning? (y or n)
  1255.  
  1256.    If you are willing to unflinchingly face the consequences of your own
  1257. commands, you can disable this "feature":
  1258.  
  1259. `set confirm off'
  1260.      Disables confirmation requests.
  1261.  
  1262. `set confirm on'
  1263.      Enables confirmation requests (the default).
  1264.  
  1265. `show confirm'
  1266.      Displays state of confirmation requests.
  1267.  
  1268.    Some systems allow individual object files that make up your program
  1269. to be replaced without stopping and restarting your program.  For
  1270. example, in VxWorks you can simply recompile a defective object file
  1271. and keep on running.  If you are running on one of these systems, you
  1272. can allow GDB to reload the symbols for automatically relinked modules:
  1273.  
  1274. `set symbol-reloading on'
  1275.      Replace symbol definitions for the corresponding source file when
  1276.      an object file with a particular name is seen again.
  1277.  
  1278. `set symbol-reloading off'
  1279.      Do not replace symbol definitions when re-encountering object
  1280.      files of the same name.  This is the default state; if you are not
  1281.      running on a system that permits automatically relinking modules,
  1282.      you should leave `symbol-reloading' off, since otherwise GDB may
  1283.      discard symbols when linking large programs, that may contain
  1284.      several modules (from different directories or libraries) with the
  1285.      same name.
  1286.  
  1287. `show symbol-reloading'
  1288.      Show the current `on' or `off' setting.
  1289.  
  1290. 
  1291. File: gdb.info,  Node: Sequences,  Next: Emacs,  Prev: Controlling GDB,  Up: Top
  1292.  
  1293. Canned Sequences of Commands
  1294. ****************************
  1295.  
  1296.    Aside from breakpoint commands (*note Breakpoint command lists:
  1297. Break Commands.), GDB provides two ways to store sequences of commands
  1298. for execution as a unit: user-defined commands and command files.
  1299.  
  1300. * Menu:
  1301.  
  1302. * Define::                      User-defined commands
  1303. * Hooks::            User-defined command hooks
  1304. * Command Files::               Command files
  1305. * Output::                      Commands for controlled output
  1306.  
  1307.