* gdb.texinfo (New Features): mention threads.
[deliverable/binutils-gdb.git] / gdb / doc / gdb.texinfo
index aaddb7c9a859e8dc8f60f3ffb9034f6fedb69f76..7eb6c5bab4fec32a00af4ca6c07ec205c9e1f1a9 100644 (file)
 @c readline appendices use @vindex
 @syncodeindex vr cp
 
-@c ===> NOTE! <==
-@c Determine the edition number in *three* places by hand:
-@c      1. First ifinfo section  2. title page  3. top node
-@c To find the locations, search for !!set
+@c !!set GDB manual's edition---not the same as GDB version!
+@set EDITION 4.10
+
+@c !!set GDB manual's revision date
+@set DATE November 1993
 
 @c GDB CHANGELOG CONSULTED BETWEEN:
 @c Fri Oct 11 23:27:06 1991  John Gilmore  (gnu at cygnus.com)
@@ -53,12 +54,12 @@ END-INFO-DIR-ENTRY
 @ifinfo
 This file documents the GNU debugger @value{GDBN}.
 
-@c !!set edition, date, version
-This is Edition 4.09, April 1993
+
+This is Edition @value{EDITION}, @value{DATE}
 of @cite{Debugging with @value{GDBN}: the GNU Source-Level Debugger}
 for GDB Version @value{GDBVN}.
 
-Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -87,10 +88,9 @@ into another language, under the above conditions for modified versions.
 @subtitle (@value{TARGET})
 @end ifclear
 @sp 1
-@c !!set edition, date, version
-@subtitle Edition 4.09, for @value{GDBN} version @value{GDBVN}
-@subtitle April 1993
-@author by Richard M. Stallman and Roland H. Pesch
+@subtitle Edition @value{EDITION}, for @value{GDBN} version @value{GDBVN}
+@subtitle @value{DATE}
+@author Richard M. Stallman and Roland H. Pesch
 @page
 @tex
 {\parskip=0pt
@@ -102,7 +102,14 @@ into another language, under the above conditions for modified versions.
 @end tex
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+Copyright @copyright{} 1988, '89, '90, '91, '92, '93 Free Software
+Foundation, Inc. 
+@sp 2
+Published by the Free Software Foundation @*
+675 Massachusetts Avenue, @*
+Cambridge, MA 02139 USA @*
+Printed copies are available for $20 each. @*
+ISBN 1-882114-11-6 @*
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -124,8 +131,7 @@ into another language, under the above conditions for modified versions.
 
 This file describes @value{GDBN}, the GNU symbolic debugger.
 
-@c !!set edition, date, version
-This is Edition 4.09, April 1993, for GDB Version @value{GDBVN}.
+This is Edition @value{EDITION}, @value{DATE}, for GDB Version @value{GDBVN}.
 
 @menu
 * Summary::                     Summary of @value{GDBN}
@@ -202,14 +208,21 @@ effects of one bug and go on to learn about another.
 @end itemize
 
 @ifclear CONLY
-@ifclear MOD2
-You can use @value{GDBN} to debug programs written in C or C++.
-@end ifclear
+You can use @value{GDBN} to debug programs written in C or C++.  For
+more information, see @ref{C,,C and C++}.
+
 @ifset MOD2
-You can use @value{GDBN} to debug programs written in C, C++, and
-Modula-2.
+@c "MOD2" used as a "miscellaneous languages" flag here.
+@c This is acceptable while there is no real doc for Chill and Pascal.
+Support for Modula-2 and Chill is partial.  For information on Modula-2,
+see @ref{Modula-2,,Modula-2}; there is no further documentation on Chill yet.
+
+Debugging pascal programs which use sets, subranges, file variables, or nested
+functions does not currently work.  @value{GDBN} does not support
+entering expressions, printing values, etc. using Pascal syntax.
 @end ifset
 @ifset FORTRAN
+@cindex Fortran
 @value{GDBN} can be used to debug programs written in Fortran, although
 it does not yet support entering expressions, printing values, etc.
 using Fortran syntax.  It may be necessary to refer to some variables
@@ -258,14 +271,14 @@ omitted from this list, we would like to add your names!
 
 So that they may not regard their long labor as thankless, we
 particularly thank those who shepherded GDB through major releases: Fred
-Fish (release 4.9), Stu Grossman and John Gilmore (releases 4.8, 4.7,
-4.6, 4.5, 4.4), John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim
-Kingdon (releases 3.5, 3.4, 3.3); and Randy Smith (releases 3.2, 3.1,
-3.0).  As major maintainer of GDB for some period, each contributed
-significantly to the structure, stability, and capabilities of the
-entire debugger.
-
-Richard Stallman, assisted at various times by Pete TerMaat, Chris
+Fish (releases 4.11, 4.10, 4.9), Stu Grossman and John Gilmore (releases
+4.8, 4.7, 4.6, 4.5, 4.4), John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and
+3.9); Jim Kingdon (releases 3.5, 3.4, 3.3); and Randy Smith (releases
+3.2, 3.1, 3.0).  As major maintainer of GDB for some period, each
+contributed significantly to the structure, stability, and capabilities
+of the entire debugger.
+
+Richard Stallman, assisted at various times by Peter TerMaat, Chris
 Hanson, and Richard Mlynarik, handled releases through 2.8.
 
 @ifclear CONLY
