@c
@include gdb-cfg.texi
@c
-@ifset GENERIC
@settitle Debugging with @value{GDBN}
-@end ifset
-@ifclear GENERIC
-@settitle Debugging with @value{GDBN} (@value{TARGET})
-@end ifclear
@setchapternewpage odd
@c %**end of header
@titlepage
@title Debugging with @value{GDBN}
@subtitle The @sc{gnu} Source-Level Debugger
-@ifclear GENERIC
-@subtitle (@value{TARGET})
-@end ifclear
@sp 1
@ifclear HPPA
@subtitle @value{EDITION} Edition, for @value{GDBN} version @value{GDBVN}
Copyright (C) 1988-1999 Free Software Foundation, Inc.
@menu
* Summary:: Summary of @value{GDBN}
-@ifclear BARETARGET
* Sample Session:: A sample @value{GDBN} session
-@end ifclear
* Invocation:: Getting in and out of @value{GDBN}
* Commands:: @value{GDBN} commands
* Stack:: Examining the stack
* Source:: Examining source files
* Data:: Examining data
-@ifclear CONLY
-* Languages:: Using @value{GDBN} with different languages
-@end ifclear
-@ifset CONLY
+* Languages:: Using @value{GDBN} with different languages
* C:: C language support
-@end ifset
* Symbols:: Examining the symbol table
* Altering:: Altering execution
* Targets:: Specifying a debugging target
* Controlling GDB:: Controlling @value{GDBN}
* Sequences:: Canned sequences of commands
-@ifclear DOSHOST
* Emacs:: Using @value{GDBN} under @sc{gnu} Emacs
-@end ifclear
* GDB Bugs:: Reporting bugs in @value{GDBN}
* Compilation:: Compiling for debugging
* Starting:: Starting your program
-@ifclear BARETARGET
* Arguments:: Your program's arguments
* Environment:: Your program's environment
-@end ifclear
-
* Working Directory:: Your program's working directory
* Input/Output:: Your program's input and output
* Attach:: Debugging an already-running process
* Kill Process:: Killing the child process
-@ifclear HPPA
* Process Information:: Additional process information
-@end ifclear
* Threads:: Debugging programs with multiple threads
* Processes:: Debugging programs with multiple processes
* Breakpoints:: Breakpoints, watchpoints, and catchpoints
* Continuing and Stepping:: Resuming execution
-@ifset POSIX
* Signals:: Signals
-@end ifset
-@ifclear BARETARGET
* Thread Stops:: Stopping and starting multi-thread programs
-@end ifclear
Breakpoints and watchpoints
* Disabling:: Disabling breakpoints
* Conditions:: Break conditions
* Break Commands:: Breakpoint command lists
-@ifclear CONLY
* Breakpoint Menus:: Breakpoint menus
-@end ifclear
Examining the Stack
Examining Source Files
* List:: Printing source lines
-@ifclear DOSHOST
* Search:: Searching source files
-@end ifclear
* Source Path:: Specifying source directories
* Machine Code:: Source and machine code
* Value History:: Value history
* Convenience Vars:: Convenience variables
* Registers:: Registers
-@ifclear HAVE-FLOAT
* Floating Point Hardware:: Floating point hardware
-@end ifclear
Using @value{GDBN} with Different Languages
* Setting:: Switching between source languages
* Show:: Displaying the language
-@ifset MOD2
* Checks:: Type and range checks
-@end ifset
-
* Support:: Supported languages
Switching between source languages
* Manually:: Setting the working language manually
* Automatically:: Having @value{GDBN} infer the source language
-@ifset MOD2
Type and range checking
* Type Checking:: An overview of type checking
* Range Checking:: An overview of range checking
-@end ifset
Supported languages
-@ifset MOD2
-* C:: C and C++
-
C Language Support
-* C Operators:: C operators
-
-C Language Support
-@end ifset
-
+* C:: C and C++
* C Operators:: C and C++ operators
* C Constants:: C and C++ constants
-* Cplus expressions:: C++ expressions
+* C plus plus expressions:: C++ expressions
* C Defaults:: Default settings for C and C++
-@ifset MOD2
* C Checks:: C and C++ type and range checks
-@end ifset
* Debugging C:: @value{GDBN} and C
* Debugging C plus plus:: @value{GDBN} features for C++
-@ifset MOD2
Modula-2
* M2 Operators:: Built-in operators
* M2 Checks:: Modula-2 type and range checks
* M2 Scope:: The scope operators @code{::} and @code{.}
* GDB/M2:: @value{GDBN} and Modula-2
-@end ifset
Altering Execution
* Assignment:: Assignment to variables
* Jumping:: Continuing at a different address
-@ifclear BARETARGET
* Signaling:: Giving your program a signal
-@end ifclear
* Returning:: Returning from a function
* Calling:: Calling your program's functions
* Patching:: Patching your program
Remote debugging
@end ifclear
-@ifset REMOTESTUB
* Remote Serial:: @value{GDBN} remote serial protocol
-@end ifset
-@ifset I960
* i960-Nindy Remote:: @value{GDBN} with a remote i960 (Nindy)
-@end ifset
-@ifset AMD29K
* UDI29K Remote:: The UDI protocol for AMD29K
+
* EB29K Remote:: The EBMON protocol for AMD29K
-@end ifset
-@ifset VXWORKS
* VxWorks Remote:: @value{GDBN} and VxWorks
-@end ifset
-@ifset ST2000
* ST2000 Remote:: @value{GDBN} with a Tandem ST2000
-@end ifset
-@ifset H8
* Hitachi Remote:: @value{GDBN} and Hitachi Microprocessors
-@end ifset
-@ifset MIPS
* MIPS Remote:: @value{GDBN} and MIPS boards
-@end ifset
-@ifset SIMS
* Simulator:: Simulated CPU target
-@end ifset
Controlling @value{GDBN}
effects of one bug and go on to learn about another.
@end itemize
-@ifclear CONLY
-You can use @value{GDBN} to debug programs written in C or C++.
-@c "MOD2" used as a "miscellaneous languages" flag here.
-@c This is acceptable while there is no real doc for Chill and Pascal.
-@ifclear MOD2
+You can use @value{GDBN} to debug programs written in C and C++.
For more information, see @ref{Support,,Supported languages}.
-@end ifclear
-@ifset MOD2
For more information, see @ref{C,,C and C++}.
+@cindex Chill
+@cindex Modula-2
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.
+see @ref{Modula-2,,Modula-2}. For information on Chill, see @ref{Chill}.
-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, or similar features using Pascal syntax.
-@end ifset
+@cindex Pascal
+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, or similar features using Pascal
+syntax.
-@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, or
-similar features using Fortran syntax. It may be necessary to refer to
-some variables with a trailing underscore.
-@end ifset
-@end ifclear
+It may be necessary to refer to some variables with a trailing
+underscore.
@ifset HPPA
This version of the manual documents HP Wildebeest (WDB) Version 0.75,
Richard Stallman, assisted at various times by Peter TerMaat, Chris
Hanson, and Richard Mlynarik, handled releases through 2.8.
-@ifclear CONLY
Michael Tiemann is the author of most of the @sc{gnu} C++ support in GDB,
with significant additional contributions from Per Bothner. James
Clark wrote the @sc{gnu} C++ demangler. Early work on C++ was by Peter
TerMaat (who also did much general update work leading to release 3.0).
-@end ifclear
@value{GDBN} 4 uses the BFD subroutine library to examine multiple
object-file formats; BFD was a joint project of David V.
Brian Fox is the author of the readline libraries providing
command-line editing and command history.
-Andrew Beers of SUNY Buffalo wrote the language-switching code,
-@ifset MOD2
-the Modula-2 support,
-@end ifset
-and contributed the Languages chapter of this manual.
+Andrew Beers of SUNY Buffalo wrote the language-switching code, the
+Modula-2 support, and contributed the Languages chapter of this manual.
Fred Fish wrote most of the support for Unix System Vr4.
-@ifclear CONLY
He also enhanced the command-completion support to cover C++ overloaded
symbols.
-@end ifclear
Hitachi America, Ltd. sponsored the support for H8/300, H8/500, and
Super-H processors.
and small.
-@ifclear BARETARGET
@node Sample Session, Invocation, Summary, Top
@chapter A Sample @value{GDBN} Session
@smallexample
(@value{GDBP}) @b{quit}
@end smallexample
-@end ifclear
@node Invocation, Commands, Sample Session, Top
@chapter Getting In and Out of @value{GDBN}
@node Invoking GDB, Quitting GDB, Invocation, Invocation
@section Invoking @value{GDBN}
-@ifset H8EXCLUSIVE
-For details on starting up @value{GDBP} as a
-remote debugger attached to a Hitachi microprocessor, see @ref{Hitachi
-Remote,,@value{GDBN} and Hitachi Microprocessors}.
-@end ifset
-
Invoke @value{GDBN} by running the program @code{@value{GDBP}}. Once started,
@value{GDBN} reads commands from the terminal until you tell it to exit.
You can also run @code{@value{GDBP}} with a variety of arguments and options,
to specify more of your debugging environment at the outset.
-@ifset GENERIC
The command-line options described here are designed
to cover a variety of situations; in some environments, some of these
options may effectively be unavailable.
-@end ifset
The most usual way to start @value{GDBN} is with one argument,
specifying an executable program:
@value{GDBP} @var{program}
@end example
-@ifclear BARETARGET
@noindent
You can also start with both an executable program and a core file
specified:
attached to a bare board, there may not be any notion of ``process'',
and there is often no way to get a core dump.
@end ifclear
-@end ifclear
You can run @code{gdb} without printing the front material, which describes
@value{GDBN}'s non-warranty, by specifying @code{-silent}:
@menu
-@ifclear GENERIC
-@ifset REMOTESTUB
-* Remote Serial:: @value{GDBN} remote serial protocol
-@end ifset
-@ifset I960
-* i960-Nindy Remote:: @value{GDBN} with a remote i960 (Nindy)
-@end ifset
-@ifset AMD29K
-* UDI29K Remote:: The UDI protocol for AMD29K
-* EB29K Remote:: The EBMON protocol for AMD29K
-@end ifset
-@ifset VXWORKS
-* VxWorks Remote:: @value{GDBN} and VxWorks
-@end ifset
-@ifset ST2000
-* ST2000 Remote:: @value{GDBN} with a Tandem ST2000
-@end ifset
-@ifset H8
-* Hitachi Remote:: @value{GDBN} and Hitachi Microprocessors
-@end ifset
-@ifset MIPS
-* MIPS Remote:: @value{GDBN} and MIPS boards
-@end ifset
-@ifset SPARCLET
-* Sparclet Remote:: @value{GDBN} and Sparclet boards
-@end ifset
-@ifset SIMS
-* Simulator:: Simulated CPU target
-@end ifset
-@end ifclear
-@c remnant makeinfo bug requires this blank line after *two* end-ifblahs:
-
* File Options:: Choosing files
* Mode Options:: Choosing modes
@end menu
-@ifclear GENERIC
-@ifclear HPPA
-@include remote.texi
-@end ifclear
-@end ifclear
-
@node File Options
@subsection Choosing files
-@ifclear BARETARGET
When @value{GDBN} starts, it reads any arguments other than options as
specifying an executable file and core file (or process ID). This is
the same as if the arguments were specified by the @samp{-se} and
@samp{-se} option followed by that argument; and the second argument
that does not have an associated option flag, if any, as equivalent to
the @samp{-c} option followed by that argument.)
-@end ifclear
-@ifset BARETARGET
-When @value{GDBN} starts, it reads any argument other than options as
-specifying an executable file. This is the same as if the argument was
-specified by the @samp{-se} option.
-@end ifset
+
+If @value{GDBN} has not been configured to included core file support,
+such as for most embedded targets, then it will complain about a second
+argument and ignore it.
Many options have both long and short forms; both are shown in the
following list. @value{GDBN} also recognizes the long forms if you truncate
@item -exec @var{file}
@itemx -e @var{file}
-Use file @var{file} as the executable file to execute when
-@ifset BARETARGET
-appropriate.
-@end ifset
-@ifclear BARETARGET
-appropriate, and for examining pure data in conjunction with a core
-dump.
-@end ifclear
+Use file @var{file} as the executable file to execute when appropriate,
+and for examining pure data in conjunction with a core dump.
@item -se @var{file}
Read symbol table from file @var{file} and use it as the executable
file.
-@ifclear BARETARGET
@item -core @var{file}
@itemx -c @var{file}
Use file @var{file} as a core dump to examine.
Connect to process ID @var{number}, as with the @code{attach} command
(unless there is a file in core-dump format named @var{number}, in which
case @samp{-c} specifies that file as a core dump to read).
-@end ifclear
@item -command @var{file}
@itemx -x @var{file}
@itemx -d @var{directory}
Add @var{directory} to the path to search for source files.
-@ifclear BARETARGET
@ifclear HPPA
@item -m
@itemx -mapped
is run. It holds an exact image of the internal @value{GDBN} symbol
table. It cannot be shared across multiple host platforms.
@end ifclear
-@end ifclear
@ifclear HPPA
@item -r
@end ifclear
@end table
-@ifclear BARETARGET
@ifclear HPPA
The @code{-mapped} and @code{-readnow} options are typically combined in
order to build a @file{.syms} file that contains complete symbol
gdb -batch -nx -mapped -readnow programname
@end example
@end ifclear
-@end ifclear
@node Mode Options, , File Options, Invoking GDB
@subsection Choosing modes
Run @value{GDBN} using @var{directory} as its working directory,
instead of the current directory.
-@ifclear DOSHOST
@item -fullname
@itemx -f
-@sc{gnu} Emacs sets this option when it runs @value{GDBN} as a subprocess. It tells @value{GDBN}
-to output the full file name and line number in a standard,
-recognizable fashion each time a stack frame is displayed (which
-includes each time your program stops). This recognizable format looks
-like two @samp{\032} characters, followed by the file name, line number
-and character position separated by colons, and a newline. The
-Emacs-to-@value{GDBN} interface program uses the two @samp{\032} characters as
-a signal to display the source code for the frame.
-@end ifclear
+@sc{gnu} Emacs sets this option when it runs @value{GDBN} as a
+subprocess. It tells @value{GDBN} to output the full file name and line
+number in a standard, recognizable fashion each time a stack frame is
+displayed (which includes each time your program stops). This
+recognizable format looks like two @samp{\032} characters, followed by
+the file name, line number and character position separated by colons,
+and a newline. The Emacs-to-@value{GDBN} interface program uses the two
+@samp{\032} characters as a signal to display the source code for the
+frame.
-@ifset SERIAL
@ifclear HPPA
@item -b @var{bps}
Set the line speed (baud rate or bits per second) of any serial
@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
@ifset HPPA
@item -tui
character at any time because @value{GDBN} does not allow it to take effect
until a time when it is safe.
-@ifclear BARETARGET
If you have been using @value{GDBN} to control an attached process or
device, you can release it with the @code{detach} command
(@pxref{Attach, ,Debugging an already-running process}).
-@end ifclear
@node Shell Commands, , Quitting GDB, Invocation
@section Shell commands
@cindex shell escape
@item shell @var{command string}
Invoke a standard shell to execute @var{command string}.
-@ifclear DOSHOST
If it exists, the environment variable @code{SHELL} determines which
shell to run. Otherwise @value{GDBN} uses @code{/bin/sh}.
-@end ifclear
@end table
The utility @code{make} is often needed in development environments.
If you just want to see the list of alternatives in the first place, you
can press @kbd{M-?} rather than pressing @key{TAB} twice. @kbd{M-?}
-means @kbd{@key{META} ?}. You can type this
-@ifclear DOSHOST
-either by holding down a
+means @kbd{@key{META} ?}. You can type this either by holding down a
key designated as the @key{META} shift on your keyboard (if there is
-one) while typing @kbd{?}, or
-@end ifclear
-as @key{ESC} followed by @kbd{?}.
+one) while typing @kbd{?}, or as @key{ESC} followed by @kbd{?}.
@cindex quotes in commands
@cindex completion of quoted strings
Sometimes the string you need, while logically a ``word'', may contain
-parentheses or other characters that @value{GDBN} normally excludes from its
-notion of a word. To permit word completion to work in this situation,
-you may enclose words in @code{'} (single quote marks) in @value{GDBN} commands.
+parentheses or other characters that @value{GDBN} normally excludes from
+its notion of a word. To permit word completion to work in this
+situation, you may enclose words in @code{'} (single quote marks) in
+@value{GDBN} commands.
-@ifclear CONLY
The most likely situation where you might need this is in typing the
name of a C++ function. This is because C++ allows function overloading
(multiple definitions of the same function, distinguished by argument
you have not yet started typing the argument list when you ask for
completion on an overloaded symbol.
-For more information about overloaded functions, @pxref{Cplus
+For more information about overloaded functions, @pxref{C plus plus
expressions, ,C++ expressions}. You can use the command @code{set
overload-resolution off} to disable overload resolution;
@pxref{Debugging C plus plus, ,@value{GDBN} features for C++}.
-@end ifclear
@node Help, , Completion, Commands
When you run a program under @value{GDBN}, you must first generate
debugging information when you compile it.
-@ifclear BARETARGET
-You may start @value{GDBN} with its arguments, if any, in an environment
-of your choice. You may redirect your program's input and output, debug an
-already running process, or kill a child process.
-@end ifclear
+
+You may start @value{GDBN} with its arguments, if any, in an environment
+of your choice. If you are doing native debugging, you may redirect
+your program's input and output, debug an already running process, or
+kill a child process.
@menu
* Compilation:: Compiling for debugging
* Starting:: Starting your program
-@ifclear BARETARGET
* Arguments:: Your program's arguments
* Environment:: Your program's environment
-@end ifclear
* Working Directory:: Your program's working directory
* Input/Output:: Your program's input and output
* Attach:: Debugging an already-running process
* Kill Process:: Killing the child process
-@ifclear HPPA
* Process Information:: Additional process information
-@end ifclear
* Threads:: Debugging programs with multiple threads
* Processes:: Debugging programs with multiple processes
@kindex run
@item run
@itemx r
-Use the @code{run} command to start your program under @value{GDBN}. You must
-first specify the program name
-@ifset VXWORKS
-(except on VxWorks)
-@end ifset
-with an argument to @value{GDBN} (@pxref{Invocation, ,Getting In and
-Out of @value{GDBN}}), or by using the @code{file} or @code{exec-file}
-command (@pxref{Files, ,Commands to specify files}).
+Use the @code{run} command to start your program under @value{GDBN}.
+You must first specify the program name (except on VxWorks) with an
+argument to @value{GDBN} (@pxref{Invocation, ,Getting In and Out of
+@value{GDBN}}), or by using the @code{file} or @code{exec-file} command
+(@pxref{Files, ,Commands to specify files}).
@end table
-@ifclear BARETARGET
If you are running your program in an execution environment that
supports processes, @code{run} creates an inferior process and makes
that process run your program. (In environments without processes,
program; if you attempt this, @value{GDBN} is likely to wind up debugging the
wrong program.
@end table
-@end ifclear
When you issue the @code{run} command, your program begins to execute
immediately. @xref{Stopping, ,Stopping and continuing}, for discussion
table, and reads it again. When it does this, @value{GDBN} tries to retain
your current breakpoints.
-@ifclear BARETARGET
@node Arguments, Environment, Starting, Running
@section Your program's arguments
confirm} command (@pxref{Messages/Warnings, ,Optional warnings and
messages}).
-@ifset HPPA
-@node Kill Process, Threads, Attach, Running
-@section Killing the child process
-@end ifset
-@ifclear HPPA
@node Kill Process, Process Information, Attach, Running
@section Killing the child process
-@end ifclear
@table @code
@kindex kill
reads the symbol table again (while trying to preserve your current
breakpoint settings).
-@ifclear HPPA
@node Process Information, Threads, Kill Process, Running
@section Additional process information
@kindex /proc
@cindex process image
+
Some operating systems provide a facility called @samp{/proc} that can
be used to examine the image of a running process using file-system
subroutines. If @value{GDBN} is configured for an operating system with this
facility, the command @code{info proc} is available to report on several
kinds of information about the process running your program.
@code{info proc} works only on SVR4 systems that support @code{procfs}.
+This includes OSF/1 (Digital Unix), Solaris, Irix, and Unixware,
+but not HP-UX or Linux, for example.
@table @code
@kindex info proc
@item info proc all
Show all the above information about the process.
@end table
-@end ifclear
-@ifset HPPA
-@node Threads, Processes, Kill Process, Running
-@section Debugging programs with multiple threads
-@end ifset
-@ifclear HPPA
@node Threads, Processes, Process Information, Running
@section Debugging programs with multiple threads
-@end ifclear
@cindex threads of execution
@cindex multiple threads
@xref{Set Watchpoints,,Setting watchpoints}, for information about
watchpoints in programs with multiple threads.
-@end ifclear
@ifclear HPPA
@node Processes, , Threads, Running
program before it terminates; or so that, if your program runs into
trouble, you can investigate and find out why.
-Inside @value{GDBN}, your program may stop for any of several reasons, such
-as
-@ifclear BARETARGET
-a signal,
-@end ifclear
-a breakpoint, or reaching a new line after a @value{GDBN}
-command such as @code{step}. You may then examine and change
-variables, set new breakpoints or remove old ones, and then continue
-execution. Usually, the messages shown by @value{GDBN} provide ample
-explanation of the status of your program---but you can also explicitly
-request this information at any time.
+Inside @value{GDBN}, your program may stop for any of several reasons,
+such as a signal, a breakpoint, or reaching a new line after a
+@value{GDBN} command such as @code{step}. You may then examine and
+change variables, set new breakpoints or remove old ones, and then
+continue execution. Usually, the messages shown by @value{GDBN} provide
+ample explanation of the status of your program---but you can also
+explicitly request this information at any time.
@table @code
@kindex info program
@item info program
Display information about the status of your program: whether it is
-running or not,
-@ifclear BARETARGET
-what process it is,
-@end ifclear
-and why it stopped.
+running or not, what process it is, and why it stopped.
@end table
@menu
* Breakpoints:: Breakpoints, watchpoints, and catchpoints
* Continuing and Stepping:: Resuming execution
-@ifset POSIX
* Signals:: Signals
-@end ifset
-
-@ifclear BARETARGET
* Thread Stops:: Stopping and starting multi-thread programs
-@end ifclear
-
@end menu
@node Breakpoints, Continuing and Stepping, Stopping, Stopping
* Disabling:: Disabling breakpoints
* Conditions:: Break conditions
* Break Commands:: Breakpoint command lists
-@ifclear CONLY
* Breakpoint Menus:: Breakpoint menus
-@end ifclear
-@c @ifclear BARETARGET
@c * Error in Breakpoints:: ``Cannot insert breakpoints''
-@c @end ifclear
@end menu
@node Set Breaks, Set Watchpoints, Breakpoints, Breakpoints
@table @code
@item break @var{function}
Set a breakpoint at entry to function @var{function}.
-@ifclear CONLY
When using source languages that permit overloading of symbols, such as
C++, @var{function} may refer to more than one possible place to break.
@xref{Breakpoint Menus,,Breakpoint menus}, for a discussion of that situation.
-@end ifclear
@item break +@var{offset}
@itemx break -@var{offset}
delete them, disable them, or make them conditional the same way as any
other breakpoint.
-@ifclear CONLY
When debugging C++ programs, @code{rbreak} is useful for setting
breakpoints on overloaded functions that are not members of any special
classes.
-@end ifclear
@kindex info breakpoints
@cindex @code{$_} and @code{info breakpoints}
@kindex rwatch
@item rwatch @var{expr}
Set a watchpoint that will break when watch @var{expr} is read by the program.
-If you use both watchpoints, both must be set with the @code{rwatch}
-command.
@kindex awatch
@item awatch @var{expr}
Set a watchpoint that will break when @var{args} is read and written into
-by the program. If you use both watchpoints, both must be set with the
-@code{awatch} command.
+by the program.
@kindex info watchpoints
@item info watchpoints
@noindent
if it was able to set a hardware watchpoint.
-The SPARClite DSU will generate traps when a program accesses
-some data or instruction address that is assigned to the debug registers.
-For the data addresses, DSU facilitates the @code{watch} command.
-However the hardware breakpoint registers can only take two data watchpoints,
-and both watchpoints must be the same kind. For example, you can set two
-watchpoints with @code{watch} commands, two with @code{rwatch}
-commands, @strong{or} two with @code{awatch} commands, but you cannot set one
-watchpoint with one command and the other with a different command.
+Currently, the @code{awatch} and @code{rwatch} commands can only set
+hardware watchpoints, because accesses to data that don't change the
+value of the watched expression cannot be detected without examining
+every instruction as it is being executed, and @value{GDBN} does not do
+that currently. If @value{GDBN} finds that it is unable to set a
+hardware breakpoint with the @code{awatch} or @code{rwatch} command, it
+will print a message like this:
+
+@smallexample
+Expression cannot be implemented with read/access watchpoint.
+@end smallexample
+
+Sometimes, @value{GDBN} cannot set a hardware watchpoint because the
+data type of the watched expression is wider than what a hardware
+watchpoint on the target machine can handle. For example, some systems
+can only watch regions that are up to 4 bytes wide; on such systems you
+cannot set hardware watchpoints for an expression that yields a
+double-precision floating-point number (which is typically 8 bytes
+wide). As a work-around, it might be possible to break the large region
+into a series of smaller ones and watch them with separate watchpoints.
+
+If you set too many hardware watchpoints, @value{GDBN} might be unable
+to insert all of them when you resume the execution of your program.
+Since the precise number of active watchpoints is unknown until such
+time as the program is about to be resumed, @value{GDBN} might not be
+able to warn you about this when you set the watchpoints, and the
+warning will be printed only when the program is resumed:
+
+@smallexample
+Hardware watchpoint @var{num}: Could not insert watchpoint
+@end smallexample
+
+@noindent
+If this happens, delete or disable some of the watchpoints.
+
+The SPARClite DSU will generate traps when a program accesses some data
+or instruction address that is assigned to the debug registers. For the
+data addresses, DSU facilitates the @code{watch} command. However the
+hardware breakpoint registers can only take two data watchpoints, and
+both watchpoints must be the same kind. For example, you can set two
+watchpoints with @code{watch} commands, two with @code{rwatch} commands,
+@strong{or} two with @code{awatch} commands, but you cannot set one
+watchpoint with one command and the other with a different command.
@value{GDBN} will reject the command if you try to mix watchpoints.
Delete or disable unused watchpoint commands before setting new ones.
any watchpoints you have set will be inactive until GDB reaches another
kind of breakpoint or the call completes.
-@ifclear BARETARGET
+@value{GDBN} automatically deletes watchpoints that watch local
+(automatic) variables, or expressions that involve such variables, when
+they go out of scope, that is, when the execution leaves the block in
+which these variables were defined. In particular, when the program
+being debugged terminates, @emph{all} local variables go out of scope,
+and so only watchpoints that watch global variables remain set. If you
+rerun the program, you will need to set all such watchpoints again. One
+way of doing that would be to set a code breakpoint at the entry to the
+@code{main} function and when it breaks, set all the watchpoints.
+
@quotation
@cindex watchpoints and threads
@cindex threads and watchpoints
watch an expression in all threads.)
@end ifset
@end quotation
-@end ifclear
@node Set Catchpoints, Delete Breaks, Set Watchpoints, Breakpoints
@subsection Setting catchpoints
end
@end example
-@ifclear CONLY
@node Breakpoint Menus, , Break Commands, Breakpoints
@subsection Breakpoint menus
@cindex overloading
(@value{GDBP})
@end group
@end smallexample
-@end ifclear
@c @ifclear BARETARGET
@c @node Error in Breakpoints
completes normally. In contrast, @dfn{stepping} means executing just
one more ``step'' of your program, where ``step'' may mean either one
line of source code, or one machine instruction (depending on what
-particular command you use). Either when continuing
-or when stepping, your program may stop even sooner, due to
-@ifset BARETARGET
-a breakpoint.
-@end ifset
-@ifclear BARETARGET
-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
+particular command you use). Either when continuing or when stepping,
+your program may stop even sooner, due to 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}.)
@table @code
@kindex continue
@item step @var{count}
Continue running as in @code{step}, but do so @var{count} times. If a
-breakpoint is reached,
-@ifclear BARETARGET
-or a signal not related to stepping occurs before @var{count} steps,
-@end ifclear
-stepping stops right away.
+breakpoint is reached, or a signal not related to stepping occurs before
+@var{count} steps, stepping stops right away.
@kindex next
@kindex n
@item next @r{[}@var{count}@r{]}
Continue to the next source line in the current (innermost) stack frame.
-This is similar to @code{step}, but function calls that appear within the line
-of code are executed without stopping. Execution stops when control
-reaches a different line of code at the original stack level that was
-executing when you gave the @code{next} command. This command is abbreviated
-@code{n}.
+This is similar to @code{step}, but function calls that appear within
+the line of code are executed without stopping. Execution stops when
+control reaches a different line of code at the original stack level
+that was executing when you gave the @code{next} command. This command
+is abbreviated @code{n}.
An argument @var{count} is a repeat count, as for @code{step}.
An argument is a repeat count, as in @code{next}.
@end table
-@ifset POSIX
@node Signals, Thread Stops, Continuing and Stepping, Stopping
@section Signals
@cindex signals
a result of the fatal signal once it saw the signal. To prevent this,
you can continue with @samp{signal 0}. @xref{Signaling, ,Giving your
program a signal}.
-@end ifset
-@ifclear BARETARGET
@node Thread Stops, , Signals, Stopping
@section Stopping and starting multi-thread programs
Display the current scheduler locking mode.
@end table
-@end ifclear
-
@node Stack, Source, Stopping, Top
@chapter Examining the Stack
addition, this can be useful when your program has multiple stacks and
switches between them.
-@ifclear H8EXCLUSIVE
@ifclear HPPA
On the SPARC architecture, @code{frame} needs two addresses to
select an arbitrary frame: a frame pointer and a stack pointer.
@c SETUP_ARBITRARY_FRAME in the tm-*.h files. The above is up to date
@c as of 27 Jan 1994.
@end ifclear
-@end ifclear
@kindex up
@item up @var{n}
line. These are all variables (declared either static or automatic)
accessible at the point of execution of the selected frame.
-@ifclear CONLY
@ifclear HPPA
@kindex info catch
@cindex catch exceptions
@code{down}, or @code{frame} commands); then type @code{info catch}.
@xref{Set Catchpoints, , Setting catchpoints}.
@end ifclear
-@end ifclear
@end table
@node Alpha/MIPS Stack, , Frame Info, Stack
execution in that frame has stopped. You can print other portions of
source files by explicit command.
-@ifclear DOSHOST
-If you use @value{GDBN} through its @sc{gnu} Emacs interface, you may prefer
-to use
-Emacs facilities to view source; @pxref{Emacs, ,Using @value{GDBN} under @sc{gnu} Emacs}.
-@end ifclear
+If you use @value{GDBN} through its @sc{gnu} Emacs interface, you may
+prefer to use Emacs facilities to view source; @pxref{Emacs, ,Using
+@value{GDBN} under @sc{gnu} Emacs}.
@menu
* List:: Printing source lines
-@ifclear DOSHOST
* Search:: Searching source files
-@end ifclear
-
* Source Path:: Specifying source directories
* Machine Code:: Source and machine code
@end menu
@var{address} may be any expression.
@end table
-@ifclear DOSHOST
@node Search, Source Path, List, Source
@section Searching source files
@cindex searching
for @var{regexp}. It lists the line that is found. You can abbreviate
this command as @code{rev}.
@end table
-@end ifclear
@node Source Path, Machine Code, Search, Source
@section Specifying source directories
(first inclusive, second exclusive) to dump.
@end table
-@ifclear H8EXCLUSIVE
The following example shows the disassembly of a range of addresses of
HP PA-RISC 2.0 code:
0x32e0 <main+232>: ldil 0x3000,r31
End of assembler dump.
@end smallexample
-@end ifclear
-
-@ifset H8EXCLUSIVE
-For example, here is the beginning of the output for the
-disassembly of a function @code{fact}:
-
-
-@smallexample
-(@value{GDBP}) disas fact
-Dump of assembler code for function fact:
-to 0x808c:
-0x802c <fact>: 6d f2 mov.w r2,@@-r7
-0x802e <fact+2>: 6d f3 mov.w r3,@@-r7
-0x8030 <fact+4>: 6d f6 mov.w r6,@@-r7
-0x8032 <fact+6>: 0d 76 mov.w r7,r6
-0x8034 <fact+8>: 6f 70 00 08 mov.w @@(0x8,r7),r0
-0x8038 <fact+12> 19 11 sub.w r1,r1
- .
- .
- .
-@end smallexample
-@end ifset
Some architectures have more than one commonly-used set of instruction
mnemonics or other syntax.
@c document because it is nonstandard... Under Epoch it displays in a
@c different window or something like that.
The usual way to examine data in your program is with the @code{print}
-command (abbreviated @code{p}), or its synonym @code{inspect}.
-@ifclear CONLY
-It evaluates and prints the value of an expression of the language your
-program is written in (@pxref{Languages, ,Using @value{GDBN} with Different
-Languages}).
-@end ifclear
+command (abbreviated @code{p}), or its synonym @code{inspect}. It
+evaluates and prints the value of an expression of the language your
+program is written in (@pxref{Languages, ,Using @value{GDBN} with
+Different Languages}).
@table @code
@item print @var{exp}
It examines data in memory at a specified address and prints it in a
specified format. @xref{Memory, ,Examining memory}.
-If you are interested in information about types, or about how the fields
-of a struct
-@ifclear CONLY
-or class
-@end ifclear
-are declared, use the @code{ptype @var{exp}}
-command rather than @code{print}. @xref{Symbols, ,Examining the Symbol Table}.
+If you are interested in information about types, or about how the
+fields of a struct or class are declared, use the @code{ptype @var{exp}}
+command rather than @code{print}. @xref{Symbols, ,Examining the Symbol
+Table}.
@menu
* Expressions:: Expressions
* Value History:: Value history
* Convenience Vars:: Convenience variables
* Registers:: Registers
-@ifclear HAVE-FLOAT
* Floating Point Hardware:: Floating point hardware
-@end ifclear
-
@end menu
@node Expressions, Variables, Data, Data
you can now use the command @code{print @{1, 2, 3@}} to build up an array in
memory that is malloc'd in the target program.
-@ifclear CONLY
Because C is so widespread, most of the expressions shown in examples in
this manual are in C. @xref{Languages, , Using @value{GDBN} with Different
Languages}, for information on how to use expressions in other
useful to cast a number into a pointer in order to examine a structure
at that address in memory.
@c FIXME: casts supported---Mod2 true?
-@end ifclear
@value{GDBN} supports these operators, in addition to those common
to programming languages:
(@value{GDBP}) p 'f2.c'::x
@end example
-@ifclear CONLY
@cindex C++ scope resolution
This use of @samp{::} is very rarely in conflict with the very similar
use of the same notation in C++. @value{GDBN} also supports use of the C++
scope resolution operator in @value{GDBN} expressions.
@c FIXME: Um, so what happens in one of those rare cases where it's in
@c conflict?? --mew
-@end ifclear
@cindex wrong values
@cindex variable values, wrong
@end smallexample
@end table
-@ifclear CONLY
@need 1000
@noindent
These settings are of interest when debugging C++ programs:
@item show print vtbl
Show whether C++ virtual function tables are pretty printed, or not.
@end table
-@end ifclear
@node Value History, Convenience Vars, Print Settings, Data
@section Value history
@value{GDBN} is unable to locate the saved registers, the selected stack
frame makes no difference.
-@ifset AMD29K
@table @code
@kindex set rstack_high_address
@cindex AMD 29K register stack
Display the current limit of the register stack, on AMD 29000 family
processors.
@end table
-@end ifset
-@ifclear HAVE-FLOAT
@node Floating Point Hardware, , Registers, Data
@section Floating point hardware
@cindex floating point
floating point chip. Currently, @samp{info float} is supported on
the ARM and x86 machines.
@end table
-@end ifclear
-@ifclear CONLY
@node Languages, Symbols, Data, Top
@chapter Using @value{GDBN} with Different Languages
@cindex languages
-@ifset MOD2
Although programming languages generally have common aspects, they are
rarely expressed in the same manner. For instance, in ANSI C,
dereferencing a pointer @code{p} is accomplished by @code{*p}, but in
Modula-2, it is accomplished by @code{p^}. Values can also be
represented (and displayed) differently. Hex numbers in C appear as
@samp{0x1ae}, while in Modula-2 they appear as @samp{1AEH}.
-@end ifset
@cindex working language
Language-specific information is built into @value{GDBN} for some languages,
@menu
* Setting:: Switching between source languages
* Show:: Displaying the language
-@ifset MOD2
* Checks:: Type and range checks
-@end ifset
-
* Support:: Supported languages
@end menu
CHILL source file.
@end ifclear
-@ifset MOD2
@item .mod
Modula-2 source file
-@end ifset
@item .s
@itemx .S
If you wish, you may set the language manually. To do this, issue the
command @samp{set language @var{lang}}, where @var{lang} is the name of
a language, such as
-@ifclear MOD2
-@code{c}.
-@end ifclear
-@ifset MOD2
@code{c} or @code{modula-2}.
-@end ifset
For a list of the supported languages, type @samp{set language}.
-@ifclear MOD2
-Setting the language manually prevents @value{GDBN} from updating the
-working language automatically. For example, if you used the @code{c}
-setting to debug a C++ program, names might not be demangled properly,
-overload resolution would not work, user-defined operators might not be
-interpreted correctly, and so on.
-@end ifclear
-@ifset MOD2
Setting the language manually prevents @value{GDBN} from updating the working
language automatically. This can lead to confusion if you try
to debug a program when the working language is not the same as the
@code{b} and @code{c} and place the result in @code{a}. The result
printed would be the value of @code{a}. In Modula-2, this means to compare
@code{a} to the result of @code{b+c}, yielding a @code{BOOLEAN} value.
-@end ifset
@node Automatically, , Manually, Setting
@subsection Having @value{GDBN} infer the source language
a different source language. Using @samp{set language auto} in this
case frees you from having to set the working language manually.
-@ifset MOD2
@node Show, Checks, Setting, Languages
@section Displaying the language
-@end ifset
-@ifclear MOD2
-@node Show, Support, Setting, Languages
-@section Displaying the language
-@end ifclear
The following commands help you find out which language is the
working language, and also what language source files were written in.
List all the filename extensions and the associated languages.
@end table
-@ifset MOD2
@node Checks, Support, Show, Languages
@section Type and range checking
Show the current setting of the range checker, and whether or not it is
being set automatically by @value{GDBN}.
@end table
-@end ifset
-@ifset MOD2
@node Support, , Checks, Languages
@section Supported languages
-@end ifset
-@ifclear MOD2
-@node Support, , Show, Languages
-@section Supported languages
-@end ifclear
-@ifset MOD2
-@value{GDBN} supports C, C++, Fortran, Chill, assembly, and Modula-2.
-@end ifset
-@ifclear MOD2
-@value{GDBN} supports C, C++, Fortran, Chill, and assembly.
-@end ifclear
+@value{GDBN} supports C, C++, Fortran, Java, Chill, assembly, and Modula-2.
+@c This is false ...
Some @value{GDBN} features may be used in expressions regardless of the
language you use: the @value{GDBN} @code{@@} and @code{::} operators,
and the @samp{@{type@}addr} construct (@pxref{Expressions,
books written on each of these languages; please look to these for a
language reference or tutorial.
-@ifset MOD2
@menu
-* C:: C and C++
-* Modula-2:: Modula-2
+* C:: C and C++
+* Modula-2:: Modula-2
+* Chill:: Chill
@end menu
@node C, Modula-2, , Support
@subsection C and C++
+
@cindex C and C++
@cindex expressions in C or C++
-@end ifset
Since C and C++ are so closely related, many features of @value{GDBN} apply
to both languages. Whenever this is the case, we discuss those languages
together.
-@ifclear MOD2
-@c Cancel this below, under same condition, at end of this chapter!
-@raisesections
-@end ifclear
-
@ifclear HPPA
@cindex C++
@kindex g++
Program or @sc{gnu} CC, gcc.info, Using @sc{gnu} CC}, for more
information.
@end ifset
-@end ifclear
-
-@ifset CONLY
-@node C, Symbols, Data, Top
-@chapter C Language Support
-@cindex C language
-@cindex expressions in C
-
-Information specific to the C language is built into @value{GDBN} so that you
-can use C expressions while debugging. This also permits @value{GDBN} to
-output values in a manner consistent with C conventions.
-
-@menu
-* C Operators:: C operators
-@end menu
-@end ifset
-@ifclear CONLY
@menu
* C Operators:: C and C++ operators
* C Constants:: C and C++ constants
-* Cplus expressions:: C++ expressions
+* C plus plus expressions:: C++ expressions
* C Defaults:: Default settings for C and C++
-@ifset MOD2
* C Checks:: C and C++ type and range checks
-@end ifset
-
* Debugging C:: @value{GDBN} and C
* Debugging C plus plus:: @value{GDBN} features for C++
@end menu
-@end ifclear
-@ifclear CONLY
-@cindex C and C++ operators
@node C Operators, C Constants, , C
@subsubsection C and C++ operators
-@end ifclear
-@ifset CONLY
-@cindex C operators
-@node C Operators, C Constants, C, C
-@section C operators
-@end ifset
+
+@cindex C and C++ operators
Operators must be defined on values of specific types. For instance,
@code{+} is defined on numbers, but not on structures. Operators are
often defined on groups of types.
-@ifclear CONLY
For the purposes of C and C++, the following definitions hold:
-@end ifclear
@itemize @bullet
@item
@item &
Address operator. Defined on variables. Same precedence as @code{++}.
-@ifclear CONLY
For debugging C++, @value{GDBN} implements a use of @samp{&} beyond what is
allowed in the C++ language itself: you can use @samp{&(&@var{ref})}
(or, if you prefer, simply @samp{&&@var{ref}}) to examine the address
where a C++ reference variable (declared with @samp{&@var{ref}}) is
stored.
-@end ifclear
@item -
Negative. Defined on integral and floating-point types. Same
@item ()
Function parameter list. Same precedence as @code{->}.
-@ifclear CONLY
@item ::
-C++ scope resolution operator. Defined on
-@code{struct}, @code{union}, and @code{class} types.
-@end ifclear
+C++ scope resolution operator. Defined on @code{struct}, @code{union},
+and @code{class} types.
@item ::
-Doubled colons
-@ifclear CONLY
-also
-@end ifclear
-represent the @value{GDBN} scope operator (@pxref{Expressions,
-,Expressions}).
-@ifclear CONLY
-Same precedence as @code{::}, above.
-@end ifclear
+Doubled colons also represent the @value{GDBN} scope operator
+(@pxref{Expressions, ,Expressions}). Same precedence as @code{::},
+above.
@end table
@ifset HPPA
predefined meaning.
@end ifset
-@ifclear CONLY
@menu
* C Constants::
@end menu
-@ifset MOD2
-@node C Constants, Cplus expressions, C Operators, C
-@subsubsection C and C++ constants
-@end ifset
-@ifclear MOD2
-@node C Constants, Cplus expressions, C Operators, Support
+@node C Constants, C plus plus expressions, C Operators, C
@subsubsection C and C++ constants
-@end ifclear
@cindex C and C++ constants
-@value{GDBN} allows you to express the constants of C and C++ in the
-following ways:
-@end ifclear
-@ifset CONLY
-@cindex C constants
-@node C Constants, Debugging C, C Operators, C
-@section C constants
-@value{GDBN} allows you to express the constants of C in the
+@value{GDBN} allows you to express the constants of C and C++ in the
following ways:
-@end ifset
@itemize @bullet
@item
and @samp{@{&"hi", &"there", &"fred"@}} is a three-element array of pointers.
@end itemize
-@ifclear CONLY
@menu
-* Cplus expressions::
+* C plus plus expressions::
* C Defaults::
-@ifset MOD2
* C Checks::
-@end ifset
* Debugging C::
@end menu
-@ifset MOD2
-@node Cplus expressions, C Defaults, C Constants, C
+@node C plus plus expressions, C Defaults, C Constants, C
@subsubsection C++ expressions
-@end ifset
-@ifclear MOD2
-@node Cplus expressions, C Defaults, C Constants, Support
-@subsubsection C++ expressions
-@end ifclear
@cindex expressions in C++
@value{GDBN} expression handling can interpret most C++ expressions.
subobject, casting objects, and invoking user-defined operators.
@end ifset
-@ifset MOD2
-@node C Defaults, C Checks, Cplus expressions, C
+@node C Defaults, C Checks, C plus plus expressions, C
@subsubsection C and C++ defaults
-@end ifset
-@ifclear MOD2
-@node C Defaults, Debugging C, Cplus expressions, Support
-@subsubsection C and C++ defaults
-@end ifclear
+
@cindex C and C++ defaults
@ifclear HPPA
@xref{Automatically, ,Having @value{GDBN} infer the source language},
for further details.
-@ifset MOD2
@c Type checking is (a) primarily motivated by Modula-2, and (b)
@c unimplemented. If (b) changes, it might make sense to let this node
@c appear even if Mod-2 does not, but meanwhile ignore it. roland 16jul93.
+
@node C Checks, Debugging C, C Defaults, C Constants
@subsubsection C and C++ type and range checks
+
@cindex C and C++ checks
By default, when @value{GDBN} parses C or C++ expressions, type checking
Range checking, if turned on, is done on mathematical operations. Array
indices are not checked, since they are often used to index a pointer
that is not itself an array.
-@end ifset
-@end ifclear
-@ifclear CONLY
-@ifset MOD2
@node Debugging C, Debugging C plus plus, C Checks, C
@subsubsection @value{GDBN} and C
-@end ifset
-@ifclear MOD2
-@node Debugging C, Debugging C plus plus, C Defaults, Support
-@subsubsection @value{GDBN} and C
-@end ifclear
-@end ifclear
-@ifset CONLY
-@node Debugging C, , C Constants, C
-@section @value{GDBN} and C
-@end ifset
The @code{set print union} and @code{show print union} commands apply to
the @code{union} type. When set to @samp{on}, any @code{union} that is
-inside a @code{struct}
-@ifclear CONLY
-or @code{class}
-@end ifclear
-is also printed.
-Otherwise, it appears as @samp{@{...@}}.
+inside a @code{struct} or @code{class} is also printed. Otherwise, it
+appears as @samp{@{...@}}.
The @code{@@} operator aids in the debugging of dynamic arrays, formed
with pointers and a memory allocation function. @xref{Expressions,
,Expressions}.
-@ifclear CONLY
@menu
* Debugging C plus plus::
@end menu
-@ifset MOD2
@node Debugging C plus plus, , Debugging C, C
@subsubsection @value{GDBN} features for C++
-@end ifset
-@ifclear MOD2
-@node Debugging C plus plus, , Debugging C, Support
-@subsubsection @value{GDBN} features for C++
-@end ifclear
@cindex commands for C++
+
Some @value{GDBN} commands are particularly useful with C++, and some are
designed specifically for use with C++. Here is a summary:
Enable overload resolution for C++ expression evaluation. The default
is on. For overloaded functions, @value{GDBN} evaluates the arguments
and searches for a function whose signature matches the argument types,
-using the standard C++ conversion rules (@pxref{Cplus expressions, ,C++
+using the standard C++ conversion rules (@pxref{C plus plus expressions, ,C++
expressions} for details). If it cannot find a match, it emits a
message.
available choices, or to finish the type list for you.
@xref{Completion,, Command completion}, for details on how to do this.
@end table
-@ifclear MOD2
-@c cancels "raisesections" under same conditions near bgn of chapter
-@lowersections
-@end ifclear
-@ifset MOD2
-@node Modula-2, ,C , Support
+@node Modula-2, Chill, C, Support
@subsection Modula-2
+
@cindex Modula-2
The extensions made to @value{GDBN} to support Modula-2 only support
@cindex @code{#} in Modula-2
In @value{GDBN} scripts, the Modula-2 inequality operator @code{#} is
interpreted as the beginning of a comment. Use @code{<>} instead.
-@end ifset
-@end ifclear
+
+@node Chill, , Modula-2, Support
+@subsection Chill
+
+The extensions made to @value{GDBN} to support Chill only support output
+from the GNU Chill compiler. Other Chill compilers are not currently
+supported, and attempting to debug executables produced by them is most
+likely to give an error as @value{GDBN} reads in the executable's symbol
+table.
+
+This section covers the following Chill related topics and the features
+of @value{GDBN} which support these topics.
+
+@menu
+* How modes are displayed:: How modes are displayed
+* Locations:: Locations and their accesses
+* Values and their Operations:: Values and their Operations
+@end menu
+
+@node How modes are displayed
+@subsubsection How modes are displayed
+
+The Chill Datatype- (Mode) support of @value{GDBN} is directly related
+with the functionality of the GNU Chill compiler, and therefore deviates
+slightly from the standard specification of the Chill language. The
+provided modes are:
+@table @code
+@item @r{@emph{Discrete modes:}}
+@itemize @bullet
+@item
+@emph{Integer Modes} which are predefined by @code{BYTE, UBYTE, INT,
+UINT, LONG, ULONG},
+@item
+@emph{Boolean Mode} which is predefined by @code{BOOL},
+@item
+@emph{Character Mode} which is predefined by @code{CHAR},
+@item
+@emph{Set Mode} which is displayed by the keyword @code{SET}.
+@smallexample
+(@value{GDBP}) ptype x
+type = SET (karli = 10, susi = 20, fritzi = 100)
+@end smallexample
+If the type is an unnumbered set the set element values are omitted.
+@item
+@emph{Range Mode} which is displayed by @code{type = <basemode>
+(<lower bound> : <upper bound>)}, where @code{<lower bound>, <upper
+bound>} can be of any discrete literal expression (e.g. set element
+names).
+@end itemize
+
+@item @r{@emph{Powerset Mode:}}
+A Powerset Mode is displayed by the keyword @code{POWERSET} followed by
+the member mode of the powerset. The member mode can be any discrete mode.
+@smallexample
+(@value{GDBP}) ptype x
+type = POWERSET SET (egon, hugo, otto)
+@end smallexample
+
+@item @r{@emph{Reference Modes:}}
+@itemize @bullet
+@item
+@emph{Bound Reference Mode} which is diplayed by the keyword @code{REF}
+followed by the mode name to which the reference is bound.
+@item
+@emph{Free Reference Mode} which is displayed by the keyword @code{PTR}.
+@end itemize
+
+@item @r{@emph{Procedure mode}}
+The procedure mode is displayed by @code{type = PROC(<parameter list>)
+<return mode> EXCEPTIONS (<exception list>)}. The @code{<parameter
+list>} is a list of the parameter modes. @code{<return mode>} indicates
+the mode of the result of the procedure if any. The exceptionlist lists
+all possible exceptions which can be raised by the procedure.
+
+@ignore
+@item @r{@emph{Instance mode}}
+The instance mode is represented by a structure, which has a static
+type, and is therefore not really of interest.
+@end ignore
+
+@item @r{@emph{Synchronization Modes:}}
+@itemize @bullet
+@item
+@emph{Event Mode} which is displayed by @code{EVENT (<event length>)},
+where @code{(<event length>)} is optional.
+@item
+@emph{Buffer Mode} which is displayed by @code{BUFFER (<buffer length>)
+<buffer element mode>}, where @code{(<buffer length>)} is optional.
+@end itemize
+
+@item @r{@emph{Timing Modes:}}
+@itemize @bullet
+@item
+@emph{Duration Mode} which is predefined by @code{DURATION}
+@item
+@emph{Absolute Time Mode} which is predefined by @code{TIME}
+@end itemize
+
+@item @r{@emph{Real Modes:}}
+Real Modes are predefined with @code{REAL} and @code{LONG_REAL}.
+
+@item @r{@emph{String Modes:}}
+@itemize @bullet
+@item
+@emph{Character String Mode} which is displayed by @code{CHARS(<string
+length>)}, followed by the keyword @code{VARYING} if the String Mode is
+a varying mode
+@item
+@emph{Bit String Mode} which is displayed by @code{BOOLS(<string
+length>)}.
+@end itemize
+
+@item @r{@emph{Array Mode:}}
+The Array Mode is displayed by the keyword @code{ARRAY(<range>)}
+followed by the element mode (which may in turn be an array mode).
+@smallexample
+(@value{GDBP}) ptype x
+type = ARRAY (1:42)
+ ARRAY (1:20)
+ SET (karli = 10, susi = 20, fritzi = 100)
+@end smallexample
+
+@item @r{@emph{Structure Mode}}
+The Structure mode is displayed by the keyword @code{STRUCT(<field
+list>)}. The @code{<field list>} consists of names and modes of fields
+of the structure. Variant structures have the keyword @code{CASE <field>
+OF <variant fields> ESAC} in their field list. Since the current version
+of the GNU Chill compiler doesn't implement tag processing (no runtime
+checks of variant fields, and therefore no debugging info), the output
+always displays all variant fields.
+@smallexample
+(@value{GDBP}) ptype str
+type = STRUCT (
+ as x,
+ bs x,
+ CASE bs OF
+ (karli):
+ cs a
+ (ott):
+ ds x
+ ESAC
+)
+@end smallexample
+@end table
+
+@node Locations
+@subsubsection Locations and their accesses
+
+A location in Chill is an object which can contain values.
+
+A value of a location is generally accessed by the (declared) name of
+the location. The output conforms to the specification of values in
+Chill programs. How values are specified, and which operations are valid
+is the topic of the next section.
+
+The pseudo-location @code{RESULT} (or @code{result}) can be used to
+display or change the result of a currently-active procedure:
+@smallexample
+set result := EXPR
+@end smallexample
+- does the same as the Chill action @code{RESULT EXPR} (which
+is not available in gdb).
+
+Values of reference mode locations are printed by @code{PTR(<hex
+value>)} in case of a free reference mode, and by @code{(REF <reference
+mode>) (<hex-value>)} in case of a bound reference. @code{<hex value>}
+represents the address where the reference points to. To access the
+value of the location referenced by the pointer, use the dereference
+operator `@code{->}'.
+
+Values of procedure mode locations are displayed by @code{@{ PROC
+(<argument modes> ) <return mode> @} <address> <name of procedure
+location>}. @code{<argument modes>} is a list of modes according to the
+parameter specification of the procedure and @code{<address>} shows the
+address of the entry point.
+
+@ignore
+Locations of instance modes are displayed just like a structure with two
+fields specifying the @emph{process type} and the @emph{copy number} of
+the investigated instance location@footnote{This comes from the current
+implementation of instances. They are implemented as a structure (no
+na). The output should be something like @code{[<name of the process>;
+<instance number>]}.}. The field names are @code{__proc_type} and
+@code{__proc_copy}.
+
+Locations of synchronization modes are displayed like a structure with
+the field name @code{__event_data} in case of a event mode location, and
+like a structure with the field @code{__buffer_data} in case of a buffer
+mode location (refer to previous paragraph).
+
+Structure Mode locations are printed by @code{[.<field name>: <value>,
+...]}. The @code{<field name>} corresponds to the structure mode
+definition and the layout of @code{<value>} varies depending of the mode
+of the field. If the investigated structure mode location is of variant
+structure mode the variant parts of the structure are enclosed in curled
+braces (`@code{@{@}}'). Fields enclosed by `@code{@{,@}}' are residing
+on the same memory location and represent the current values of the
+memory location in their specific modes. Since no tag processing is done
+all variants are displayed. A variant field is printed by
+@code{(<variant name>) = .<field name>: <value>}. (who implements the
+stuff ???)
+@smallexample
+(@value{GDBP}) print str1 $4 = [.as: 0, .bs: karli, .<TAG>: { (karli) =
+[.cs: []], (susi) = [.ds: susi]}]
+@end smallexample
+@end ignore
+
+Substructures of string mode-, array mode- or structure mode-values
+(e.g. array slices, fields of structure locations) are accessed using
+certain operations which are descibed in the next chapter.
+
+A location value may be interpreted as having a different mode using the
+location conversion. This mode conversion is written as @code{<mode
+name>(<location>)}. The user has to consider that the sizes of the modes
+have to be equal otherwise an error message occurs. Further no range
+checking of the location against the destination mode is performed and
+therefore the result can be quite confusing.
+@smallexample
+(@value{GDBP}) print int (s(3 up 4)) XXX TO be filled in !! XXX
+@end smallexample
+
+@node Values and their Operations
+@subsubsection Values and their Operations
+
+Values are used to alter locations, to investigate complex structures in
+more detail or to filter relevant information out of a large amount of
+data. There are several (mode dependent) operations defined which enable
+such investigations. These operations are not only applicable to
+constant values but also to locations, which can become quite useful
+when debugging complex structures. During parsing the command line
+(e.g. evaluating an expression) @value{GDBN} treats location names as
+the values behind these locations.
+
+This subchapters describes how values have to be specified and which
+operations are legal to be used with such values.
+
+@table @code
+@item Literal Values
+Literal values are specified in the same manner as in GNU Chill programs.
+For detailed specification refer to the GNU Chill implementation Manual
+chapter 1.5.
+
+@ignore
+@itemize @bullet
+@item
+@emph{Integer Literals} are specified in the same manner as in Chill
+programs (refer z200/88 chpt 5.2.4.2)
+@item
+@emph{Boolean Literals} are defined by @code{TRUE} and @code{FALSE}.
+@item
+@emph{Character Literals} are defined by @code{'<character>'}. (e.g.
+@code{'M'})
+@item
+@emph{Set Literals} are defined by a name which was specified in a set
+mode. The value delivered by a Set Literal is the set value. This is
+comparable to an enumaration in C/C++ language.
+@item
+@emph{Emptiness Literal} is predefined by @code{NULL}. The value of the
+emptiness literal delivers either the empty reference value, the empty
+procedure value or the empty instance value.
+
+@item
+@emph{Character String Literals} are defined by a sequence of characters
+enclosed in single- or double quotes. If a single- or double quote has
+to be part of the string literal it has to be stuffed (specified twice).
+@item
+@emph{Bitstring Literals} are specified in the same manner as in Chill
+programs (refer z200/88 chpt 5.2.4.8).
+@item
+@emph{Floating point literals} are specified in the same manner as in
+(gnu-)Chill programs (refer GNU Chill implementation Manual chapter 1.5).
+@end itemize
+@end ignore
+
+@item Tuple Values
+A tuple is specified by @code{<mode name>[<tuple>]}, where @code{<mode
+name>} can be omitted if the mode of the tuple is unambigous. This
+unambiguity is derived from the context of a evaluated expression.
+@code{<tuple>} can be one of the following:
+@itemize @bullet
+@item @emph{Powerset Tuple}
+@item @emph{Array Tuple}
+@item @emph{Structure Tuple}
+Powerset tuples, array tuples and structure tuples are specified in the
+same manner as in Chill programs refer z200/88 chpt 5.2.5.
+@end itemize
+
+@item String Element Value
+A string element value is specified by @code{<string value>(<index>)},
+where @code{<index>} is a integer expression. It delivers a character
+value which is equivalent to the character indexed by @code{<index>} in
+the string.
+
+@item String Slice Value
+A string slice value is specified by @code{<string value>(<slice
+spec>)}, where @code{<slice spec>} can be either a range of integer
+expressions or specified by @code{<start expr> up <size>}.
+@code{<size>} denotes the number of elements which the slice contains.
+The delivered value is a string value, which is part of the specified
+string.
+
+@item Array Element Values
+An array element value is specified by @code{<array value>(<expr>)} and
+delivers a array element value of the mode of the specified array.
+
+@item Array Slice Values
+An array slice is specified by @code{<array value>(<slice spec>)}, where
+@code{<slice spec>} can be either a range specified by expressions or by
+@code{<start expr> up <size>}. @code{<size>} denotes the number of
+arrayelements the slice contains. The delivered value is an array value
+which is part of the specified array.
+
+@item Structure Field Values
+A structure field value is derived by @code{<structure value>.<field
+name>}, where @code{<field name>} indcates the name of a field specified
+in the mode definition of the structure. The mode of the delivered value
+corresponds to this mode definition in the structure definition.
+
+@item Procedure Call Value
+The procedure call value is derived from the return value of the
+procedure@footnote{If a procedure call is used for instance in an
+expression, then this procedure is called with all its side
+effects. This can lead to confusing results if used carelessly.}.
+
+Values of duration mode locations are represented by ULONG literals.
+
+Values of time mode locations are represented by TIME(<secs>:<nsecs>).
+
+@ignore
+This is not implemented yet:
+@item Built-in Value
+@noindent
+The following built in functions are provided:
+@table @code
+@item @code{ADDR()}
+@item @code{NUM()}
+@item @code{PRED()}
+@item @code{SUCC()}
+@item @code{ABS()}
+@item @code{CARD()}
+@item @code{MAX()}
+@item @code{MIN()}
+@item @code{SIZE()}
+@item @code{UPPER()}
+@item @code{LOWER()}
+@item @code{LENGTH()}
+@item @code{SIN()}
+@item @code{COS()}
+@item @code{TAN()}
+@item @code{ARCSIN()}
+@item @code{ARCCOS()}
+@item @code{ARCTAN()}
+@item @code{EXP()}
+@item @code{LN()}
+@item @code{LOG()}
+@item @code{SQRT()}
+@end table
+
+For a detailed description refer to the GNU Chill implementation manual
+chapter 1.6.
+@end ignore
+
+@item Zero-adic Operator Value
+The zero-adic operator value is derived from the instance value for the
+current active process.
+
+@item Expression Values
+The value delivered by an expression is the result of the evaluation of
+the specified expression. If there are error conditions (mode
+incompatibility, etc.) the evaluation of expressions is aborted with a
+corresponding error message. Expressions may be paranthesised which
+causes the evaluation of this expression before any other expression
+which uses the result of the paranthesised expression. The following
+operators are supported by @value{GDBN}:
+@table @code
+@item @code{OR, ORIF, XOR}
+@item @code{AND, ANDIF}
+@item @code{NOT}
+Logical operators defined over operands of boolean mode.
+@item @code{=, /=}
+Equality and inequality operators defined over all modes.
+@item @code{>, >=}
+@item @code{<, <=}
+Relational operators defined over predefined modes.
+@item @code{+, -}
+@item @code{*, /, MOD, REM}
+Arithmetic operators defined over predefined modes.
+@item @code{-}
+Change sign operator.
+@item @code{//}
+String concatenation operator.
+@item @code{()}
+String repetition operator.
+@item @code{->}
+Referenced location operator which can be used either to take the
+address of a location (@code{->loc}), or to dereference a reference
+location (@code{loc->}).
+@item @code{OR, XOR}
+@item @code{AND}
+@item @code{NOT}
+Powerset and bitstring operators.
+@item @code{>, >=}
+@item @code{<, <=}
+Powerset inclusion operators.
+@item @code{IN}
+Membership operator.
+@end table
+@end table
+
+@subsubsection Chill type and range checks
+
+@value{GDBN} considers two Chill variables mode equivalent if the sizes
+of the two modes are equal. This rule applies recursively to more
+complex datatypes which means that complex modes are treated
+eqivalent if all element modes (which also can be complex modes like
+structures, arrays, etc.) have the same size.
+
+Range checking is done on all mathematical operations, assignment, array
+index bounds and all built in procedures.
+
+Strong type checks are forced using the @value{GDBN} command @code{set
+check strong}. This enforces strong type and range checks on all
+operations where Chill constructs are used (expressions, built in
+functions, etc.) in respect to the semantics as defined in the z.200
+language specification.
+
+@noindent
+All checks can be disabled by the @value{GDBN} command @code{set check
+off}.
+
+@ignore
+@subsubsection Deviations from the Chill Standard Z200/88
+see last paragraph ?
+@end ignore
+
+@subsubsection Chill defaults
+
+If type and range checking are set automatically by @value{GDBN}, they
+both default to @code{on} whenever the working language changes to
+Chill. This happens regardless of whether you, or @value{GDBN},
+selected the working language.
+
+If you allow @value{GDBN} to set the language automatically, then entering
+code compiled from a file whose name ends with @file{.ch} sets the
+working language to Chill. @xref{Automatically, ,Having @value{GDBN} set
+the language automatically}, for further details.
@node Symbols, Altering, Languages, Top
@chapter Examining the Symbol Table
@kindex ptype
@item ptype @var{typename}
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}}.
+the name of a type, or for C code it may have the form @samp{class
+@var{class-name}}, @samp{struct @var{struct-tag}}, @samp{union
+@var{union-tag}} or @samp{enum @var{enum-tag}}.
@item ptype @var{exp}
@itemx ptype
@ifclear HPPA
@cindex reloading symbols
Some systems allow individual object files that make up your program to
-be replaced without stopping and restarting your program.
-@ifset VXWORKS
-For example, in VxWorks you can simply recompile a defective object file
-and keep on running.
-@end ifset
-If you are running on one of these systems, you can allow @value{GDBN} to
-reload the symbols for automatically relinked modules:
+be replaced without stopping and restarting your program. For example,
+in VxWorks you can simply recompile a defective object file and keep on
+running. If you are running on one of these systems, you can allow
+@value{GDBN} to reload the symbols for automatically relinked modules:
@table @code
@kindex set symbol-reloading
program.
For example, you can store new values into variables or memory
-locations,
-@ifclear BARETARGET
-give your program a signal, restart it
-@end ifclear
-@ifset BARETARGET
-restart your program
-@end ifset
-at a different address, or even return prematurely from a function.
+locations, give your program a signal, restart it at a different
+address, or even return prematurely from a function.
@menu
* Assignment:: Assignment to variables
* Jumping:: Continuing at a different address
-@ifclear BARETARGET
* Signaling:: Giving your program a signal
-@end ifclear
-
* Returning:: Returning from a function
* Calling:: Calling your program's functions
* Patching:: Patching your program
@noindent
stores the value 4 into the variable @code{x}, and then prints the
value of the assignment expression (which is 4).
-@ifclear CONLY
@xref{Languages, ,Using @value{GDBN} with Different Languages}, for more
information on operators in supported languages.
-@end ifclear
@kindex set variable
@cindex variables, setting
that has already executed, in order to examine its execution in more
detail.
-@ifclear BARETARGET
@c @group
@node Signaling, Returning, Jumping, Altering
@section Giving your program a signal
the signal handling tables (@pxref{Signals}). The @code{signal} command
passes the signal directly to your program.
-@end ifclear
@node Returning, Calling, Signaling, Altering
@section Returning from a function
@node Patching, , Calling, Altering
@section Patching programs
+
@cindex patching binaries
@cindex writing into executables
-@ifclear BARETARGET
@cindex writing into corefiles
-@end ifclear
-By default, @value{GDBN} opens the file containing your program's executable
-code
-@ifclear BARETARGET
-(or the corefile)
-@end ifclear
-read-only. This prevents accidental alterations
-to machine code; but it also prevents you from intentionally patching
-your program's binary.
+By default, @value{GDBN} opens the file containing your program's
+executable code (or the corefile) read-only. This prevents accidental
+alterations to machine code; but it also prevents you from intentionally
+patching your program's binary.
If you'd like to be able to patch the binary, you can specify that
explicitly with the @code{set write} command. For example, you might
@kindex set write
@item set write on
@itemx set write off
-If you specify @samp{set write on}, @value{GDBN} opens executable
-@ifclear BARETARGET
-and core
-@end ifclear
-files for both reading and writing; if you specify @samp{set write
+If you specify @samp{set write on}, @value{GDBN} opens executable and
+core files for both reading and writing; if you specify @samp{set write
off} (the default), @value{GDBN} opens them read-only.
If you have already loaded a file, you must load it again (using the
-@code{exec-file}
-@ifclear BARETARGET
-or @code{core-file}
-@end ifclear
-command) after changing @code{set write}, for your new setting to take
-effect.
+@code{exec-file} or @code{core-file} command) after changing @code{set
+write}, for your new setting to take effect.
@item show write
@kindex show write
-Display whether executable files
-@ifclear BARETARGET
-and core files
-@end ifclear
-are opened for writing as well as reading.
+Display whether executable files and core files are opened for writing
+as well as reading.
@end table
@node GDB Files, Targets, Altering, Top
@chapter @value{GDBN} Files
-@value{GDBN} needs to know the file name of the program to be debugged, both in
-order to read its symbol table and in order to start your program.
-@ifclear BARETARGET
-To debug a core dump of a previous run, you must also tell @value{GDBN}
-the name of the core dump file.
-@end ifclear
+@value{GDBN} needs to know the file name of the program to be debugged,
+both in order to read its symbol table and in order to start your
+program. To debug a core dump of a previous run, you must also tell
+@value{GDBN} the name of the core dump file.
@menu
* Files:: Commands to specify files
@node Files, Symbol Errors, GDB Files, GDB Files
@section Commands to specify files
-@cindex symbol table
-@ifclear BARETARGET
+@cindex symbol table
@cindex core dump file
-You may want to specify executable and core dump file names.
-The usual way to do this is at start-up time, using the arguments to
-@value{GDBN}'s start-up commands (@pxref{Invocation, ,
-Getting In and Out of @value{GDBN}}).
-@end ifclear
-@ifset BARETARGET
-The usual way to specify an executable file name is with
-the command argument given when you start @value{GDBN}, (@pxref{Invocation,
-,Getting In and Out of @value{GDBN}}.
-@end ifset
+
+You may want to specify executable and core dump file names. The usual
+way to do this is at start-up time, using the arguments to
+@value{GDBN}'s start-up commands (@pxref{Invocation, , Getting In and
+Out of @value{GDBN}}).
Occasionally it is necessary to change to a different file during a
@value{GDBN} session. Or you may run @value{GDBN} and forget to specify
entire symbol table available.
@end ifclear
-@ifclear BARETARGET
@ifclear HPPA
If memory-mapped files are available on your system through the
@code{mmap} system call, you can use another option, @samp{-mapped}, to
The @file{.syms} file is specific to the host machine where you run
@value{GDBN}. It holds an exact image of the internal @value{GDBN}
symbol table. It cannot be shared across multiple host platforms.
-@end ifclear
@c FIXME: for now no mention of directories, since this seems to be in
@c flux. 13mar1992 status is that in theory GDB would look either in
to be used.
Note that the core file is ignored when your program is actually running
-under @value{GDBN}. So, if you have been running your program and you wish to
-debug a core file instead, you must kill the subprocess in which the
-program is running. To do this, use the @code{kill} command
+under @value{GDBN}. So, if you have been running your program and you
+wish to debug a core file instead, you must kill the subprocess in which
+the program is running. To do this, use the @code{kill} command
(@pxref{Kill Process, ,Killing the child process}).
@end ifclear
-@ifclear BARETARGET
@ifclear HPPA
@kindex add-symbol-file
@cindex dynamic linking
shared libraries, however if @value{GDBN} does not find yours, you can run
@code{add-shared-symbol-file}. It takes no arguments.
@end ifclear
-@end ifclear
@ifclear HPPA
@kindex section
@kindex info target
@item info files
@itemx info target
-@code{info files} and @code{info target} are synonymous; both print
-the current target (@pxref{Targets, ,Specifying a Debugging Target}),
-including the
-@ifclear BARETARGET
-names of the executable and core dump files
-@end ifclear
-@ifset BARETARGET
-name of the executable file
-@end ifset
-currently in use by @value{GDBN}, and the files from which symbols were
-loaded. The command @code{help target} lists all possible targets
-rather than current ones.
+@code{info files} and @code{info target} are synonymous; both print the
+current target (@pxref{Targets, ,Specifying a Debugging Target}),
+including the names of the executable and core dump files currently in
+use by @value{GDBN}, and the files from which symbols were loaded. The
+command @code{help target} lists all possible targets rather than
+current ones.
+
@end table
All file-specifying commands allow both absolute and relative file names
as arguments. @value{GDBN} always converts the file name to an absolute file
name and remembers it that way.
-@ifclear BARETARGET
@cindex shared libraries
@ifclear HPPA
@c added HP-UX -- Kim (HP writer)
@end table
@end ifset
-@end ifclear
-
@node Symbol Errors, , Files, GDB Files
@section Errors reading symbol files
@item unknown symbol type @code{0x@var{nn}}
-The symbol information contains new data types that @value{GDBN} does not yet
-know how to read. @code{0x@var{nn}} is the symbol type of the misunderstood
-information, in hexadecimal.
+The symbol information contains new data types that @value{GDBN} does
+not yet know how to read. @code{0x@var{nn}} is the symbol type of the
+misunderstood information, in hexadecimal.
-@value{GDBN} circumvents the error by ignoring this symbol information. This
-usually allows you to debug your program, though certain symbols
+@value{GDBN} circumvents the error by ignoring this symbol information.
+This usually allows you to debug your program, though certain symbols
are not accessible. If you encounter such a problem and feel like
-debugging it, you can debug @code{@value{GDBP}} with itself, breakpoint on
-@code{complain}, then go up to the function @code{read_dbx_symtab} and
-examine @code{*bufp} to see the symbol.
+debugging it, you can debug @code{@value{GDBP}} with itself, breakpoint
+on @code{complain}, then go up to the function @code{read_dbx_symtab}
+and examine @code{*bufp} to see the symbol.
@item stub type has NULL name
-@value{GDBN} could not find the full definition for
-@ifclear CONLY
-a struct or class.
-@end ifclear
-@ifset CONLY
-a struct.
-@end ifset
-@ifclear CONLY
-@item const/volatile indicator missing (ok if using g++ v1.x), got@dots{}
+@value{GDBN} could not find the full definition for a struct or class.
+@item const/volatile indicator missing (ok if using g++ v1.x), got@dots{}
The symbol information for a C++ member function is missing some
-information that recent versions of the compiler should have output
-for it.
-@end ifclear
+information that recent versions of the compiler should have output for
+it.
@item info mismatch between compiler and debugger
@value{GDBN} could not parse a type specification output by the compiler.
+
@end table
@node Targets, Controlling GDB, GDB Files, Top
@chapter Specifying a Debugging Target
+
@cindex debugging target
@kindex target
A @dfn{target} is the execution environment occupied by your program.
@ifclear HPPA
-@ifclear BARETARGET
Often, @value{GDBN} runs in the same host environment as your program; in
that case, the debugging target is specified as a side effect when you
use the @code{file} or @code{core} commands. When you need more
host, or controlling a standalone system over a serial port or a
realtime system over a TCP/IP connection---you
@end ifclear
-@end ifclear
@ifset HPPA
On HP-UX systems, @value{GDBN} has been configured to support debugging
of processes running on the PA-RISC architecture. This means that the
@value{GDBN} on HP-UX has not been configured to support remote
debugging, or to support programs running on other platforms. You
-@end ifset
-@ifset BARETARGET
-You
-@end ifset
can use the @code{target} command to specify one of the target types
configured for @value{GDBN} (@pxref{Target Commands, ,Commands for managing
targets}).
+@end ifset
@menu
* Active Targets:: Active targets
* Target Commands:: Commands for managing targets
-@ifset REMOTESTUB
* Byte Order:: Choosing target byte order
* Remote:: Remote debugging
-@end ifset
+* KOD:: Kernel Object Display
@end menu
@node Active Targets, Target Commands, Targets, Targets
@section Active targets
+
@cindex stacking targets
@cindex active targets
@cindex multiple targets
-@ifclear BARETARGET
There are three classes of targets: processes, core files, and
-executable files. @value{GDBN} can work concurrently on up to three active
-targets, one in each class. This allows you to (for example) start a
-process and inspect its activity without abandoning your work on a core
-file.
+executable files. @value{GDBN} can work concurrently on up to three
+active targets, one in each class. This allows you to (for example)
+start a process and inspect its activity without abandoning your work on
+a core file.
For example, if you execute @samp{gdb a.out}, then the executable file
@code{a.out} is the only active target. If you designate a core file as
are complementary, since core files contain only a program's
read-write memory---variables and so on---plus machine status, while
executable files contain only the program text and initialized data.)
-@end ifclear
When you type @code{run}, your executable file becomes an active process
-target as well. When a process target is active, all @value{GDBN} commands
-requesting memory addresses refer to that target; addresses in an
-@ifclear BARETARGET
-active core file or
-@end ifclear
-executable file target are obscured while the process
-target is active.
+target as well. When a process target is active, all @value{GDBN}
+commands requesting memory addresses refer to that target; addresses in
+an active core file or executable file target are obscured while the
+process target is active.
-@ifset BARETARGET
-Use the @code{exec-file} command to select a
-new executable target (@pxref{Files, ,Commands to specify
-files}).
-@end ifset
-@ifclear BARETARGET
-Use the @code{core-file} and @code{exec-file} commands to select a
-new core file or executable target (@pxref{Files, ,Commands to specify
+Use the @code{core-file} and @code{exec-file} commands to select a new
+core file or executable target (@pxref{Files, ,Commands to specify
files}). To specify as a target a process that is already running, use
-the @code{attach} command (@pxref{Attach, ,Debugging an
-already-running process}).
-@end ifclear
+the @code{attach} command (@pxref{Attach, ,Debugging an already-running
+process}).
@node Target Commands, Byte Order, Active Targets, Targets
@section Commands for managing targets
@table @code
@item target @var{type} @var{parameters}
-Connects the @value{GDBN} host environment to a target
-@ifset BARETARGET
-machine.
-@end ifset
-@ifclear BARETARGET
-machine or process. A target is typically a protocol for talking to
-debugging facilities. You use the argument @var{type} to specify the
-type or protocol of the target machine.
+Connects the @value{GDBN} host environment to a target machine or
+process. A target is typically a protocol for talking to debugging
+facilities. You use the argument @var{type} to specify the type or
+protocol of the target machine.
Further @var{parameters} are interpreted by the target protocol, but
typically include things like device names or host names to connect
with, process numbers, and baud rates.
-@end ifclear
The @code{target} command does not repeat if you press @key{RET} again
after executing the command.
An executable file. @samp{target exec @var{program}} is the same as
@samp{exec-file @var{program}}.
-@ifclear BARETARGET
@kindex target core
@item target core @var{filename}
A core dump file. @samp{target core @var{filename}} is the same as
@samp{core-file @var{filename}}.
-@end ifclear
@kindex target remote
@item target remote @var{dev}
@kindex target hms
@item target hms @var{dev}
A Hitachi SH, H8/300, or H8/500 board, attached via serial line to your host.
-@ifclear H8EXCLUSIVE
Use special commands @code{device} and @code{speed} to control the serial
line and the communications speed used.
@xref{Hitachi Remote,,@value{GDBN} and Hitachi Microprocessors}.
@item target w89k @var{dev}
W89K monitor, running on a Winbond HPPA board.
-@end ifclear
@end table
-@ifset GENERIC
Different targets are available on different configurations of @value{GDBN};
your configuration may have more or fewer targets.
-@end ifset
Many remote targets require you to download the executable's code
once you've successfully established a connection.
@kindex load @var{filename}
@item load @var{filename}
-@ifset GENERIC
Depending on what remote debugging facilities are configured into
@value{GDBN}, the @code{load} command may be available. Where it exists, it
is meant to make @var{filename} (an executable) available for debugging
If your @value{GDBN} does not have a @code{load} command, attempting to
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
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} links @var{filename} dynamically on the
current target system as well as adding its symbols in @value{GDBN}.
-@end ifset
-@ifset I960
@cindex download to Nindy-960
With the Nindy interface to an Intel 960 board, @code{load}
downloads @var{filename} to the 960 as well as adding its symbols in
@value{GDBN}.
-@end ifset
-@ifset H8
@cindex download to H8/300 or H8/500
@cindex H8/300 or H8/500 download
@cindex download to Hitachi SH
the @code{load} command downloads your program to the Hitachi board and also
opens it as the current executable target for @value{GDBN} on your host
(like the @code{file} command).
-@end ifset
@code{load} does not repeat if you press @key{RET} again after using it.
@end table
-@ifset REMOTESTUB
@node Byte Order, Remote, Target Commands, Targets
@section Choosing target byte order
+
@cindex choosing target byte order
@cindex target byte order
@kindex set endian big
data on the host, and that they have absolutely no effect on the
target system.
-@node Remote, , Byte Order, Targets
+@node Remote, KOD, Byte Order, Targets
@section Remote debugging
@cindex remote debugging
Other remote targets may be available in your
configuration of @value{GDBN}; use @code{help target} to list them.
-@end ifset
-@ifset GENERIC
@c Text on starting up GDB in various specific cases; it goes up front
@c in manuals configured for any of those particular situations, here
@c otherwise.
@menu
-@ifset REMOTESTUB
* Remote Serial:: @value{GDBN} remote serial protocol
-@end ifset
-@ifset I960
* i960-Nindy Remote:: @value{GDBN} with a remote i960 (Nindy)
-@end ifset
-@ifset AMD29K
* UDI29K Remote:: The UDI protocol for AMD29K
* EB29K Remote:: The EBMON protocol for AMD29K
-@end ifset
-@ifset VXWORKS
* VxWorks Remote:: @value{GDBN} and VxWorks
-@end ifset
-@ifset ST2000
* ST2000 Remote:: @value{GDBN} with a Tandem ST2000
-@end ifset
-@ifset H8
* Hitachi Remote:: @value{GDBN} and Hitachi Microprocessors
-@end ifset
-@ifset MIPS
* MIPS Remote:: @value{GDBN} and MIPS boards
-@end ifset
-@ifset SPARCLET
* Sparclet Remote:: @value{GDBN} and Sparclet boards
-@end ifset
-@ifset SIMS
* Simulator:: Simulated CPU target
-@end ifset
@end menu
@include remote.texi
-@end ifset
+
+
+@node KOD, , Remote, Targets
+@section Kernel Object Display
+@cindex kernel object display
+@cindex kernel object
+@cindex KOD
+
+Some targets support kernel object display. Using this facility,
+@value{GDBN} communicates specially with the underlying operating system
+and can display information about operating system-level objects such as
+mutexes and other synchronization objects. Exactly which objects can be
+displayed is determined on a per-OS basis.
+
+Use the @code{set os} command to set the operating system. This tells
+@value{GDBN} which kernel object display module to initialize:
+
+@example
+(gdb) set os cisco
+@end example
+
+If @code{set os} succeeds, @value{GDBN} will display some information
+about the operating system, and will create a new @code{info} command
+which can be used to query the target. The @code{info} command is named
+after the operating system:
+
+@example
+(gdb) info cisco
+List of Cisco Kernel Objects
+Object Description
+any Any and all objects
+@end example
+
+Further subcommands can be used to query about particular objects known
+by the kernel.
+
+There is currently no way to determine whether a given operating system
+is supported other than to try it.
+
@node Controlling GDB
@chapter Controlling @value{GDBN}
execution stops in your program: before breakpoint commands are run,
displays are printed, or the stack frame is printed.
-@ifclear BARETARGET
For example, to ignore @code{SIGALRM} signals while
single-stepping, but treat them normally during normal execution,
you could define:
handle SIGLARM pass
end
@end example
-@end ifclear
You can define a hook for any single-word command in @value{GDBN}, but
not for command aliases; you should define a hook for the basic command
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
On some configurations of @value{GDBN}, the init file is known by a
different name (these are typically environments where a specialized
@item
ES-1800 (Ericsson Telecom AB M68000 emulator): @samp{.esgdbinit}
@end itemize
-@end ifset
You can also request the execution of a command file with the
@code{source} command:
letter.
@end table
-@ifclear DOSHOST
@node Emacs, GDB Bugs, Sequences, Top
@chapter Using @value{GDBN} under @sc{gnu} Emacs
@code{inspect} which performs identically to @code{print} except that
each value is printed in its own window.
@end ignore
-@end ifclear
@node GDB Bugs
@c links whacked to pacify makeinfo
@c The readline documentation is distributed with the readline code
@c and consists of the two following files:
@c rluser.texinfo
-@c inc-hist.texi
+@c inc-hist.texinfo
@c Use -I with makeinfo to point to the appropriate directory,
@c environment var TEXINPUTS with TeX.
@include rluser.texinfo
-@include inc-hist.texi
+@include inc-hist.texinfo
@ifclear PRECONFIGURED