Line 1... |
Line 1... |
This is gdb.info, produced by makeinfo version 4.8 from ./gdb.texinfo.
|
This is gdb.info, produced by makeinfo version 4.13 from ./gdb.texinfo.
|
|
|
INFO-DIR-SECTION Software development
|
INFO-DIR-SECTION Software development
|
START-INFO-DIR-ENTRY
|
START-INFO-DIR-ENTRY
|
* Gdb: (gdb). The GNU debugger.
|
* Gdb: (gdb). The GNU debugger.
|
END-INFO-DIR-ENTRY
|
END-INFO-DIR-ENTRY
|
Line 21... |
Line 21... |
developing GNU and promoting software freedom."
|
developing GNU and promoting software freedom."
|
|
|
This file documents the GNU debugger GDB.
|
This file documents the GNU debugger GDB.
|
|
|
This is the Ninth Edition, of `Debugging with GDB: the GNU
|
This is the Ninth Edition, of `Debugging with GDB: the GNU
|
Source-Level Debugger' for GDB (GDB) Version 7.2.
|
Source-Level Debugger' for GDB (GDB) Version 7.2-or32-1.0rc1.
|
|
|
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
|
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
|
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
2010 Free Software Foundation, Inc.
|
2010 Free Software Foundation, Inc.
|
|
|
Line 46... |
Line 46... |
Debugging with GDB
|
Debugging with GDB
|
******************
|
******************
|
|
|
This file describes GDB, the GNU symbolic debugger.
|
This file describes GDB, the GNU symbolic debugger.
|
|
|
This is the Ninth Edition, for GDB (GDB) Version 7.2.
|
This is the Ninth Edition, for GDB (GDB) Version 7.2-or32-1.0rc1.
|
|
|
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
Copyright (C) 1988-2010 Free Software Foundation, Inc.
|
|
|
This edition of the GDB manual is dedicated to the memory of Fred
|
This edition of the GDB manual is dedicated to the memory of Fred
|
Fish. Fred was a long-standing contributor to GDB and to Free software
|
Fish. Fred was a long-standing contributor to GDB and to Free software
|
Line 133... |
Line 133... |
|
|
* Change things in your program, so you can experiment with
|
* Change things in your program, so you can experiment with
|
correcting the effects of one bug and go on to learn about another.
|
correcting the effects of one bug and go on to learn about another.
|
|
|
You can use GDB to debug programs written in C and C++. For more
|
You can use GDB to debug programs written in C and C++. For more
|
information, see *Note Supported Languages: Supported Languages. For
|
information, see *note Supported Languages: Supported Languages. For
|
more information, see *Note C and C++: C.
|
more information, see *note C and C++: C.
|
|
|
Support for D is partial. For information on D, see *Note D: D.
|
Support for D is partial. For information on D, see *note D: D.
|
|
|
Support for Modula-2 is partial. For information on Modula-2, see
|
Support for Modula-2 is partial. For information on Modula-2, see
|
*Note Modula-2: Modula-2.
|
*note Modula-2: Modula-2.
|
|
|
Debugging Pascal programs which use sets, subranges, file variables,
|
Debugging Pascal programs which use sets, subranges, file variables,
|
or nested functions does not currently work. GDB does not support
|
or nested functions does not currently work. GDB does not support
|
entering expressions, printing values, or similar features using Pascal
|
entering expressions, printing values, or similar features using Pascal
|
syntax.
|
syntax.
|
Line 435... |
Line 435... |
John Newlin, and Scott Foehner.
|
John Newlin, and Scott Foehner.
|
|
|
Michael Eager and staff of Xilinx, Inc., contributed support for the
|
Michael Eager and staff of Xilinx, Inc., contributed support for the
|
Xilinx MicroBlaze architecture.
|
Xilinx MicroBlaze architecture.
|
|
|
|
The original port to the OpenRISC 1000 is believed to be due to
|
|
Alessandro Forin and Per Bothner. More recent ports have been the work
|
|
of Jeremy Bennett.
|
|
|
|
|
File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
|
File: gdb.info, Node: Sample Session, Next: Invocation, Prev: Summary, Up: Top
|
|
|
1 A Sample GDB Session
|
1 A Sample GDB Session
|
**********************
|
**********************
|
Line 481... |
Line 485... |
of it under certain conditions; type "show copying" to see
|
of it under certain conditions; type "show copying" to see
|
the conditions.
|
the conditions.
|
There is absolutely no warranty for GDB; type "show warranty"
|
There is absolutely no warranty for GDB; type "show warranty"
|
for details.
|
for details.
|
|
|
GDB 7.2, Copyright 1999 Free Software Foundation, Inc...
|
GDB 7.2-or32-1.0rc1, Copyright 1999 Free Software Foundation, Inc...
|
(gdb)
|
(gdb)
|
|
|
GDB reads only enough symbol data to know where to find the rest when
|
GDB reads only enough symbol data to know where to find the rest when
|
needed; as a result, the first prompt comes up very quickly. We now
|
needed; as a result, the first prompt comes up very quickly. We now
|
tell GDB to use a narrower display width than usual, so that examples
|
tell GDB to use a narrower display width than usual, so that examples
|
Line 1158... |
Line 1162... |
|
|
A blank line as input to GDB (typing just ) means to repeat the
|
A blank line as input to GDB (typing just ) means to repeat the
|
previous command. Certain commands (for example, `run') will not
|
previous command. Certain commands (for example, `run') will not
|
repeat this way; these are commands whose unintentional repetition
|
repeat this way; these are commands whose unintentional repetition
|
might cause trouble and which you are unlikely to want to repeat.
|
might cause trouble and which you are unlikely to want to repeat.
|
User-defined commands can disable this feature; see *Note dont-repeat:
|
User-defined commands can disable this feature; see *note dont-repeat:
|
Define.
|
Define.
|
|
|
The `list' and `x' commands, when you repeat them with ,
|
The `list' and `x' commands, when you repeat them with ,
|
construct new arguments rather than repeating exactly as typed. This
|
construct new arguments rather than repeating exactly as typed. This
|
permits easy scanning of source or memory.
|
permits easy scanning of source or memory.
|
Line 1271... |
Line 1275... |
|
|
In general, GDB can tell that a quote is needed (and inserts it) if you
|
In general, GDB can tell that a quote is needed (and inserts it) if you
|
have not yet started typing the argument list when you ask for
|
have not yet started typing the argument list when you ask for
|
completion on an overloaded symbol.
|
completion on an overloaded symbol.
|
|
|
For more information about overloaded functions, see *Note C++
|
For more information about overloaded functions, see *note C++
|
Expressions: C Plus Plus Expressions. You can use the command `set
|
Expressions: C Plus Plus Expressions. You can use the command `set
|
overload-resolution off' to disable overload resolution; see *Note GDB
|
overload-resolution off' to disable overload resolution; see *note GDB
|
Features for C++: Debugging C Plus Plus.
|
Features for C++: Debugging C Plus Plus.
|
|
|
When completing in an expression which looks up a field in a
|
When completing in an expression which looks up a field in a
|
structure, GDB also tries(1) to limit completions to the field names
|
structure, GDB also tries(1) to limit completions to the field names
|
available in the type of the left-hand-side:
|
available in the type of the left-hand-side:
|
Line 1509... |
Line 1513... |
|
|
GCC, the GNU C/C++ compiler, supports `-g' with or without `-O',
|
GCC, the GNU C/C++ compiler, supports `-g' with or without `-O',
|
making it possible to debug optimized code. We recommend that you
|
making it possible to debug optimized code. We recommend that you
|
_always_ use `-g' whenever you compile a program. You may think your
|
_always_ use `-g' whenever you compile a program. You may think your
|
program is correct, but there is no sense in pushing your luck. For
|
program is correct, but there is no sense in pushing your luck. For
|
more information, see *Note Optimized Code::.
|
more information, see *note Optimized Code::.
|
|
|
Older versions of the GNU C compiler permitted a variant option
|
Older versions of the GNU C compiler permitted a variant option
|
`-gg' for debugging information. GDB no longer supports this format;
|
`-gg' for debugging information. GDB no longer supports this format;
|
if your GNU C compiler has this option, do not use it.
|
if your GNU C compiler has this option, do not use it.
|
|
|
Line 1631... |
Line 1635... |
underlying `run' command. Note that the same arguments will be
|
underlying `run' command. Note that the same arguments will be
|
reused if no argument is provided during subsequent calls to
|
reused if no argument is provided during subsequent calls to
|
`start' or `run'.
|
`start' or `run'.
|
|
|
It is sometimes necessary to debug the program during elaboration.
|
It is sometimes necessary to debug the program during elaboration.
|
In these cases, using the `start' command would stop the
|
In these cases, using the `start' command would stop the execution
|
execution of your program too late, as the program would have
|
of your program too late, as the program would have already
|
already completed the elaboration phase. Under these
|
completed the elaboration phase. Under these circumstances,
|
circumstances, insert breakpoints in your elaboration code before
|
insert breakpoints in your elaboration code before running your
|
running your program.
|
program.
|
|
|
`set exec-wrapper WRAPPER'
|
`set exec-wrapper WRAPPER'
|
`show exec-wrapper'
|
`show exec-wrapper'
|
`unset exec-wrapper'
|
`unset exec-wrapper'
|
When `exec-wrapper' is set, the specified wrapper is used to
|
When `exec-wrapper' is set, the specified wrapper is used to
|
Line 2692... |
Line 2696... |
when a certain kind of event occurs, such as the throwing of a C++
|
when a certain kind of event occurs, such as the throwing of a C++
|
exception or the loading of a library. As with watchpoints, you use a
|
exception or the loading of a library. As with watchpoints, you use a
|
different command to set a catchpoint (*note Setting Catchpoints: Set
|
different command to set a catchpoint (*note Setting Catchpoints: Set
|
Catchpoints.), but aside from that, you can manage a catchpoint like any
|
Catchpoints.), but aside from that, you can manage a catchpoint like any
|
other breakpoint. (To stop when your program receives a signal, use the
|
other breakpoint. (To stop when your program receives a signal, use the
|
`handle' command; see *Note Signals: Signals.)
|
`handle' command; see *note Signals: Signals.)
|
|
|
GDB assigns a number to each breakpoint, watchpoint, or catchpoint
|
GDB assigns a number to each breakpoint, watchpoint, or catchpoint
|
when you create it; these numbers are successive integers starting with
|
when you create it; these numbers are successive integers starting with
|
one. In many of the commands for controlling various features of
|
one. In many of the commands for controlling various features of
|
breakpoints you use the breakpoint number to say which breakpoint you
|
breakpoints you use the breakpoint number to say which breakpoint you
|
Line 2728... |
Line 2732... |
5.1.1 Setting Breakpoints
|
5.1.1 Setting Breakpoints
|
-------------------------
|
-------------------------
|
|
|
Breakpoints are set with the `break' command (abbreviated `b'). The
|
Breakpoints are set with the `break' command (abbreviated `b'). The
|
debugger convenience variable `$bpnum' records the number of the
|
debugger convenience variable `$bpnum' records the number of the
|
breakpoint you've set most recently; see *Note Convenience Variables:
|
breakpoint you've set most recently; see *note Convenience Variables:
|
Convenience Vars, for a discussion of what you can do with convenience
|
Convenience Vars, for a discussion of what you can do with convenience
|
variables.
|
variables.
|
|
|
`break LOCATION'
|
`break LOCATION'
|
Set a breakpoint at the given LOCATION, which can specify a
|
Set a breakpoint at the given LOCATION, which can specify a
|
Line 2799... |
Line 2803... |
only two data breakpoints can be set at a time, and GDB will
|
only two data breakpoints can be set at a time, and GDB will
|
reject this command if more than two are used. Delete or disable
|
reject this command if more than two are used. Delete or disable
|
unused hardware breakpoints before setting new ones (*note
|
unused hardware breakpoints before setting new ones (*note
|
Disabling Breakpoints: Disabling.). *Note Break Conditions:
|
Disabling Breakpoints: Disabling.). *Note Break Conditions:
|
Conditions. For remote targets, you can restrict the number of
|
Conditions. For remote targets, you can restrict the number of
|
hardware breakpoints GDB will use, see *Note set remote
|
hardware breakpoints GDB will use, see *note set remote
|
hardware-breakpoint-limit::.
|
hardware-breakpoint-limit::.
|
|
|
`thbreak ARGS'
|
`thbreak ARGS'
|
Set a hardware-assisted breakpoint enabled only for one stop. ARGS
|
Set a hardware-assisted breakpoint enabled only for one stop. ARGS
|
are the same as for the `hbreak' command and the breakpoint is set
|
are the same as for the `hbreak' command and the breakpoint is set
|
in the same way. However, like the `tbreak' command, the
|
in the same way. However, like the `tbreak' command, the
|
breakpoint is automatically deleted after the first time your
|
breakpoint is automatically deleted after the first time your
|
program stops there. Also, like the `hbreak' command, the
|
program stops there. Also, like the `hbreak' command, the
|
breakpoint requires hardware support and some target hardware may
|
breakpoint requires hardware support and some target hardware may
|
not have this support. *Note Disabling Breakpoints: Disabling.
|
not have this support. *Note Disabling Breakpoints: Disabling.
|
See also *Note Break Conditions: Conditions.
|
See also *note Break Conditions: Conditions.
|
|
|
`rbreak REGEX'
|
`rbreak REGEX'
|
Set breakpoints on all functions matching the regular expression
|
Set breakpoints on all functions matching the regular expression
|
REGEX. This command sets an unconditional breakpoint on all
|
REGEX. This command sets an unconditional breakpoint on all
|
matches, printing a list of all breakpoints it set. Once these
|
matches, printing a list of all breakpoints it set. Once these
|
Line 2870... |
Line 2874... |
Enabled breakpoints are marked with `y'. `n' marks
|
Enabled breakpoints are marked with `y'. `n' marks
|
breakpoints that are not enabled.
|
breakpoints that are not enabled.
|
|
|
_Address_
|
_Address_
|
Where the breakpoint is in your program, as a memory address.
|
Where the breakpoint is in your program, as a memory address.
|
For a pending breakpoint whose address is not yet known,
|
For a pending breakpoint whose address is not yet known, this
|
this field will contain `'. Such breakpoint won't
|
field will contain `'. Such breakpoint won't fire
|
fire until a shared library that has the symbol or line
|
until a shared library that has the symbol or line referred
|
referred by breakpoint is loaded. See below for details. A
|
by breakpoint is loaded. See below for details. A
|
breakpoint with several locations will have `' in
|
breakpoint with several locations will have `' in
|
this field--see below for details.
|
this field--see below for details.
|
|
|
_What_
|
_What_
|
Where the breakpoint is in the source for your program, as a
|
Where the breakpoint is in the source for your program, as a
|
Line 3165... |
Line 3169... |
|
|
`show can-use-hw-watchpoints'
|
`show can-use-hw-watchpoints'
|
Show the current mode of using hardware watchpoints.
|
Show the current mode of using hardware watchpoints.
|
|
|
For remote targets, you can restrict the number of hardware
|
For remote targets, you can restrict the number of hardware
|
watchpoints GDB will use, see *Note set remote
|
watchpoints GDB will use, see *note set remote
|
hardware-breakpoint-limit::.
|
hardware-breakpoint-limit::.
|
|
|
When you issue the `watch' command, GDB reports
|
When you issue the `watch' command, GDB reports
|
|
|
Hardware watchpoint NUM: EXPR
|
Hardware watchpoint NUM: EXPR
|
Line 3573... |
Line 3577... |
Except for a breakpoint set with `tbreak' (*note Setting
|
Except for a breakpoint set with `tbreak' (*note Setting
|
Breakpoints: Set Breaks.), breakpoints that you set are initially
|
Breakpoints: Set Breaks.), breakpoints that you set are initially
|
enabled; subsequently, they become disabled or enabled only when you
|
enabled; subsequently, they become disabled or enabled only when you
|
use one of the commands above. (The command `until' can set and delete
|
use one of the commands above. (The command `until' can set and delete
|
a breakpoint of its own, but it does not change the state of your other
|
a breakpoint of its own, but it does not change the state of your other
|
breakpoints; see *Note Continuing and Stepping: Continuing and
|
breakpoints; see *note Continuing and Stepping: Continuing and
|
Stepping.)
|
Stepping.)
|
|
|
|
|
File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
|
File: gdb.info, Node: Conditions, Next: Break Commands, Prev: Disabling, Up: Breakpoints
|
|
|
Line 4014... |
Line 4018... |
|
|
`until LOCATION'
|
`until LOCATION'
|
`u LOCATION'
|
`u LOCATION'
|
Continue running your program until either the specified location
|
Continue running your program until either the specified location
|
is reached, or the current stack frame returns. LOCATION is any of
|
is reached, or the current stack frame returns. LOCATION is any of
|
the forms described in *Note Specify Location::. This form of the
|
the forms described in *note Specify Location::. This form of the
|
command uses temporary breakpoints, and hence is quicker than
|
command uses temporary breakpoints, and hence is quicker than
|
`until' without an argument. The specified location is actually
|
`until' without an argument. The specified location is actually
|
reached only if it is in the current frame. This implies that
|
reached only if it is in the current frame. This implies that
|
`until' can be used to skip over recursive function invocations.
|
`until' can be used to skip over recursive function invocations.
|
For instance in the code below, if the current location is line
|
For instance in the code below, if the current location is line
|
Line 4035... |
Line 4039... |
100 }
|
100 }
|
|
|
`advance LOCATION'
|
`advance LOCATION'
|
Continue running the program up to the given LOCATION. An
|
Continue running the program up to the given LOCATION. An
|
argument is required, which should be of one of the forms
|
argument is required, which should be of one of the forms
|
described in *Note Specify Location::. Execution will also stop
|
described in *note Specify Location::. Execution will also stop
|
upon exit from the current stack frame. This command is similar
|
upon exit from the current stack frame. This command is similar
|
to `until', but `advance' will not skip over recursive function
|
to `until', but `advance' will not skip over recursive function
|
calls, and the target location doesn't have to be in the same
|
calls, and the target location doesn't have to be in the same
|
frame as the current one.
|
frame as the current one.
|
|
|
Line 4301... |
Line 4305... |
`set schedule-multiple'
|
`set schedule-multiple'
|
Set the mode for allowing threads of multiple processes to be
|
Set the mode for allowing threads of multiple processes to be
|
resumed when an execution command is issued. When `on', all
|
resumed when an execution command is issued. When `on', all
|
threads of all processes are allowed to run. When `off', only the
|
threads of all processes are allowed to run. When `off', only the
|
threads of the current process are resumed. The default is `off'.
|
threads of the current process are resumed. The default is `off'.
|
The `scheduler-locking' mode takes precedence when set to `on',
|
The `scheduler-locking' mode takes precedence when set to `on', or
|
or while you are stepping and set to `step'.
|
while you are stepping and set to `step'.
|
|
|
`show schedule-multiple'
|
`show schedule-multiple'
|
Display the current mode for resuming the execution of threads of
|
Display the current mode for resuming the execution of threads of
|
multiple processes.
|
multiple processes.
|
|
|
Line 4451... |
Line 4455... |
`until'
|
`until'
|
*Note until: Continuing and Stepping.
|
*Note until: Continuing and Stepping.
|
|
|
|
|
Background execution is especially useful in conjunction with
|
Background execution is especially useful in conjunction with
|
non-stop mode for debugging programs with multiple threads; see *Note
|
non-stop mode for debugging programs with multiple threads; see *note
|
Non-Stop Mode::. However, you can also use these commands in the
|
Non-Stop Mode::. However, you can also use these commands in the
|
normal all-stop mode with the restriction that you cannot issue another
|
normal all-stop mode with the restriction that you cannot issue another
|
execution command until the previous one finishes. Examples of
|
execution command until the previous one finishes. Examples of
|
commands that are valid in all-stop mode while the program is running
|
commands that are valid in all-stop mode while the program is running
|
include `help' and `info break'.
|
include `help' and `info break'.
|
Line 5064... |
Line 5068... |
for line `993' of `builtin.c'.
|
for line `993' of `builtin.c'.
|
|
|
The value of parameter `data' in frame 1 has been replaced by `...'.
|
The value of parameter `data' in frame 1 has been replaced by `...'.
|
By default, GDB prints the value of a parameter only if it is a scalar
|
By default, GDB prints the value of a parameter only if it is a scalar
|
(integer, pointer, enumeration, etc). See command `set print
|
(integer, pointer, enumeration, etc). See command `set print
|
frame-arguments' in *Note Print Settings:: for more details on how to
|
frame-arguments' in *note Print Settings:: for more details on how to
|
configure the way function parameter values are printed.
|
configure the way function parameter values are printed.
|
|
|
If your program was compiled with optimizations, some compilers will
|
If your program was compiled with optimizations, some compilers will
|
optimize away arguments passed to functions if those arguments are
|
optimize away arguments passed to functions if those arguments are
|
never used after the call. Such optimizations generate code that
|
never used after the call. Such optimizations generate code that
|
Line 5291... |
Line 5295... |
(*note Selecting a Frame: Selection.), GDB prints the line where
|
(*note Selecting a Frame: Selection.), GDB prints the line where
|
execution in that frame has stopped. You can print other portions of
|
execution in that frame has stopped. You can print other portions of
|
source files by explicit command.
|
source files by explicit command.
|
|
|
If you use GDB through its GNU Emacs interface, you may prefer to
|
If you use GDB through its GNU Emacs interface, you may prefer to
|
use Emacs facilities to view source; see *Note Using GDB under GNU
|
use Emacs facilities to view source; see *note Using GDB under GNU
|
Emacs: Emacs.
|
Emacs: Emacs.
|
|
|
* Menu:
|
* Menu:
|
|
|
* List:: Printing source lines
|
* List:: Printing source lines
|
Line 5311... |
Line 5315... |
9.1 Printing Source Lines
|
9.1 Printing Source Lines
|
=========================
|
=========================
|
|
|
To print lines from a source file, use the `list' command (abbreviated
|
To print lines from a source file, use the `list' command (abbreviated
|
`l'). By default, ten lines are printed. There are several ways to
|
`l'). By default, ten lines are printed. There are several ways to
|
specify what part of the file you want to print; see *Note Specify
|
specify what part of the file you want to print; see *note Specify
|
Location::, for the full list.
|
Location::, for the full list.
|
|
|
Here are the forms of the `list' command most commonly used:
|
Here are the forms of the `list' command most commonly used:
|
|
|
`list LINENUM'
|
`list LINENUM'
|
Line 5580... |
Line 5584... |
manage a list of source path substitution rules. A "substitution rule"
|
manage a list of source path substitution rules. A "substitution rule"
|
specifies how to rewrite source directories stored in the program's
|
specifies how to rewrite source directories stored in the program's
|
debug information in case the sources were moved to a different
|
debug information in case the sources were moved to a different
|
directory between compilation and debugging. A rule is made of two
|
directory between compilation and debugging. A rule is made of two
|
strings, the first specifying what needs to be rewritten in the path,
|
strings, the first specifying what needs to be rewritten in the path,
|
and the second specifying how it should be rewritten. In *Note set
|
and the second specifying how it should be rewritten. In *note set
|
substitute-path::, we name these two parts FROM and TO respectively.
|
substitute-path::, we name these two parts FROM and TO respectively.
|
GDB does a simple string replacement of FROM with TO at the start of
|
GDB does a simple string replacement of FROM with TO at the start of
|
the directory part of the source file name, and uses that result
|
the directory part of the source file name, and uses that result
|
instead of the original file name to look up the sources.
|
instead of the original file name to look up the sources.
|
|
|
Line 5724... |
Line 5728... |
`info line' prints addresses in symbolic form as well as hex.
|
`info line' prints addresses in symbolic form as well as hex.
|
|
|
`info line LINESPEC'
|
`info line LINESPEC'
|
Print the starting and ending addresses of the compiled code for
|
Print the starting and ending addresses of the compiled code for
|
source line LINESPEC. You can specify source lines in any of the
|
source line LINESPEC. You can specify source lines in any of the
|
ways documented in *Note Specify Location::.
|
ways documented in *note Specify Location::.
|
|
|
For example, we can use `info line' to discover the location of the
|
For example, we can use `info line' to discover the location of the
|
object code for the first line of function `m4_changequote':
|
object code for the first line of function `m4_changequote':
|
|
|
(gdb) info line m4_changequote
|
(gdb) info line m4_changequote
|
Line 5881... |
Line 5885... |
`print EXPR'
|
`print EXPR'
|
`print /F EXPR'
|
`print /F EXPR'
|
EXPR is an expression (in the source language). By default the
|
EXPR is an expression (in the source language). By default the
|
value of EXPR is printed in a format appropriate to its data type;
|
value of EXPR is printed in a format appropriate to its data type;
|
you can choose a different format by specifying `/F', where F is a
|
you can choose a different format by specifying `/F', where F is a
|
letter specifying the format; see *Note Output Formats: Output
|
letter specifying the format; see *note Output Formats: Output
|
Formats.
|
Formats.
|
|
|
`print'
|
`print'
|
`print /F'
|
`print /F'
|
If you omit EXPR, GDB displays the last value again (from the
|
If you omit EXPR, GDB displays the last value again (from the
|
Line 5935... |
Line 5939... |
`print' and many other GDB commands accept an expression and compute
|
`print' and many other GDB commands accept an expression and compute
|
its value. Any kind of constant, variable or operator defined by the
|
its value. Any kind of constant, variable or operator defined by the
|
programming language you are using is valid in an expression in GDB.
|
programming language you are using is valid in an expression in GDB.
|
This includes conditional expressions, function calls, casts, and
|
This includes conditional expressions, function calls, casts, and
|
string constants. It also includes preprocessor macros, if you
|
string constants. It also includes preprocessor macros, if you
|
compiled your program to include this information; see *Note
|
compiled your program to include this information; see *note
|
Compilation::.
|
Compilation::.
|
|
|
GDB supports array constants in expressions input by the user. The
|
GDB supports array constants in expressions input by the user. The
|
syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
|
syntax is {ELEMENT, ELEMENT...}. For example, you can use the command
|
`print {1, 2, 3}' to create an array of three integers. If you pass an
|
`print {1, 2, 3}' to create an array of three integers. If you pass an
|
Line 6312... |
Line 6316... |
expression. For example, `p/x' reprints the last value in hex.
|
expression. For example, `p/x' reprints the last value in hex.
|
|
|
---------- Footnotes ----------
|
---------- Footnotes ----------
|
|
|
(1) `b' cannot be used because these format letters are also used
|
(1) `b' cannot be used because these format letters are also used
|
with the `x' command, where `b' stands for "byte"; see *Note Examining
|
with the `x' command, where `b' stands for "byte"; see *note Examining
|
Memory: Memory.
|
Memory: Memory.
|
|
|
|
|
File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
|
File: gdb.info, Node: Memory, Next: Auto Display, Prev: Output Formats, Up: Data
|
|
|
Line 6403... |
Line 6407... |
you want to see three machine instructions, including any operands.
|
you want to see three machine instructions, including any operands.
|
For convenience, especially when used with the `display' command, the
|
For convenience, especially when used with the `display' command, the
|
`i' format also prints branch delay slot instructions, if any, beyond
|
`i' format also prints branch delay slot instructions, if any, beyond
|
the count specified, which immediately follow the last instruction that
|
the count specified, which immediately follow the last instruction that
|
is within the count. The command `disassemble' gives an alternative
|
is within the count. The command `disassemble' gives an alternative
|
way of inspecting machine instructions; see *Note Source and Machine
|
way of inspecting machine instructions; see *note Source and Machine
|
Code: Machine Code.
|
Code: Machine Code.
|
|
|
All the defaults for the arguments to `x' are designed to make it
|
All the defaults for the arguments to `x' are designed to make it
|
easy to continue scanning memory with minimal specifications each time
|
easy to continue scanning memory with minimal specifications each time
|
you use `x'. For example, after you have inspected three machine
|
you use `x'. For example, after you have inspected three machine
|