@@ -402,6 +415,9 @@ of your program, and the latter refer to the state of GDB itself.
 GDB 4 can debug programs and core files that use SunOS, SVR4, or IBM RS/6000
 shared libraries.
 
+@item Threads
+On some systems, GDB 4 has facilities to debug multi-thread programs.
+
 @item Reference Card
 GDB 4 has a reference card.  @xref{Formatting Documentation,,Formatting
 the Documentation}, for instructions about how to print it.
@@ -830,11 +846,11 @@ them, so long as enough of the option is present to be unambiguous.
 than @samp{-}, though we illustrate the more usual convention.)
 
 @table @code
-@item -symbols=@var{file}
+@item -symbols @var{file}
 @itemx -s @var{file}
 Read symbol table from file @var{file}.
 
-@item -exec=@var{file}
+@item -exec @var{file}
 @itemx -e @var{file}
 Use file @var{file} as the executable file to execute when
 @ifset BARETARGET
@@ -845,12 +861,12 @@ appropriate, and for examining pure data in conjunction with a core
 dump.
 @end ifclear
 
-@item -se=@var{file}
+@item -se @var{file}
 Read symbol table from file @var{file} and use it as the executable
 file.
 
 @ifclear BARETARGET
-@item -core=@var{file}
+@item -core @var{file}
 @itemx -c @var{file}
 Use file @var{file} as a core dump to examine.
 
@@ -860,12 +876,12 @@ Connect to process ID @var{number}, as with the @code{attach} command
 case @samp{-c} specifies that file as a core dump to read).
 @end ifclear
 
-@item -command=@var{file}
+@item -command @var{file}
 @itemx -x @var{file}
 Execute @value{GDBN} commands from file @var{file}.  @xref{Command
 Files,, Command files}.
 
-@item -directory=@var{directory}
+@item -directory @var{directory}
 @itemx -d @var{directory}
 Add @var{directory} to the path to search for source files.
 
@@ -946,7 +962,7 @@ Program exited normally.
 (which is ordinarily issued whenever a program running under @value{GDBN} control
 terminates) is not issued when running in batch mode.
 
-@item -cd=@var{directory}
+@item -cd @var{directory}
 Run @value{GDBN} using @var{directory} as its working directory,
 instead of the current directory.
 
@@ -978,7 +994,7 @@ a signal to display the source code for the frame.
 Set the line speed (baud rate or bits per second) of any serial
 interface used by @value{GDBN} for remote debugging.
 
-@item -tty=@var{device}
+@item -tty @var{device}
 Run using @var{device} for your program's standard input and output.
 @c FIXME: kingdon thinks there is more to -tty.  Investigate.
 @end ifset
@@ -1365,6 +1381,7 @@ already running process, or kill a child process.
 * Attach::                      Debugging an already-running process
 * Kill Process::                Killing the child process
 * Process Information::         Additional process information
+* Threads::                    Debugging programs with multiple threads
 @end ifclear
 @end menu
 
@@ -1408,22 +1425,6 @@ Older versions of the GNU C compiler permitted a variant option
 @w{@samp{-gg}} for debugging information.  @value{GDBN} no longer supports this
 format; if your GNU C compiler has this option, do not use it.
 
