home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / GDB / GDB-4.13 / GDB-4 / gdb-4.13 / gdb / gdb.info-2 < prev    next >
Encoding:
GNU Info File  |  1994-08-13  |  48.2 KB  |  1,193 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.12, January 1994, of `Debugging with GDB: the GNU
  10. Source-Level Debugger' for GDB Version 4.13.
  11.  
  12.    Copyright (C) 1988, '89, '90, '91, '92, '93 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 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: Input/Output,  Next: Attach,  Prev: Working Directory,  Up: Running
  30.  
  31. Your program's input and output
  32. ===============================
  33.  
  34.    By default, the program you run under GDB does input and output to
  35. the same terminal that GDB uses.  GDB switches the terminal to its own
  36. terminal modes to interact with you, but it records the terminal modes
  37. your program was using and switches back to them when you continue
  38. running your program.
  39.  
  40. `info terminal'
  41.      Displays information recorded by GDB about the terminal modes your
  42.      program is using.
  43.  
  44.    You can redirect your program's input and/or output using shell
  45. redirection with the `run' command.  For example,
  46.  
  47.      run > outfile
  48.  
  49. starts your program, diverting its output to the file `outfile'.
  50.  
  51.    Another way to specify where your program should do input and output
  52. is with the `tty' command.  This command accepts a file name as
  53. argument, and causes this file to be the default for future `run'
  54. commands.  It also resets the controlling terminal for the child
  55. process, for future `run' commands.  For example,
  56.  
  57.      tty /dev/ttyb
  58.  
  59. directs that processes started with subsequent `run' commands default
  60. to do input and output on the terminal `/dev/ttyb' and have that as
  61. their controlling terminal.
  62.  
  63.    An explicit redirection in `run' overrides the `tty' command's
  64. effect on the input/output device, but not its effect on the controlling
  65. terminal.
  66.  
  67.    When you use the `tty' command or redirect input in the `run'
  68. command, only the input *for your program* is affected.  The input for
  69. GDB still comes from your terminal.
  70.  
  71. 
  72. File: gdb.info,  Node: Attach,  Next: Kill Process,  Prev: Input/Output,  Up: Running
  73.  
  74. Debugging an already-running process
  75. ====================================
  76.  
  77. `attach PROCESS-ID'
  78.      This command attaches to a running process--one that was started
  79.      outside GDB.  (`info files' shows your active targets.)  The
  80.      command takes as argument a process ID.  The usual way to find out
  81.      the process-id of a Unix process is with the `ps' utility, or with
  82.      the `jobs -l' shell command.
  83.  
  84.      `attach' does not repeat if you press RET a second time after
  85.      executing the command.
  86.  
  87.    To use `attach', your program must be running in an environment
  88. which supports processes; for example, `attach' does not work for
  89. programs on bare-board targets that lack an operating system.  You must
  90. also have permission to send the process a signal.
  91.  
  92.    When using `attach', you should first use the `file' command to
  93. specify the program running in the process and load its symbol table.
  94. *Note Commands to Specify Files: Files.
  95.  
  96.    The first thing GDB does after arranging to debug the specified
  97. process is to stop it.  You can examine and modify an attached process
  98. with all the GDB commands that are ordinarily available when you start
  99. processes with `run'.  You can insert breakpoints; you can step and
  100. continue; you can modify storage.  If you would rather the process
  101. continue running, you may use the `continue' command after attaching
  102. GDB to the process.
  103.  
  104. `detach'
  105.      When you have finished debugging the attached process, you can use
  106.      the `detach' command to release it from GDB control.  Detaching
  107.      the process continues its execution.  After the `detach' command,
  108.      that process and GDB become completely independent once more, and
  109.      you are ready to `attach' another process or start one with `run'.
  110.      `detach' does not repeat if you press RET again after executing
  111.      the command.
  112.  
  113.    If you exit GDB or use the `run' command while you have an attached
  114. process, you kill that process.  By default, GDB asks for confirmation
  115. if you try to do either of these things; you can control whether or not
  116. you need to confirm by using the `set confirm' command (*note Optional
  117. warnings and messages: Messages/Warnings.).
  118.  
  119. 
  120. File: gdb.info,  Node: Kill Process,  Next: Process Information,  Prev: Attach,  Up: Running
  121.  
  122. Killing the child process
  123. =========================
  124.  
  125. `kill'
  126.      Kill the child process in which your program is running under GDB.
  127.  
  128.    This command is useful if you wish to debug a core dump instead of a
  129. running process.  GDB ignores any core dump file while your program is
  130. running.
  131.  
  132.    On some operating systems, a program cannot be executed outside GDB
  133. while you have breakpoints set on it inside GDB.  You can use the
  134. `kill' command in this situation to permit running your program outside
  135. the debugger.
  136.  
  137.    The `kill' command is also useful if you wish to recompile and
  138. relink your program, since on many systems it is impossible to modify an
  139. executable file while it is running in a process.  In this case, when
  140. you next type `run', GDB notices that the file has changed, and reads
  141. the symbol table again (while trying to preserve your current
  142. breakpoint settings).
  143.  
  144. 
  145. File: gdb.info,  Node: Process Information,  Next: Threads,  Prev: Kill Process,  Up: Running
  146.  
  147. Additional process information
  148. ==============================
  149.  
  150.    Some operating systems provide a facility called `/proc' that can be
  151. used to examine the image of a running process using file-system
  152. subroutines.  If GDB is configured for an operating system with this
  153. facility, the command `info proc' is available to report on several
  154. kinds of information about the process running your program.
  155.  
  156. `info proc'
  157.      Summarize available information about the process.
  158.  
  159. `info proc mappings'
  160.      Report on the address ranges accessible in the program, with
  161.      information on whether your program may read, write, or execute
  162.      each range.
  163.  
  164. `info proc times'
  165.      Starting time, user CPU time, and system CPU time for your program
  166.      and its children.
  167.  
  168. `info proc id'
  169.      Report on the process IDs related to your program: its own process
  170.      ID, the ID of its parent, the process group ID, and the session ID.
  171.  
  172. `info proc status'
  173.      General information on the state of the process.  If the process is
  174.      stopped, this report includes the reason for stopping, and any
  175.      signal received.
  176.  
  177. `info proc all'
  178.      Show all the above information about the process.
  179.  
  180. 
  181. File: gdb.info,  Node: Threads,  Prev: Process Information,  Up: Running
  182.  
  183. Debugging programs with multiple threads
  184. ========================================
  185.  
  186.    In some operating systems, a single program may have more than one
  187. "thread" of execution.  The precise semantics of threads differ from
  188. one operating system to another, but in general the threads of a single
  189. program are akin to multiple processes--except that they share one
  190. address space (that is, they can all examine and modify the same
  191. variables).  On the other hand, each thread has its own registers and
  192. execution stack, and perhaps private memory.
  193.  
  194.    GDB provides these facilities for debugging multi-thread programs:
  195.  
  196.    * automatic notification of new threads
  197.  
  198.    * `thread THREADNO', a command to switch among threads
  199.  
  200.    * `info threads', a command to inquire about existing threads
  201.  
  202.    * thread-specific breakpoints
  203.  
  204.      *Warning:* These facilities are not yet available on every GDB
  205.      configuration where the operating system supports threads.  If
  206.      your GDB does not support threads, these commands have no effect.
  207.      For example, a system without thread support shows no output from
  208.      `info threads', and always rejects the `thread' command, like this:
  209.  
  210.           (gdb) info threads
  211.           (gdb) thread 1
  212.           Thread ID 1 not known.  Use the "info threads" command to
  213.           see the IDs of currently known threads.
  214.  
  215.    The GDB thread debugging facility allows you to observe all threads
  216. while your program runs--but whenever GDB takes control, one thread in
  217. particular is always the focus of debugging.  This thread is called the
  218. "current thread".  Debugging commands show program information from the
  219. perspective of the current thread.
  220.  
  221.    Whenever GDB detects a new thread in your program, it displays the
  222. target system's identification for the thread with a message in the
  223. form `[New SYSTAG]'.  SYSTAG is a thread identifier whose form varies
  224. depending on the particular system.  For example, on LynxOS, you might
  225. see
  226.  
  227.      [New process 35 thread 27]
  228.  
  229. when GDB notices a new thread.  In contrast, on an SGI system, the
  230. SYSTAG is simply something like `process 368', with no further
  231. qualifier.
  232.  
  233.    For debugging purposes, GDB associates its own thread number--always
  234. a single integer--with each thread in your program.
  235.  
  236. `info threads'
  237.      Display a summary of all threads currently in your program.  GDB
  238.      displays for each thread (in this order):
  239.  
  240.        1. the thread number assigned by GDB
  241.  
  242.        2. the target system's thread identifier (SYSTAG)
  243.  
  244.        3. the current stack frame summary for that thread
  245.  
  246.      An asterisk `*' to the left of the GDB thread number indicates the
  247.      current thread.
  248.  
  249.      For example,
  250.  
  251.      (gdb) info threads
  252.        3 process 35 thread 27  0x34e5 in sigpause ()
  253.        2 process 35 thread 23  0x34e5 in sigpause ()
  254.      * 1 process 35 thread 13  main (argc=1, argv=0x7ffffff8)
  255.          at threadtest.c:68
  256.  
  257. `thread THREADNO'
  258.      Make thread number THREADNO the current thread.  The command
  259.      argument THREADNO is the internal GDB thread number, as shown in
  260.      the first field of the `info threads' display.  GDB responds by
  261.      displaying the system identifier of the thread you selected, and
  262.      its current stack frame summary:
  263.  
  264.           (gdb) thread 2
  265.           [Switching to process 35 thread 23]
  266.           0x34e5 in sigpause ()
  267.  
  268.      As with the `[New ...]' message, the form of the text after
  269.      `Switching to' depends on your system's conventions for identifying
  270.      threads.
  271.  
  272.    Whenever GDB stops your program, due to a breakpoint or a signal, it
  273. automatically selects the thread where that breakpoint or signal
  274. happened.  GDB alerts you to the context switch with a message of the
  275. form `[Switching to SYSTAG]' to identify the thread.
  276.  
  277.    *Note Stopping and starting multi-thread programs: Thread Stops, for
  278. more information about how GDB behaves when you stop and start programs
  279. with multiple threads.
  280.  
  281.    *Note Setting watchpoints: Set Watchpoints, for information about
  282. watchpoints in programs with multiple threads.
  283.  
  284. 
  285. File: gdb.info,  Node: Stopping,  Next: Stack,  Prev: Running,  Up: Top
  286.  
  287. Stopping and Continuing
  288. ***********************
  289.  
  290.    The principal purposes of using a debugger are so that you can stop
  291. your program before it terminates; or so that, if your program runs into
  292. trouble, you can investigate and find out why.
  293.  
  294.    Inside GDB, your program may stop for any of several reasons, such as
  295. a signal, a breakpoint, or reaching a new line after a GDB command such
  296. as `step'.  You may then examine and change variables, set new
  297. breakpoints or remove old ones, and then continue execution.  Usually,
  298. the messages shown by GDB provide ample explanation of the status of
  299. your program--but you can also explicitly request this information at
  300. any time.
  301.  
  302. `info program'
  303.      Display information about the status of your program: whether it is
  304.      running or not, what process it is, and why it stopped.
  305.  
  306. * Menu:
  307.  
  308.  
  309. * Breakpoints::                 Breakpoints, watchpoints, and exceptions
  310.  
  311.  
  312. * Continuing and Stepping::     Resuming execution
  313.  
  314. * Signals::                     Signals
  315.  
  316. * Thread Stops::        Stopping and starting multi-thread programs
  317.  
  318. 
  319. File: gdb.info,  Node: Breakpoints,  Next: Continuing and Stepping,  Up: Stopping
  320.  
  321. Breakpoints, watchpoints, and exceptions
  322. ========================================
  323.  
  324.    A "breakpoint" makes your program stop whenever a certain point in
  325. the program is reached.  For each breakpoint, you can add conditions to
  326. control in finer detail whether your program stops.  You can set
  327. breakpoints with the `break' command and its variants (*note Setting
  328. breakpoints: Set Breaks.), to specify the place where your program
  329. should stop by line number, function name or exact address in the
  330. program.  In languages with exception handling (such as GNU C++), you
  331. can also set breakpoints where an exception is raised (*note
  332. Breakpoints and exceptions: Exception Handling.).
  333.  
  334.    A "watchpoint" is a special breakpoint that stops your program when
  335. the value of an expression changes.  You must use a different command
  336. to set watchpoints (*note Setting watchpoints: Set Watchpoints.), but
  337. aside from that, you can manage a watchpoint like any other breakpoint:
  338. you enable, disable, and delete both breakpoints and watchpoints using
  339. the same commands.
  340.  
  341.    You can arrange to have values from your program displayed
  342. automatically whenever GDB stops at a breakpoint.  *Note Automatic
  343. display: Auto Display.
  344.  
  345.    GDB assigns a number to each breakpoint or watchpoint when you
  346. create it; these numbers are successive integers starting with one.  In
  347. many of the commands for controlling various features of breakpoints you
  348. use the breakpoint number to say which breakpoint you want to change.
  349. Each breakpoint may be "enabled" or "disabled"; if disabled, it has no
  350. effect on your program until you enable it again.
  351.  
  352. * Menu:
  353.  
  354. * Set Breaks::                  Setting breakpoints
  355. * Set Watchpoints::             Setting watchpoints
  356.  
  357. * Exception Handling::          Breakpoints and exceptions
  358.  
  359. * Delete Breaks::               Deleting breakpoints
  360. * Disabling::                   Disabling breakpoints
  361. * Conditions::                  Break conditions
  362. * Break Commands::              Breakpoint command lists
  363.  
  364. * Breakpoint Menus::            Breakpoint menus
  365.  
  366. * Error in Breakpoints::        "Cannot insert breakpoints"
  367.  
  368. 
  369. File: gdb.info,  Node: Set Breaks,  Next: Set Watchpoints,  Up: Breakpoints
  370.  
  371. Setting breakpoints
  372. -------------------
  373.  
  374.    Breakpoints are set with the `break' command (abbreviated `b').  The
  375. debugger convenience variable `$bpnum' records the number of the
  376. beakpoint you've set most recently; see *Note Convenience variables:
  377. Convenience Vars, for a discussion of what you can do with convenience
  378. variables.
  379.  
  380.    You have several ways to say where the breakpoint should go.
  381.  
  382. `break FUNCTION'
  383.      Set a breakpoint at entry to function FUNCTION.  When using source
  384.      languages that permit overloading of symbols, such as C++,
  385.      FUNCTION may refer to more than one possible place to break.
  386.      *Note Breakpoint menus: Breakpoint Menus, for a discussion of that
  387.      situation.
  388.  
  389. `break +OFFSET'
  390. `break -OFFSET'
  391.      Set a breakpoint some number of lines forward or back from the
  392.      position at which execution stopped in the currently selected
  393.      frame.
  394.  
  395. `break LINENUM'
  396.      Set a breakpoint at line LINENUM in the current source file.  That
  397.      file is the last file whose source text was printed.  This
  398.      breakpoint stops your program just before it executes any of the
  399.      code on that line.
  400.  
  401. `break FILENAME:LINENUM'
  402.      Set a breakpoint at line LINENUM in source file FILENAME.
  403.  
  404. `break FILENAME:FUNCTION'
  405.      Set a breakpoint at entry to function FUNCTION found in file
  406.      FILENAME.  Specifying a file name as well as a function name is
  407.      superfluous except when multiple files contain similarly named
  408.      functions.
  409.  
  410. `break *ADDRESS'
  411.      Set a breakpoint at address ADDRESS.  You can use this to set
  412.      breakpoints in parts of your program which do not have debugging
  413.      information or source files.
  414.  
  415. `break'
  416.      When called without any arguments, `break' sets a breakpoint at
  417.      the next instruction to be executed in the selected stack frame
  418.      (*note Examining the Stack: Stack.).  In any selected frame but the
  419.      innermost, this makes your program stop as soon as control returns
  420.      to that frame.  This is similar to the effect of a `finish'
  421.      command in the frame inside the selected frame--except that
  422.      `finish' does not leave an active breakpoint.  If you use `break'
  423.      without an argument in the innermost frame, GDB stops the next
  424.      time it reaches the current location; this may be useful inside
  425.      loops.
  426.  
  427.      GDB normally ignores breakpoints when it resumes execution, until
  428.      at least one instruction has been executed.  If it did not do
  429.      this, you would be unable to proceed past a breakpoint without
  430.      first disabling the breakpoint.  This rule applies whether or not
  431.      the breakpoint already existed when your program stopped.
  432.  
  433. `break ... if COND'
  434.      Set a breakpoint with condition COND; evaluate the expression COND
  435.      each time the breakpoint is reached, and stop only if the value is
  436.      nonzero--that is, if COND evaluates as true.  `...' stands for one
  437.      of the possible arguments described above (or no argument)
  438.      specifying where to break.  *Note Break conditions: Conditions,
  439.      for more information on breakpoint conditions.
  440.  
  441. `tbreak ARGS'
  442.      Set a breakpoint enabled only for one stop.  ARGS are the same as
  443.      for the `break' command, and the breakpoint is set in the same
  444.      way, but the breakpoint is automatically deleted after the first
  445.      time your program stops there.  *Note Disabling breakpoints:
  446.      Disabling.
  447.  
  448. `rbreak REGEX'
  449.      Set breakpoints on all functions matching the regular expression
  450.      REGEX.  This command sets an unconditional breakpoint on all
  451.      matches, printing a list of all breakpoints it set.  Once these
  452.      breakpoints are set, they are treated just like the breakpoints
  453.      set with the `break' command.  You can delete them, disable them,
  454.      or make them conditional the same way as any other breakpoint.
  455.  
  456.      When debugging C++ programs, `rbreak' is useful for setting
  457.      breakpoints on overloaded functions that are not members of any
  458.      special classes.
  459.  
  460. `info breakpoints [N]'
  461. `info break [N]'
  462. `info watchpoints [N]'
  463.      Print a table of all breakpoints and watchpoints set and not
  464.      deleted, with the following columns for each breakpoint:
  465.  
  466.     *Breakpoint Numbers*
  467.     *Type*
  468.           Breakpoint or watchpoint.
  469.  
  470.     *Disposition*
  471.           Whether the breakpoint is marked to be disabled or deleted
  472.           when hit.
  473.  
  474.     *Enabled or Disabled*
  475.           Enabled breakpoints are marked with `y'.  `n' marks
  476.           breakpoints that are not enabled.
  477.  
  478.     *Address*
  479.           Where the breakpoint is in your program, as a memory address
  480.  
  481.     *What*
  482.           Where the breakpoint is in the source for your program, as a
  483.           file and line number.
  484.  
  485.      If a breakpoint is conditional, `info break' shows the condition on
  486.      the line following the affected breakpoint; breakpoint commands,
  487.      if any, are listed after that.
  488.  
  489.      `info break' with a breakpoint number N as argument lists only
  490.      that breakpoint.  The convenience variable `$_' and the default
  491.      examining-address for the `x' command are set to the address of
  492.      the last breakpoint listed (*note Examining memory: Memory.).
  493.  
  494.    GDB allows you to set any number of breakpoints at the same place in
  495. your program.  There is nothing silly or meaningless about this.  When
  496. the breakpoints are conditional, this is even useful (*note Break
  497. conditions: Conditions.).
  498.  
  499.    GDB itself sometimes sets breakpoints in your program for special
  500. purposes, such as proper handling of `longjmp' (in C programs).  These
  501. internal breakpoints are assigned negative numbers, starting with `-1';
  502. `info breakpoints' does not display them.
  503.  
  504.    You can see these breakpoints with the GDB maintenance command
  505. `maint info breakpoints'.
  506.  
  507. `maint info breakpoints'
  508.      Using the same format as `info breakpoints', display both the
  509.      breakpoints you've set explicitly, and those GDB is using for
  510.      internal purposes.  Internal breakpoints are shown with negative
  511.      breakpoint numbers.  The type column identifies what kind of
  512.      breakpoint is shown:
  513.  
  514.     `breakpoint'
  515.           Normal, explicitly set breakpoint.
  516.  
  517.     `watchpoint'
  518.           Normal, explicitly set watchpoint.
  519.  
  520.     `longjmp'
  521.           Internal breakpoint, used to handle correctly stepping through
  522.           `longjmp' calls.
  523.  
  524.     `longjmp resume'
  525.           Internal breakpoint at the target of a `longjmp'.
  526.  
  527.     `until'
  528.           Temporary internal breakpoint used by the GDB `until' command.
  529.  
  530.     `finish'
  531.           Temporary internal breakpoint used by the GDB `finish'
  532.           command.
  533.  
  534. 
  535. File: gdb.info,  Node: Set Watchpoints,  Next: Exception Handling,  Prev: Set Breaks,  Up: Breakpoints
  536.  
  537. Setting watchpoints
  538. -------------------
  539.  
  540.    You can use a watchpoint to stop execution whenever the value of an
  541. expression changes, without having to predict a particular place where
  542. this may happen.
  543.  
  544.    Watchpoints currently execute two orders of magnitude more slowly
  545. than other breakpoints, but this can be well worth it to catch errors
  546. where you have no clue what part of your program is the culprit.
  547.  
  548. `watch EXPR'
  549.      Set a watchpoint for an expression.
  550.  
  551. `info watchpoints'
  552.      This command prints a list of watchpoints and breakpoints; it is
  553.      the same as `info break'.
  554.  
  555.      *Warning:* in multi-thread programs, watchpoints have only limited
  556.      usefulness.  With the current watchpoint implementation, GDB can
  557.      only watch the value of an expression *in a single thread*.  If
  558.      you are confident that the expression can only change due to the
  559.      current thread's activity (and if you are also confident that no
  560.      other thread can become current), then you can use watchpoints as
  561.      usual.  However, GDB may not notice when a non-current thread's
  562.      activity changes the expression.
  563.  
  564. 
  565. File: gdb.info,  Node: Exception Handling,  Next: Delete Breaks,  Prev: Set Watchpoints,  Up: Breakpoints
  566.  
  567. Breakpoints and exceptions
  568. --------------------------
  569.  
  570.    Some languages, such as GNU C++, implement exception handling.  You
  571. can use GDB to examine what caused your program to raise an exception,
  572. and to list the exceptions your program is prepared to handle at a
  573. given point in time.
  574.  
  575. `catch EXCEPTIONS'
  576.      You can set breakpoints at active exception handlers by using the
  577.      `catch' command.  EXCEPTIONS is a list of names of exceptions to
  578.      catch.
  579.  
  580.    You can use `info catch' to list active exception handlers.  *Note
  581. Information about a frame: Frame Info.
  582.  
  583.    There are currently some limitations to exception handling in GDB:
  584.  
  585.    * If you call a function interactively, GDB normally returns control
  586.      to you when the function has finished executing.  If the call
  587.      raises an exception, however, the call may bypass the mechanism
  588.      that returns control to you and cause your program to simply
  589.      continue running until it hits a breakpoint, catches a signal that
  590.      GDB is listening for, or exits.
  591.  
  592.    * You cannot raise an exception interactively.
  593.  
  594.    * You cannot install an exception handler interactively.
  595.  
  596.    Sometimes `catch' is not the best way to debug exception handling:
  597. if you need to know exactly where an exception is raised, it is better
  598. to stop *before* the exception handler is called, since that way you
  599. can see the stack before any unwinding takes place.  If you set a
  600. breakpoint in an exception handler instead, it may not be easy to find
  601. out where the exception was raised.
  602.  
  603.    To stop just before an exception handler is called, you need some
  604. knowledge of the implementation.  In the case of GNU C++, exceptions are
  605. raised by calling a library function named `__raise_exception' which
  606. has the following ANSI C interface:
  607.  
  608.          /* ADDR is where the exception identifier is stored.
  609.             ID is the exception identifier.  */
  610.          void __raise_exception (void **ADDR, void *ID);
  611.  
  612. To make the debugger catch all exceptions before any stack unwinding
  613. takes place, set a breakpoint on `__raise_exception' (*note
  614. Breakpoints; watchpoints; and exceptions: Breakpoints.).
  615.  
  616.    With a conditional breakpoint (*note Break conditions: Conditions.)
  617. that depends on the value of ID, you can stop your program when a
  618. specific exception is raised.  You can use multiple conditional
  619. breakpoints to stop your program when any of a number of exceptions are
  620. raised.
  621.  
  622. 
  623. File: gdb.info,  Node: Delete Breaks,  Next: Disabling,  Prev: Exception Handling,  Up: Breakpoints
  624.  
  625. Deleting breakpoints
  626. --------------------
  627.  
  628.    It is often necessary to eliminate a breakpoint or watchpoint once it
  629. has done its job and you no longer want your program to stop there.
  630. This is called "deleting" the breakpoint.  A breakpoint that has been
  631. deleted no longer exists; it is forgotten.
  632.  
  633.    With the `clear' command you can delete breakpoints according to
  634. where they are in your program.  With the `delete' command you can
  635. delete individual breakpoints or watchpoints by specifying their
  636. breakpoint numbers.
  637.  
  638.    It is not necessary to delete a breakpoint to proceed past it.  GDB
  639. automatically ignores breakpoints on the first instruction to be
  640. executed when you continue execution without changing the execution
  641. address.
  642.  
  643. `clear'
  644.      Delete any breakpoints at the next instruction to be executed in
  645.      the selected stack frame (*note Selecting a frame: Selection.).
  646.      When the innermost frame is selected, this is a good way to delete
  647.      a breakpoint where your program just stopped.
  648.  
  649. `clear FUNCTION'
  650. `clear FILENAME:FUNCTION'
  651.      Delete any breakpoints set at entry to the function FUNCTION.
  652.  
  653. `clear LINENUM'
  654. `clear FILENAME:LINENUM'
  655.      Delete any breakpoints set at or within the code of the specified
  656.      line.
  657.  
  658. `delete [breakpoints] [BNUMS...]'
  659.      Delete the breakpoints or watchpoints of the numbers specified as
  660.      arguments.  If no argument is specified, delete all breakpoints
  661.      (GDB asks confirmation, unless you have `set confirm off').  You
  662.      can abbreviate this command as `d'.
  663.  
  664. 
  665. File: gdb.info,  Node: Disabling,  Next: Conditions,  Prev: Delete Breaks,  Up: Breakpoints
  666.  
  667. Disabling breakpoints
  668. ---------------------
  669.  
  670.    Rather than deleting a breakpoint or watchpoint, you might prefer to
  671. "disable" it.  This makes the breakpoint inoperative as if it had been
  672. deleted, but remembers the information on the breakpoint so that you
  673. can "enable" it again later.
  674.  
  675.    You disable and enable breakpoints and watchpoints with the `enable'
  676. and `disable' commands, optionally specifying one or more breakpoint
  677. numbers as arguments.  Use `info break' or `info watch' to print a list
  678. of breakpoints or watchpoints if you do not know which numbers to use.
  679.  
  680.    A breakpoint or watchpoint can have any of four different states of
  681. enablement:
  682.  
  683.    * Enabled.  The breakpoint stops your program.  A breakpoint set
  684.      with the `break' command starts out in this state.
  685.  
  686.    * Disabled.  The breakpoint has no effect on your program.
  687.  
  688.    * Enabled once.  The breakpoint stops your program, but then becomes
  689.      disabled.  A breakpoint set with the `tbreak' command starts out in
  690.      this state.
  691.  
  692.    * Enabled for deletion.  The breakpoint stops your program, but
  693.      immediately after it does so it is deleted permanently.
  694.  
  695.    You can use the following commands to enable or disable breakpoints
  696. and watchpoints:
  697.  
  698. `disable [breakpoints] [BNUMS...]'
  699.      Disable the specified breakpoints--or all breakpoints, if none are
  700.      listed.  A disabled breakpoint has no effect but is not forgotten.
  701.      All options such as ignore-counts, conditions and commands are
  702.      remembered in case the breakpoint is enabled again later.  You may
  703.      abbreviate `disable' as `dis'.
  704.  
  705. `enable [breakpoints] [BNUMS...]'
  706.      Enable the specified breakpoints (or all defined breakpoints).
  707.      They become effective once again in stopping your program.
  708.  
  709. `enable [breakpoints] once BNUMS...'
  710.      Enable the specified breakpoints temporarily.  GDB disables any of
  711.      these breakpoints immediately after stopping your program.
  712.  
  713. `enable [breakpoints] delete BNUMS...'
  714.      Enable the specified breakpoints to work once, then die.  GDB
  715.      deletes any of these breakpoints as soon as your program stops
  716.      there.
  717.  
  718.    Save for a breakpoint set with `tbreak' (*note Setting breakpoints:
  719. Set Breaks.), breakpoints that you set are initially enabled;
  720. subsequently, they become disabled or enabled only when you use one of
  721. the commands above.  (The command `until' can set and delete a
  722. breakpoint of its own, but it does not change the state of your other
  723. breakpoints; see *Note Continuing and stepping: Continuing and
  724. Stepping.)
  725.  
  726. 
  727. File: gdb.info,  Node: Conditions,  Next: Break Commands,  Prev: Disabling,  Up: Breakpoints
  728.  
  729. Break conditions
  730. ----------------
  731.  
  732.    The simplest sort of breakpoint breaks every time your program
  733. reaches a specified place.  You can also specify a "condition" for a
  734. breakpoint.  A condition is just a Boolean expression in your
  735. programming language (*note Expressions: Expressions.).  A breakpoint
  736. with a condition evaluates the expression each time your program
  737. reaches it, and your program stops only if the condition is *true*.
  738.  
  739.    This is the converse of using assertions for program validation; in
  740. that situation, you want to stop when the assertion is violated--that
  741. is, when the condition is false.  In C, if you want to test an
  742. assertion expressed by the condition ASSERT, you should set the
  743. condition `! ASSERT' on the appropriate breakpoint.
  744.  
  745.    Conditions are also accepted for watchpoints; you may not need them,
  746. since a watchpoint is inspecting the value of an expression anyhow--but
  747. it might be simpler, say, to just set a watchpoint on a variable name,
  748. and specify a condition that tests whether the new value is an
  749. interesting one.
  750.  
  751.    Break conditions can have side effects, and may even call functions
  752. in your program.  This can be useful, for example, to activate functions
  753. that log program progress, or to use your own print functions to format
  754. special data structures. The effects are completely predictable unless
  755. there is another enabled breakpoint at the same address.  (In that
  756. case, GDB might see the other breakpoint first and stop your program
  757. without checking the condition of this one.)  Note that breakpoint
  758. commands are usually more convenient and flexible for the purpose of
  759. performing side effects when a breakpoint is reached (*note Breakpoint
  760. command lists: Break Commands.).
  761.  
  762.    Break conditions can be specified when a breakpoint is set, by using
  763. `if' in the arguments to the `break' command.  *Note Setting
  764. breakpoints: Set Breaks.  They can also be changed at any time with the
  765. `condition' command.  The `watch' command does not recognize the `if'
  766. keyword; `condition' is the only way to impose a further condition on a
  767. watchpoint.
  768.  
  769. `condition BNUM EXPRESSION'
  770.      Specify EXPRESSION as the break condition for breakpoint or
  771.      watchpoint number BNUM.  After you set a condition, breakpoint
  772.      BNUM stops your program only if the value of EXPRESSION is true
  773.      (nonzero, in C).  When you use `condition', GDB checks EXPRESSION
  774.      immediately for syntactic correctness, and to determine whether
  775.      symbols in it have referents in the context of your breakpoint.
  776.      G{No Value For "DBN"} does not actually evaluate EXPRESSION at the
  777.      time the `condition' command is given, however.  *Note
  778.      Expressions: Expressions.
  779.  
  780. `condition BNUM'
  781.      Remove the condition from breakpoint number BNUM.  It becomes an
  782.      ordinary unconditional breakpoint.
  783.  
  784.    A special case of a breakpoint condition is to stop only when the
  785. breakpoint has been reached a certain number of times.  This is so
  786. useful that there is a special way to do it, using the "ignore count"
  787. of the breakpoint.  Every breakpoint has an ignore count, which is an
  788. integer.  Most of the time, the ignore count is zero, and therefore has
  789. no effect.  But if your program reaches a breakpoint whose ignore count
  790. is positive, then instead of stopping, it just decrements the ignore
  791. count by one and continues.  As a result, if the ignore count value is
  792. N, the breakpoint does not stop the next N times your program reaches
  793. it.
  794.  
  795. `ignore BNUM COUNT'
  796.      Set the ignore count of breakpoint number BNUM to COUNT.  The next
  797.      COUNT times the breakpoint is reached, your program's execution
  798.      does not stop; other than to decrement the ignore count, GDB takes
  799.      no action.
  800.  
  801.      To make the breakpoint stop the next time it is reached, specify a
  802.      count of zero.
  803.  
  804.      When you use `continue' to resume execution of your program from a
  805.      breakpoint, you can specify an ignore count directly as an
  806.      argument to `continue', rather than using `ignore'.  *Note
  807.      Continuing and stepping: Continuing and Stepping.
  808.  
  809.      If a breakpoint has a positive ignore count and a condition, the
  810.      condition is not checked.  Once the ignore count reaches zero, GDB
  811.      resumes checking the condition.
  812.  
  813.      You could achieve the effect of the ignore count with a condition
  814.      such as `$foo-- <= 0' using a debugger convenience variable that
  815.      is decremented each time.  *Note Convenience variables:
  816.      Convenience Vars.
  817.  
  818. 
  819. File: gdb.info,  Node: Break Commands,  Next: Breakpoint Menus,  Prev: Conditions,  Up: Breakpoints
  820.  
  821. Breakpoint command lists
  822. ------------------------
  823.  
  824.    You can give any breakpoint (or watchpoint) a series of commands to
  825. execute when your program stops due to that breakpoint.  For example,
  826. you might want to print the values of certain expressions, or enable
  827. other breakpoints.
  828.  
  829. `commands [BNUM]'
  830. `... COMMAND-LIST ...'
  831. `end'
  832.      Specify a list of commands for breakpoint number BNUM.  The
  833.      commands themselves appear on the following lines.  Type a line
  834.      containing just `end' to terminate the commands.
  835.  
  836.      To remove all commands from a breakpoint, type `commands' and
  837.      follow it immediately with `end'; that is, give no commands.
  838.  
  839.      With no BNUM argument, `commands' refers to the last breakpoint or
  840.      watchpoint set (not to the breakpoint most recently encountered).
  841.  
  842.    Pressing RET as a means of repeating the last GDB command is
  843. disabled within a COMMAND-LIST.
  844.  
  845.    You can use breakpoint commands to start your program up again.
  846. Simply use the `continue' command, or `step', or any other command that
  847. resumes execution.
  848.  
  849.    Any other commands in the command list, after a command that resumes
  850. execution, are ignored.  This is because any time you resume execution
  851. (even with a simple `next' or `step'), you may encounter another
  852. breakpoint--which could have its own command list, leading to
  853. ambiguities about which list to execute.
  854.  
  855.    If the first command you specify in a command list is `silent', the
  856. usual message about stopping at a breakpoint is not printed.  This may
  857. be desirable for breakpoints that are to print a specific message and
  858. then continue.  If none of the remaining commands print anything, you
  859. see no sign that the breakpoint was reached.  `silent' is meaningful
  860. only at the beginning of a breakpoint command list.
  861.  
  862.    The commands `echo', `output', and `printf' allow you to print
  863. precisely controlled output, and are often useful in silent
  864. breakpoints.  *Note Commands for controlled output: Output.
  865.  
  866.    For example, here is how you could use breakpoint commands to print
  867. the value of `x' at entry to `foo' whenever `x' is positive.
  868.  
  869.      break foo if x>0
  870.      commands
  871.      silent
  872.      printf "x is %d\n",x
  873.      cont
  874.      end
  875.  
  876.    One application for breakpoint commands is to compensate for one bug
  877. so you can test for another.  Put a breakpoint just after the erroneous
  878. line of code, give it a condition to detect the case in which something
  879. erroneous has been done, and give it commands to assign correct values
  880. to any variables that need them.  End with the `continue' command so
  881. that your program does not stop, and start with the `silent' command so
  882. that no output is produced.  Here is an example:
  883.  
  884.      break 403
  885.      commands
  886.      silent
  887.      set x = y + 4
  888.      cont
  889.      end
  890.  
  891. 
  892. File: gdb.info,  Node: Breakpoint Menus,  Next: Error in Breakpoints,  Prev: Break Commands,  Up: Breakpoints
  893.  
  894. Breakpoint menus
  895. ----------------
  896.  
  897.    Some programming languages (notably C++) permit a single function
  898. name to be defined several times, for application in different contexts.
  899. This is called "overloading".  When a function name is overloaded,
  900. `break FUNCTION' is not enough to tell GDB where you want a breakpoint.
  901. If you realize this is a problem, you can use something like `break
  902. FUNCTION(TYPES)' to specify which particular version of the function
  903. you want.  Otherwise, GDB offers you a menu of numbered choices for
  904. different possible breakpoints, and waits for your selection with the
  905. prompt `>'.  The first two options are always `[0] cancel' and `[1]
  906. all'.  Typing `1' sets a breakpoint at each definition of FUNCTION, and
  907. typing `0' aborts the `break' command without setting any new
  908. breakpoints.
  909.  
  910.    For example, the following session excerpt shows an attempt to set a
  911. breakpoint at the overloaded symbol `String::after'.  We choose three
  912. particular definitions of that function name:
  913.  
  914.      (gdb) b String::after
  915.      [0] cancel
  916.      [1] all
  917.      [2] file:String.cc; line number:867
  918.      [3] file:String.cc; line number:860
  919.      [4] file:String.cc; line number:875
  920.      [5] file:String.cc; line number:853
  921.      [6] file:String.cc; line number:846
  922.      [7] file:String.cc; line number:735
  923.      > 2 4 6
  924.      Breakpoint 1 at 0xb26c: file String.cc, line 867.
  925.      Breakpoint 2 at 0xb344: file String.cc, line 875.
  926.      Breakpoint 3 at 0xafcc: file String.cc, line 846.
  927.      Multiple breakpoints were set.
  928.      Use the "delete" command to delete unwanted
  929.       breakpoints.
  930.      (gdb)
  931.  
  932. 
  933. File: gdb.info,  Node: Error in Breakpoints,  Prev: Breakpoint Menus,  Up: Breakpoints
  934.  
  935. "Cannot insert breakpoints"
  936. ---------------------------
  937.  
  938.    Under some operating systems, breakpoints cannot be used in a
  939. program if any other process is running that program.  In this
  940. situation, attempting to run or continue a program with a breakpoint
  941. causes GDB to stop the other process.
  942.  
  943.    When this happens, you have three ways to proceed:
  944.  
  945.   1. Remove or disable the breakpoints, then continue.
  946.  
  947.   2. Suspend GDB, and copy the file containing your program to a new
  948.      name.  Resume GDB and use the `exec-file' command to specify that
  949.      GDB should run your program under that name.  Then start your
  950.      program again.
  951.  
  952.   3. Relink your program so that the text segment is nonsharable, using
  953.      the linker option `-N'.  The operating system limitation may not
  954.      apply to nonsharable executables.
  955.  
  956. 
  957. File: gdb.info,  Node: Continuing and Stepping,  Next: Signals,  Prev: Breakpoints,  Up: Stopping
  958.  
  959. Continuing and stepping
  960. =======================
  961.  
  962.    "Continuing" means resuming program execution until your program
  963. completes normally.  In contrast, "stepping" means executing just one
  964. more "step" of your program, where "step" may mean either one line of
  965. source code, or one machine instruction (depending on what particular
  966. command you use).  Either when continuing or when stepping, your
  967. program may stop even sooner, due to a breakpoint or a signal.  (If due
  968. to a signal, you may want to use `handle', or use `signal 0' to resume
  969. execution.  *Note Signals: Signals.)
  970.  
  971. `continue [IGNORE-COUNT]'
  972. `c [IGNORE-COUNT]'
  973. `fg [IGNORE-COUNT]'
  974.      Resume program execution, at the address where your program last
  975.      stopped; any breakpoints set at that address are bypassed.  The
  976.      optional argument IGNORE-COUNT allows you to specify a further
  977.      number of times to ignore a breakpoint at this location; its
  978.      effect is like that of `ignore' (*note Break conditions:
  979.      Conditions.).
  980.  
  981.      The argument IGNORE-COUNT is meaningful only when your program
  982.      stopped due to a breakpoint.  At other times, the argument to
  983.      `continue' is ignored.
  984.  
  985.      The synonyms `c' and `fg' are provided purely for convenience, and
  986.      have exactly the same behavior as `continue'.
  987.  
  988.    To resume execution at a different place, you can use `return'
  989. (*note Returning from a function: Returning.) to go back to the calling
  990. function; or `jump' (*note Continuing at a different address: Jumping.)
  991. to go to an arbitrary location in your program.
  992.  
  993.    A typical technique for using stepping is to set a breakpoint (*note
  994. Breakpoints; watchpoints; and exceptions: Breakpoints.) at the
  995. beginning of the function or the section of your program where a
  996. problem is believed to lie, run your program until it stops at that
  997. breakpoint, and then step through the suspect area, examining the
  998. variables that are interesting, until you see the problem happen.
  999.  
  1000. `step'
  1001.      Continue running your program until control reaches a different
  1002.      source line, then stop it and return control to GDB.  This command
  1003.      is abbreviated `s'.
  1004.  
  1005.           *Warning:* If you use the `step' command while control is
  1006.           within a function that was compiled without debugging
  1007.           information, execution proceeds until control reaches a
  1008.           function that does have debugging information.  Likewise, it
  1009.           will not step into a function which is compiled without
  1010.           debugging information.  To step through functions without
  1011.           debugging information, use the `stepi' command, described
  1012.           below.
  1013.  
  1014. `step COUNT'
  1015.      Continue running as in `step', but do so COUNT times.  If a
  1016.      breakpoint is reached, or a signal not related to stepping occurs
  1017.      before COUNT steps, stepping stops right away.
  1018.  
  1019. `next [COUNT]'
  1020.      Continue to the next source line in the current (innermost) stack
  1021.      frame.  Similar to `step', but any function calls appearing within
  1022.      the line of code are executed without stopping.  Execution stops
  1023.      when control reaches a different line of code at the stack level
  1024.      which was executing when the `next' command was given.  This
  1025.      command is abbreviated `n'.
  1026.  
  1027.      An argument COUNT is a repeat count, as for `step'.
  1028.  
  1029.      `next' within a function that lacks debugging information acts like
  1030.      `step', but any function calls appearing within the code of the
  1031.      function are executed without stopping.
  1032.  
  1033. `finish'
  1034.      Continue running until just after function in the selected stack
  1035.      frame returns.  Print the returned value (if any).
  1036.  
  1037.      Contrast this with the `return' command (*note Returning from a
  1038.      function: Returning.).
  1039.  
  1040. `until'
  1041. `u'
  1042.      Continue running until a source line past the current line, in the
  1043.      current stack frame, is reached.  This command is used to avoid
  1044.      single stepping through a loop more than once.  It is like the
  1045.      `next' command, except that when `until' encounters a jump, it
  1046.      automatically continues execution until the program counter is
  1047.      greater than the address of the jump.
  1048.  
  1049.      This means that when you reach the end of a loop after single
  1050.      stepping though it, `until' makes your program continue execution
  1051.      until it exits the loop.  In contrast, a `next' command at the end
  1052.      of a loop simply steps back to the beginning of the loop, which
  1053.      forces you to step through the next iteration.
  1054.  
  1055.      `until' always stops your program if it attempts to exit the
  1056.      current stack frame.
  1057.  
  1058.      `until' may produce somewhat counterintuitive results if the order
  1059.      of machine code does not match the order of the source lines.  For
  1060.      example, in the following excerpt from a debugging session, the `f'
  1061.      (`frame') command shows that execution is stopped at line `206';
  1062.      yet when we use `until', we get to line `195':
  1063.  
  1064.           (gdb) f
  1065.           #0  main (argc=4, argv=0xf7fffae8) at m4.c:206
  1066.           206                 expand_input();
  1067.           (gdb) until
  1068.           195             for ( ; argc > 0; NEXTARG) {
  1069.  
  1070.      This happened because, for execution efficiency, the compiler had
  1071.      generated code for the loop closure test at the end, rather than
  1072.      the start, of the loop--even though the test in a C `for'-loop is
  1073.      written before the body of the loop.  The `until' command appeared
  1074.      to step back to the beginning of the loop when it advanced to this
  1075.      expression; however, it has not really gone to an earlier
  1076.      statement--not in terms of the actual machine code.
  1077.  
  1078.      `until' with no argument works by means of single instruction
  1079.      stepping, and hence is slower than `until' with an argument.
  1080.  
  1081. `until LOCATION'
  1082. `u LOCATION'
  1083.      Continue running your program until either the specified location
  1084.      is reached, or the current stack frame returns.  LOCATION is any of
  1085.      the forms of argument acceptable to `break' (*note Setting
  1086.      breakpoints: Set Breaks.).  This form of the command uses
  1087.      breakpoints, and hence is quicker than `until' without an argument.
  1088.  
  1089. `stepi'
  1090. `si'
  1091.      Execute one machine instruction, then stop and return to the
  1092.      debugger.
  1093.  
  1094.      It is often useful to do `display/i $pc' when stepping by machine
  1095.      instructions.  This makes GDB automatically display the next
  1096.      instruction to be executed, each time your program stops.  *Note
  1097.      Automatic display: Auto Display.
  1098.  
  1099.      An argument is a repeat count, as in `step'.
  1100.  
  1101. `nexti'
  1102. `ni'
  1103.      Execute one machine instruction, but if it is a function call,
  1104.      proceed until the function returns.
  1105.  
  1106.      An argument is a repeat count, as in `next'.
  1107.  
  1108. 
  1109. File: gdb.info,  Node: Signals,  Next: Thread Stops,  Prev: Continuing and Stepping,  Up: Stopping
  1110.  
  1111. Signals
  1112. =======
  1113.  
  1114.    A signal is an asynchronous event that can happen in a program.  The
  1115. operating system defines the possible kinds of signals, and gives each
  1116. kind a name and a number.  For example, in Unix `SIGINT' is the signal
  1117. a program gets when you type an interrupt (often `C-c'); `SIGSEGV' is
  1118. the signal a program gets from referencing a place in memory far away
  1119. from all the areas in use; `SIGALRM' occurs when the alarm clock timer
  1120. goes off (which happens only if your program has requested an alarm).
  1121.  
  1122.    Some signals, including `SIGALRM', are a normal part of the
  1123. functioning of your program.  Others, such as `SIGSEGV', indicate
  1124. errors; these signals are "fatal" (kill your program immediately) if the
  1125. program has not specified in advance some other way to handle the
  1126. signal.  `SIGINT' does not indicate an error in your program, but it is
  1127. normally fatal so it can carry out the purpose of the interrupt: to
  1128. kill the program.
  1129.  
  1130.    GDB has the ability to detect any occurrence of a signal in your
  1131. program.  You can tell GDB in advance what to do for each kind of
  1132. signal.
  1133.  
  1134.    Normally, GDB is set up to ignore non-erroneous signals like
  1135. `SIGALRM' (so as not to interfere with their role in the functioning of
  1136. your program) but to stop your program immediately whenever an error
  1137. signal happens.  You can change these settings with the `handle'
  1138. command.
  1139.  
  1140. `info signals'
  1141.      Print a table of all the kinds of signals and how GDB has been
  1142.      told to handle each one.  You can use this to see the signal
  1143.      numbers of all the defined types of signals.
  1144.  
  1145. `handle SIGNAL KEYWORDS...'
  1146.      Change the way GDB handles signal SIGNAL.  SIGNAL can be the
  1147.      number of a signal or its name (with or without the `SIG' at the
  1148.      beginning).  The KEYWORDS say what change to make.
  1149.  
  1150.    The keywords allowed by the `handle' command can be abbreviated.
  1151. Their full names are:
  1152.  
  1153. `nostop'
  1154.      GDB should not stop your program when this signal happens.  It may
  1155.      still print a message telling you that the signal has come in.
  1156.  
  1157. `stop'
  1158.      GDB should stop your program when this signal happens.  This
  1159.      implies the `print' keyword as well.
  1160.  
  1161. `print'
  1162.      GDB should print a message when this signal happens.
  1163.  
  1164. `noprint'
  1165.      GDB should not mention the occurrence of the signal at all.  This
  1166.      implies the `nostop' keyword as well.
  1167.  
  1168. `pass'
  1169.      GDB should allow your program to see this signal; your program can
  1170.      handle the signal, or else it may terminate if the signal is fatal
  1171.      and not handled.
  1172.  
  1173. `nopass'
  1174.      GDB should not allow your program to see this signal.
  1175.  
  1176.    When a signal stops your program, the signal is not visible until you
  1177. continue.  Your program sees the signal then, if `pass' is in effect
  1178. for the signal in question *at that time*.  In other words, after GDB
  1179. reports a signal, you can use the `handle' command with `pass' or
  1180. `nopass' to control whether your program sees that signal when you
  1181. continue.
  1182.  
  1183.    You can also use the `signal' command to prevent your program from
  1184. seeing a signal, or cause it to see a signal it normally would not see,
  1185. or to give it any signal at any time.  For example, if your program
  1186. stopped due to some sort of memory reference error, you might store
  1187. correct values into the erroneous variables and continue, hoping to see
  1188. more execution; but your program would probably terminate immediately as
  1189. a result of the fatal signal once it saw the signal.  To prevent this,
  1190. you can continue with `signal 0'.  *Note Giving your program a signal:
  1191. Signaling.
  1192.  
  1193.