home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 7
/
FreshFishVol7.bin
/
bbs
/
gnu
/
gdb-4.12-src.lha
/
GNU
/
src
/
amiga
/
gdb-4.12
/
gdb
/
gdb.info-7
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-02-03
|
50KB
|
918 lines
This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
file gdb.texinfo.
START-INFO-DIR-ENTRY
* Gdb:: The GNU debugger.
END-INFO-DIR-ENTRY
This file documents the GNU debugger GDB.
This is Edition 4.12, January 1994, of `Debugging with GDB: the GNU
Source-Level Debugger' for GDB Version 4.12.
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 are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the entire resulting derived work is distributed under the terms
of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.
File: gdb.info, Node: Hooks, Next: Command Files, Prev: Define, Up: Sequences
User-defined command hooks
==========================
You may define *hooks*, which are a special kind of user-defined
command. Whenever you run the command `foo', if the user-defined
command `hook-foo' exists, it is executed (with no arguments) before
that command.
In addition, a pseudo-command, `stop' exists. Defining
(`hook-stop') makes the associated commands execute every time
execution stops in your program: before breakpoint commands are run,
displays are printed, or the stack frame is printed.
For example, to ignore `SIGALRM' signals while single-stepping, but
treat them normally during normal execution, you could define:
define hook-stop
handle SIGALRM nopass
end
define hook-run
handle SIGALRM pass
end
define hook-continue
handle SIGLARM pass
end
You can define a hook for any single-word command in GDB, but not
for command aliases; you should define a hook for the basic command
name, e.g. `backtrace' rather than `bt'. If an error occurs during
the execution of your hook, execution of GDB commands stops and GDB
issues a prompt (before the command that you actually typed had a
chance to run).
If you try to define a hook which does not match any known command,
you get a warning from the `define' command.
File: gdb.info, Node: Command Files, Next: Output, Prev: Hooks, Up: Sequences
Command files
=============
A command file for GDB is a file of lines that are GDB commands.
Comments (lines starting with `#') may also be included. An empty line
in a command file does nothing; it does not mean to repeat the last
command, as it would from the terminal.
When you start GDB, it automatically executes commands from its
"init files". These are files named `.gdbinit'. GDB 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 `set complaints') which affect the
processing of the command line options and operands. The init files
are not executed if you use the `-nx' option; *note Choosing modes:
Mode Options..
On some configurations of GDB, the init file is known by a different
name (these are typically environments where a specialized form of GDB
may need to coexist with other forms, hence a different name for the
specialized version's init file). These are the environments with
special init file names:
* VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
* OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
* ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
You can also request the execution of a command file with the
`source' command:
`source FILENAME'
Execute the command file FILENAME.
The lines in a command file are executed sequentially. They are not
printed as they are executed. An error in any command terminates
execution of the command file.
Commands that would ask for confirmation if used interactively
proceed without asking when used in a command file. Many GDB commands
that normally print messages to say what they are doing omit the
messages when called from command files.
File: gdb.info, Node: Output, Prev: Command Files, Up: Sequences
Commands for controlled output
==============================
During the execution of a command file or a user-defined command,
normal GDB output is suppressed; the only output that appears is what is
explicitly printed by the commands in the definition. This section
describes three commands useful for generating exactly the output you
want.
`echo TEXT'
Print TEXT. Nonprinting characters can be included in TEXT using
C escape sequences, such as `\n' to print a newline. *No newline
is printed unless you specify one.* In addition to the standard C
escape sequences, a backslash followed by a space stands for a
space. This is useful for displaying a string with spaces at the
beginning or the end, since leading and trailing spaces are
otherwise trimmed from all arguments. To print ` and foo = ', use
the command `echo \ and foo = \ '.
A backslash at the end of TEXT can be used, as in C, to continue
the command onto subsequent lines. For example,
echo This is some text\n\
which is continued\n\
onto several lines.\n
produces the same output as
echo This is some text\n
echo which is continued\n
echo onto several lines.\n
`output EXPRESSION'
Print the value of EXPRESSION and nothing but that value: no
newlines, no `$NN = '. The value is not entered in the value
history either. *Note Expressions: Expressions, for more
information on expressions.
`output/FMT EXPRESSION'
Print the value of EXPRESSION in format FMT. You can use the same
formats as for `print'. *Note Output formats: Output Formats, for
more information.
`printf STRING, EXPRESSIONS...'
Print the values of the EXPRESSIONS under the control of STRING.
The EXPRESSIONS are separated by commas and may be either numbers
or pointers. Their values are printed as specified by STRING,
exactly as if your program were to execute the C subroutine
printf (STRING, EXPRESSIONS...);
For example, you can print two values in hex like this:
printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
The only backslash-escape sequences that you can use in the format
string are the simple ones that consist of backslash followed by a
letter.
File: gdb.info, Node: Emacs, Next: GDB Bugs, Prev: Sequences, Up: Top
Using GDB under GNU Emacs
*************************
A special interface allows you to use GNU Emacs to view (and edit)
the source files for the program you are debugging with GDB.
To use this interface, use the command `M-x gdb' in Emacs. Give the
executable file you want to debug as an argument. This command starts
GDB as a subprocess of Emacs, with input and output through a newly
created Emacs buffer.
Using GDB under Emacs is just like using GDB normally except for two
things:
* All "terminal" input and output goes through the Emacs buffer.
This applies both to GDB commands and their output, and to the input
and output done by the program you are debugging.
This is useful because it means that you can copy the text of
previous commands and input them again; you can even use parts of the
output in this way.
All the facilities of Emacs' Shell mode are available for interacting
with your program. In particular, you can send signals the usual
way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
* GDB displays source code through Emacs.
Each time GDB displays a stack frame, Emacs automatically finds the
source file for that frame and puts an arrow (`=>') at the left margin
of the current line. Emacs uses a separate buffer for source display,
and splits the screen to show both your GDB session and the source.
Explicit GDB `list'