-@ignore
-@comment As far as I know, there are no cases in which @value{GDBN} will
-@comment produce strange output in this case.  (but no promises).
-If your program includes archives made with the @code{ar} program, and
-if the object files used as input to @code{ar} were compiled without the
-@samp{-g} option and have names longer than 15 characters, @value{GDBN} will get
-confused reading your program's symbol table.  No error message will be
-given, but @value{GDBN} may behave strangely.  The reason for this problem is a
-deficiency in the Unix archive file format, which cannot represent file
-names longer than 15 characters.
-
-To avoid this problem, compile the archive members with the @samp{-g}
-option or use shorter file names.  Alternatively, use a version of GNU
-@code{ar} dated more recently than August 1989.
-@end ignore
-
 @need 2000
 @node Starting
 @section Starting your program
@@ -1497,7 +1498,7 @@ wrong program.
 When you issue the @code{run} command, your program begins to execute
 immediately.  @xref{Stopping, ,Stopping and continuing}, for discussion
 of how to arrange for your program to stop.  Once your program has
-stopped, you may calls functions in your program, using the @code{print}
+stopped, you may call functions in your program, using the @code{print}
 or @code{call} commands.  @xref{Data, ,Examining Data}.
 
 If the modification time of your symbol file has changed since the
@@ -1812,6 +1813,157 @@ received.
 @item info proc all
 Show all the above information about the process.
 @end table
+
+@node Threads
+@section Debugging programs with multiple threads
+
+@cindex threads of execution
+@cindex multiple threads
+@cindex switching threads
+In some operating systems, a single program may have more than one
+@dfn{thread} of execution.  The precise semantics of threads differ from
+one operating system to another, but in general the threads of a single
+program are akin to multiple processes---except that they share one
+address space (that is, they can all examine and modify the same
+variables).  On the other hand, each thread has its own registers and
+execution stack, and perhaps private memory.
+
+@value{GDBN} provides these facilities for debugging multi-thread
+programs:
+
+@itemize @bullet
+@item automatic notification of new threads
+@item @samp{thread @var{threadno}}, a command to switch among threads
+@item @samp{info threads}, a command to inquire about existing threads
+@item thread-specific breakpoints
+@end itemize
+
+@quotation
+@emph{Warning:} These facilities are not yet available on every
+@value{GDBN} configuration where the operating system supports threads.
+If your @value{GDBN} does not support threads, these commands have no
+effect.  For example, a system without thread support shows no output
+from @samp{info threads}, and always rejects the @code{thread} command,
+like this:
+
+@smallexample
+(@value{GDBP}) info threads
+(@value{GDBP}) thread 1
+Thread ID 1 not known.  Use the "info threads" command to
+see the IDs of currently known threads.
+@end smallexample
+@c FIXME to implementors: how hard would it be to say "sorry, this GDB
+@c                        doesn't support threads"?
+@end quotation
+
+@cindex focus of debugging
+@cindex current thread
+The @value{GDBN} thread debugging facility allows you to observe all
+threads while your program runs---but whenever @value{GDBN} takes
+control, one thread in particular is always the focus of debugging.
+This thread is called the @dfn{current thread}.  Debugging commands show
+program information from the perspective of the current thread.
+
+@kindex New @var{systag}
+@cindex thread identifier (system)
+@c FIXME-implementors!! It would be more helpful if the [New...] message
+@c included GDB's numeric thread handle, so you could just go to that
+@c thread without first checking `info threads'.
+Whenever @value{GDBN} detects a new thread in your program, it displays
+the target system's identification for the thread with a message in the
+form @samp{[New @var{systag}]}.  @var{systag} is a thread identifier
+whose form varies depending on the particular system.  For example, on
+LynxOS, you might see
+
+@example
+[New process 35 thread 27]
+@end example
+
+@noindent
+when @value{GDBN} notices a new thread.  In contrast, on an SGI system,
+the @var{systag} is simply something like @samp{process 368}, with no
+further qualifier.
+
+@c FIXME!! (1) Does the [New...] message appear even for the very first
+@c         thread of a program, or does it only appear for the
+@c         second---i.e., when it becomes obvious we have a multithread
+@c         program?
+@c         (2) *Is* there necessarily a first thread always?  Or do some
+@c         multithread systems permit starting a program with multiple
+@c         threads ab initio?      
+
+@cindex thread number
+@cindex thread identifier (GDB)
+For debugging purposes, @value{GDBN} associates its own thread
+number---always a single integer---with each thread in your program.
+
+@table @code
+@item info threads
+@kindex info threads
+Display a summary of all threads currently in your
+program.  @value{GDBN} displays for each thread (in this order):
+
+@enumerate
+@item the thread number assigned by @value{GDBN}
+
+@item the target system's thread identifier (@var{systag})
+
+@item the current stack frame summary for that thread
+@end enumerate
+
+@noindent
+An asterisk @samp{*} to the left of the @value{GDBN} thread number
+indicates the current thread.
+
+For example, 
+@end table
+@c end table here to get a little more width for example
+
+@smallexample
+(@value{GDBP}) info threads
+  3 process 35 thread 27  0x34e5 in sigpause ()
+  2 process 35 thread 23  0x34e5 in sigpause ()
+* 1 process 35 thread 13  main (argc=1, argv=0x7ffffff8)
+    at threadtest.c:68
+@end smallexample
+
+@table @code
+@item thread @var{threadno}
+@kindex thread @var{threadno}
+Make thread number @var{threadno} the current thread.  The command
+argument @var{threadno} is the internal @value{GDBN} thread number, as
+shown in the first field of the @samp{info threads} display.
+@value{GDBN} responds by displaying the system identifier of the thread
+you selected, and its current stack frame summary:
+
+@smallexample
+@c FIXME!! This example made up; find a GDB w/threads and get real one
+(@value{GDBP}) thread 2
+[Switching to process 35 thread 23]
+0x34e5 in sigpause ()
+@end smallexample
+
+@noindent
+As with the @samp{[New @dots{}]} message, the form of the text after
+@samp{Switching to} depends on your system's conventions for identifying
+threads.  
+@end table
+
+@cindex automatic thread selection
+@cindex switching threads automatically
+@cindex threads, automatic switching
+Whenever @value{GDBN} stops your program, due to a breakpoint or a
+signal, it automatically selects the thread where that breakpoint or
+signal happened.  @value{GDBN} alerts you to the context switch with a
+message of the form @samp{[Switching to @var{systag}]} to identify the
+thread.
+
+@xref{Thread Stops,,Stopping and starting multi-thread programs}, for
+more information about how @value{GDBN} behaves when you stop and start
+programs with multiple threads.
+
+@xref{Set Watchpoints,,Setting watchpoints}, for information about
+watchpoints in programs with multiple threads.
 @end ifclear
 
 @node Stopping
@@ -1857,6 +2009,9 @@ and why it stopped.
 @ifset POSIX
 * Signals::                     Signals
 @end ifset
+@ifclear BARETARGET
+* Thread Stops::               Stopping and starting multi-thread programs
+@end ifclear
 @end menu
 
 @c makeinfo node-defaulting requires adjacency of @node and sectioning cmds
@@ -1881,8 +2036,8 @@ your program should stop by line number, function name or exact address
 in the program.  
 @ifclear CONLY
 In languages with exception handling (such as GNU C++), you can also set
-breakpoints where an exception is raised (@pxref{Exception Handling,
-,Breakpoints and exceptions}).
+breakpoints where an exception is raised (@pxref{Exception Handling,,
+Breakpoints and exceptions}).
 @end ifclear
 
 @cindex watchpoints
@@ -1897,8 +2052,8 @@ any other breakpoint: you enable, disable, and delete both breakpoints
 and watchpoints using the same commands.
 
 You can arrange to have values from your program displayed automatically
-whenever @value{GDBN} stops at a breakpoint.  @xref{Auto Display,
-,Automatic display}.
+whenever @value{GDBN} stops at a breakpoint.  @xref{Auto Display,,
+Automatic display}.
 
 @cindex breakpoint numbers
 @cindex numbers for breakpoints
@@ -2126,7 +2281,7 @@ expression changes, without having to predict a particular place
 where this may happen.
 
 Watchpoints currently execute two orders of magnitude more slowly than
-other breakpoints, but this can well be worth it to catch errors where
+other breakpoints, but this can be well worth it to catch errors where
 you have no clue what part of your program is the culprit.  Some
 processors provide special hardware to support watchpoint evaluation; future
 releases of @value{GDBN} will use such hardware if it is available.
@@ -2142,6 +2297,21 @@ This command prints a list of watchpoints and breakpoints; it is the
 same as @code{info break}.
 @end table
 
+@ifclear BARETARGET
+@quotation
+@cindex watchpoints and threads
+@cindex threads and watchpoints
+@emph{Warning:} in multi-thread programs, watchpoints have only limited
+usefulness.  With the current watchpoint implementation, @value{GDBN}
+can only watch the value of an expression @emph{in a single thread}.  If
+you are confident that the expression can only change due to the current
+thread's activity (and if you are also confident that the same thread
+will remain current), then you can use watchpoints as usual.  However,
+@value{GDBN} may not notice when a non-current thread's activity changes
+the expression.
+@end quotation
+@end ifclear
+
 @ifclear CONLY
 @node Exception Handling
 @subsection Breakpoints and exceptions
@@ -2510,45 +2680,6 @@ cont
 end
 @end example
 
-@cindex lost output
-@c Do we need to mention this at all?  I am sort of tempted to mention
-@c it in case people are used to seeing this section of the manual.  But
-@c for new users it is an annoyance--it documents something which isn't
-@c there.  -kingdon, 6 Jul 93
-Previous versions of @value{GDBN} (4.9 and earlier) would flush pending
-input when executing breakpoint commands, if your program used raw mode
-for the terminal.  This is no longer true.
-
-@ignore
-@c I don't think this is true any longer, now that only readline
-@c switches to or from raw mode.  In any event, it is a (relatively
-@c easily fixable) GDB bug if it switches to or from raw mode except
-@c when it has to in order to read input from the terminal.  kingdon -6 Jul 93.
-One deficiency in the operation of automatically continuing breakpoints
-under Unix appears when your program uses raw mode for the terminal.
-@value{GDBN} switches back to its own terminal modes (not raw) before executing
-commands, and then must switch back to raw mode when your program is
-continued.  This causes any pending terminal input to be lost.
-@c FIXME: revisit below when GNU sys avail.
-@c In the GNU system, this will be fixed by changing the behavior of
-@c terminal modes.
-
-Under Unix, you can get around this problem by writing actions into
-the breakpoint condition rather than in commands.  For example,
-
-@example
-condition 5  (x = y + 4), 0
-@end example
-
-@noindent
-specifies a condition expression (@pxref{Expressions, ,Expressions}) that will
-change @code{x} as needed, then always have the value zero so your
-program will not stop.  No input is lost here, because @value{GDBN} evaluates
-break conditions without changing the terminal modes.  When you want
-to have nontrivial conditions for performing the side effects, the
-operators @samp{&&}, @samp{||} and @samp{?@dots{}:} may be useful.
-@end ignore
-
 @ifclear CONLY
 @node Breakpoint Menus
 @subsection Breakpoint menus
@@ -2646,27 +2777,25 @@ or when stepping, your program may stop even sooner, due to
 a breakpoint.
 @end ifset
 @ifclear BARETARGET
-a breakpoint or to a signal.  (If due to a signal, you may want to use
+a breakpoint or a signal.  (If due to a signal, you may want to use
 @code{handle}, or use @samp{signal 0} to resume execution.
 @xref{Signals, ,Signals}.)
 @end ifclear
 
 @table @code
-@item continue @r{[}@var{count}@r{]}
-@itemx c @r{[}@var{count}@r{]}
-@itemx fg @r{[}@var{count}@r{]}
+@item continue @r{[}@var{ignore-count}@r{]}
+@itemx c @r{[}@var{ignore-count}@r{]}
+@itemx fg @r{[}@var{ignore-count}@r{]}
 @kindex continue
 @kindex c
 @kindex fg
-Resume program execution, at the address where your program last
-stopped; any breakpoints set at that address are bypassed.  The optional
-argument @var{count} means to set the ignore count of a breakpoint which
-you are stopped at to @var{count} @minus{} 1, just like the @code{ignore}
-command (@pxref{Conditions, ,Break conditions}).  This means that the
-program does not stop at that breakpoint until the @var{count}th time
-it is hit.
-
-The argument @var{count} is meaningful only when your program
+Resume program execution, at the address where your program last stopped;
+any breakpoints set at that address are bypassed.  The optional argument
+@var{ignore-count} allows you to specify a further number of times to
+ignore a breakpoint at this location; its effect is like that of
+@code{ignore} (@pxref{Conditions, ,Break conditions}).
+
+The argument @var{ignore-count} is meaningful only when your program
 stopped due to a breakpoint.  At other times, the argument to
 @code{continue} is ignored.
 
@@ -2741,7 +2870,7 @@ Contrast this with the @code{return} command (@pxref{Returning,
 
 @item until
 @kindex until
-@item u
+@itemx u
 @kindex u
 Continue running until a source line past the current line, in the
 current stack frame, is reached.  This command is used to avoid single
@@ -2786,7 +2915,7 @@ instruction stepping, and hence is slower than @code{until} with an
 argument.
 
 @item until @var{location}
-@item u @var{location}
+@itemx u @var{location}
 Continue running your program until either the specified location is
 reached, or the current stack frame returns.  @var{location} is any of
 the forms of argument acceptable to @code{break} (@pxref{Set Breaks,
@@ -2911,6 +3040,67 @@ you can continue with @samp{signal 0}.  @xref{Signaling, ,Giving your
 program a signal}. 
 @end ifset
 
+@ifclear BARETARGET
+@node Thread Stops
+@section Stopping and starting multi-thread programs
+
+When your program has multiple threads (@pxref{Threads,, Debugging
+programs with multiple threads}), you can choose whether to set
+breakpoints on all threads, or on a particular thread.
+
+@table @code
+@cindex breakpoints and threads
+@cindex thread breakpoints
+@kindex break @dots{} thread @var{threadno}
+@item break @var{linespec} thread @var{threadno}
+@itemx break @var{linespec} thread @var{threadno} if @dots{}
+Use the qualifier @samp{thread @var{threadno}} with a breakpoint command
+to specify that you only want @value{GDBN} to stop the program when a
+particular thread reaches this breakpoint.  @var{threadno} is one of the
+numeric thread identifiers assigned by @value{GDBN}, shown in the first
+column of the @samp{info threads} display.
+
+If you do not specify @samp{thread @var{threadno}} when you set a
+breakpoint, the breakpoint applies to @emph{all} threads of your
+program.
+
+You can use the @code{thread} qualifier on conditional breakpoints as
+well; in this case, place @samp{thread @var{threadno}} before the
+breakpoint condition, like this:
+
+@smallexample
+(gdb) break frik.c:13 thread 28 if bartab > lim
+@end smallexample
+@end table
+
+@cindex stopped threads
+@cindex threads, stopped
+Whenever your program stops under @value{GDBN} for any reason,
+@emph{all} threads of execution stop, not just the current thread.  This
+allows you to examine the overall state of the program, including
+switching between threads, without worrying that things may change
+underfoot.
+
+@cindex continuing threads
+@cindex threads, continuing
+Conversely, whenever you restart the program, @emph{all} threads start
+executing.  @emph{This is true even when single-stepping} with commands
+like @code{step} or @code{next}.  
+
+In particular, @value{GDBN} cannot single-step all threads in lockstep.
+Since thread scheduling is up to your debugging target's operating
+system (not controlled by @value{GDBN}), other threads may
+execute more than one statement while the current thread completes a
+single step.  Moreover, in general other threads stop in the middle of a
+statement, rather than at a clean statement boundary, when the program
+stops.
+
+You might even find your program stopped in another thread after
+continuing or even single-stepping.  This happens whenever some other
+thread runs into a breakpoint, a signal, or an exception before the
+first thread completes whatever you requested.
+@end ifclear
+
 @node Stack
 @chapter Examining the Stack
 
@@ -2988,6 +3178,7 @@ and so on upward.  These numbers do not really exist in your program;
 they are assigned by @value{GDBN} to give you a way of designating stack
 frames in @value{GDBN} commands.
 
+@c below produces an acceptable overful hbox. --mew 13aug1993
 @cindex frameless execution
 Some compilers provide a way to compile functions so that they operate
 without stack frames.  (For example, the @code{@value{GCC}} option
@@ -3220,7 +3411,7 @@ commands:
 @cindex @code{heuristic-fence-post} (MIPS)
 @table @code
 @item set heuristic-fence-post @var{limit}
-Restrict @var{GDBN} to examining at most @var{limit} bytes in its search
+Restrict @value{GDBN} to examining at most @var{limit} bytes in its search
 for the beginning of a function.  A value of @code{0} (the default)
 means there is no limit.
 
@@ -3444,6 +3635,15 @@ directory names may be given to this command, separated by @samp{:} or
 whitespace.  You may specify a directory that is already in the source
 path; this moves it forward, so it will be searched sooner.
 
+@kindex cdir
+@kindex cwd
+@kindex $cdir
+@kindex $cwd
+@cindex compilation directory
+@cindex current directory
+@cindex working directory
+@cindex directory, current
+@cindex directory, compilation
 You can use the string @samp{$cdir} to refer to the compilation
 directory (if one is recorded), and @samp{$cwd} to refer to the current
 working directory.  @samp{$cwd} is not the same as @samp{.}---the former
@@ -4108,7 +4308,7 @@ These settings are useful for debugging programs in any language:
 
 @table @code
 @item set print address
-@item set print address on
+@itemx set print address on
 @kindex set print address
 @value{GDBN} will print memory addresses showing the location of stack
 traces, structure values, pointer values, breakpoints, and so forth,
@@ -4413,10 +4613,11 @@ pointers back to the types defined in the symbol table.
 @cindex @code{$}
 @cindex @code{$$}
 @cindex history number
-The values printed are given @dfn{history numbers} for you to refer to them
-by.  These are successive integers starting with one.  @code{print} shows you
-the history number assigned to a value by printing @samp{$@var{num} = }
-before the value; here @var{num} is the history number.
+The values printed are given @dfn{history numbers} by which you can
+refer to them.  These are successive integers starting with one.
+@code{print} shows you the history number assigned to a value by
+printing @samp{$@var{num} = } before the value; here @var{num} is the
+history number.
 
 To refer to any previous value, use @samp{$} followed by the value's
 history number.  The way @code{print} labels its output is designed to
@@ -4502,9 +4703,9 @@ set $foo = *object_ptr
 would save in @code{$foo} the value contained in the object pointed to by
 @code{object_ptr}.
 
-Using a convenience variable for the first time creates it; but its value
-is @code{void} until you assign a new value.  You can alter the value with
-another assignment at any time.
+Using a convenience variable for the first time creates it, but its
+value is @code{void} until you assign a new value.  You can alter the
+value with another assignment at any time.
 
 Convenience variables have no fixed types.  You can assign a convenience
 variable any type of value, including structures and arrays, even if
@@ -4995,7 +5196,7 @@ is printed and evaluation of the expression is aborted.
 Output messages when the @value{GDBN} range checker detects a range error,
 but attempt to evaluate the expression anyway.  Evaluating the
 expression may still be impossible for other reasons, such as accessing
-memory that the process does not own (a typical example from many UNIX
+memory that the process does not own (a typical example from many Unix
 systems).
 
 @item show range
@@ -5051,9 +5252,15 @@ together.
 @kindex g++
 @cindex GNU C++
 The C++ debugging facilities are jointly implemented by the GNU C++
-compiler and @value{GDBN}.  Therefore, to debug your C++ code effectively,
-you must compile your C++ programs with the GNU C++ compiler,
-@code{g++}.
+compiler and @value{GDBN}.  Therefore, to debug your C++ code
+effectively, you must compile your C++ programs with the GNU C++
+compiler, @code{g++}.
+
+For best results when debugging C++ programs, use the stabs debugging
+format.  You can select that format explicitly with the @code{g++}
+command-line options @samp{-gstabs} or @samp{-gstabs+}.  See
+@ref{Debugging Options,,Options for Debugging Your Program or GNU CC,
+gcc.info, Using GNU CC}, for more information.
 @end ifclear
 @ifset CONLY
 @node C
@@ -5700,7 +5907,7 @@ represents a variable or constant of integral type.
 @item m
 represents an identifier that belongs to a set.  Generally used in the
 same function with the metavariable @var{s}.  The type of @var{s} should
-be @code{SET OF @var{mtype}} (where @var{mtype} is the type of @var{m}.
+be @code{SET OF @var{mtype}} (where @var{mtype} is the type of @var{m}).
 
 @item n
 represents a variable or constant of integral or floating-point type.
@@ -6018,7 +6225,7 @@ local variable, this prints the stack-frame offset at which the variable
 is always stored.
 
 Note the contrast with @samp{print &@var{symbol}}, which does not work
-at all for a register variables, and for a stack local variable prints
+at all for a register variable, and for a stack local variable prints
 the exact address of the current instantiation of the variable.
 
 @item whatis @var{exp}
@@ -6035,6 +6242,9 @@ Print the data type of @code{$}, the last value in the value history.
 @kindex ptype
 Print a description of data type @var{typename}.  @var{typename} may be
 the name of a type, or for C code it may have the form
+@ifclear CONLY
+@samp{class @var{class-name}},
+@end ifclear
 @samp{struct @var{struct-tag}}, @samp{union @var{union-tag}} or
 @samp{enum @var{enum-tag}}.
 
@@ -6311,12 +6521,14 @@ already executed, in order to examine its execution in more detail.
 @section Giving your program a signal
 
 @table @code
-@item signal @var{signalnum}
+@item signal @var{signal}
 @kindex signal
-Resume execution where your program stopped, but give it immediately the
-signal number @var{signalnum}.
+Resume execution where your program stopped, but immediately give it the
+signal @var{signal}.  @var{signal} can be the name or the number of a
+signal.  For example, on many systems @code{signal 2} and @code{signal
+SIGINT} are both ways of sending an interrupt signal.
 
-Alternatively, if @var{signalnum} is zero, continue execution without
+Alternatively, if @var{signal} is zero, continue execution without
 giving a signal.  This is useful when your program stopped on account of
 a signal and would ordinary see the signal when resumed with the
 @code{continue} command; @samp{signal 0} causes it to resume without a
@@ -6326,6 +6538,13 @@ signal.
 after executing the command.
 @end table
 @c @end group
+
+Invoking the @code{signal} command is not the same as invoking the
+@code{kill} utility from the shell.  Sending a signal with @code{kill}
+causes @value{GDBN} to decide what to do with the signal depending on
+the signal handling tables (@pxref{Signals}).  The @code{signal} command
+passes the signal directly to your program.
+
 @end ifclear
 
 @node Returning
@@ -6612,6 +6831,12 @@ execute it gets the error message ``@code{You can't do that when your
 target is @dots{}}''
 @end ifset
 
+The file is loaded at whatever address is specified in the executable.
+For some object file formats, you can specify the load address when you
+link the program; for other formats, like a.out, the object file format
+specifies a fixed address.
+@c FIXME! This would be a good place for an xref to the GNU linker doc.
+
 @ifset VXWORKS
 On VxWorks, @code{load} will dynamically link @var{filename} on the
 current target system as well as adding its symbols in @value{GDBN}.
@@ -6707,12 +6932,12 @@ Print the names of the shared libraries which are currently loaded.
 @itemx share @var{regex}
 @kindex sharedlibrary
 @kindex share
-This is an obsolescent command; you can use it to explicitly
-load shared object library symbols for files matching a UNIX regular
-expression, but as with files loaded automatically, it will only load
-shared libraries required by your program for a core file or after
-typing @code{run}.  If @var{regex} is omitted all shared libraries
-required by your program are loaded.
+This is an obsolescent command; you can use it to explicitly load shared
+object library symbols for files matching a Unix regular expression, but
+as with files loaded automatically, it will only load shared libraries
+required by your program for a core file or after typing @code{run}.  If
+@var{regex} is omitted all shared libraries required by your program are
+loaded.
 @end table
 @end ifclear
 
@@ -7528,11 +7753,14 @@ it would from the terminal.
 @cindex init file
 @cindex @file{@value{GDBINIT}}
 When you start @value{GDBN}, it automatically executes commands from its
-@dfn{init files}.  These are files named @file{@value{GDBINIT}}.  @value{GDBN} reads
-the init file (if any) in your home directory and then the init file
-(if any) in the current working directory.  (The init files are not
-executed if you use the @samp{-nx} option; @pxref{Mode Options,
-,Choosing modes}.)
+@dfn{init files}.  These are files named @file{@value{GDBINIT}}.
+@value{GDBN} reads the init file (if any) in your home directory, then
+processes command line options and operands, and then reads the init
+file (if any) in the current working directory.  This is so the init
+file in your home directory can set options (such as @code{set
+complaints}) which affect the processing of the command line options and
+operands.  The init files are not executed if you use the @samp{-nx}
+option; @pxref{Mode Options, ,Choosing modes}.
 
 @ifset GENERIC
 @cindex init file name
This page took 0.036084 seconds and 4 git commands to generate.