Next: Remote Protocol, Previous: Installing GDB, Up: Top
In addition to commands intended for gdb users, gdb includes a number of commands intended for gdb developers, that are not documented elsewhere in this manual. These commands are provided here for reference. (For commands that turn on debugging messages, see Debugging Output.)
maint agent
expressionmaint agent-eval
expressiongloba +
globb
will include bytecodes to record four bytes of memory at each
of the addresses of globa
and globb
, while discarding
the result of the addition, while an evaluation expression will do the
addition and return the sum.
maint info breakpoints
breakpoint
watchpoint
longjmp
longjmp
calls.
longjmp resume
longjmp
.
until
until
command.
finish
finish
command.
shlib events
set displaced-stepping
show displaced-stepping
set displaced-stepping on
set displaced-stepping off
set displaced-stepping auto
maint check-symtabs
maint cplus first_component
namemaint cplus namespace
maint demangle
namemaint deprecate
command [replacement]maint undeprecate
commandmaint dump-me
SIGQUIT
signal.
maint internal-error
[message-text]maint internal-warning
[message-text]internal_error
or internal_warning
and hence behave as though an internal error
or internal warning has been detected. In addition to reporting the
internal problem, these functions give the user the opportunity to
either quit gdb or create a core file of the current
gdb session.
These commands take an optional parameter message-text that is used as the text of the error or warning message.
Here's an example of using internal-error
:
(gdb) maint internal-error testing, 1, 2 .../maint.c:121: internal-error: testing, 1, 2 A problem internal to GDB has been detected. Further debugging may prove unreliable. Quit this debugging session? (y or n) n Create a core file? (y or n) n (gdb)
maint set internal-error
action [ask|yes|no]
maint show internal-error
actionmaint set internal-warning
action [ask|yes|no]
maint show internal-warning
actionmaint packet
textmaint print architecture
[file]maint print c-tdesc
maint print dummy-frames
(gdb) b add ... (gdb) print add(2,3) Breakpoint 2, add (a=2, b=3) at ... 58 return (a + b); The program being debugged stopped while in a function called from GDB. ... (gdb) maint print dummy-frames 0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6 top=0x0200bdd4 id={stack=0x200bddc,code=0x101405c} call_lo=0x01014000 call_hi=0x01014001 (gdb)
Takes an optional file parameter.
maint print registers
[file]maint print raw-registers
[file]maint print cooked-registers
[file]maint print register-groups
[file]maint print remote-registers
[file]The command maint print raw-registers
includes the contents of
the raw register cache; the command maint print
cooked-registers
includes the (cooked) value of all registers,
including registers which aren't available on the target nor visible
to user; the command maint print register-groups
includes the
groups that each register is a member of; and the command maint
print remote-registers
includes the remote target's register numbers
and offsets in the `G' packets. See Registers.
These commands take an optional parameter, a file name to which to write the information.
maint print reggroups
[file]The register groups info looks like this:
(gdb) maint print reggroups Group Type general user float user all user vector user system user save internal restore internal
flushregs
maint print objfiles
maint print section-scripts [
regexp]
.debug_gdb_section
section.
If regexp is specified, only print scripts loaded by object files
matching regexp.
For each script, this command prints its name as specified in the objfile,
and the full path if known.
See dotdebug_gdb_scripts section.
maint print statistics
maint print target-stack
This command prints a short description of each layer that was pushed on the target stack, starting from the top layer down to the bottom one.
maint print type
exprmaint set dwarf2 always-disassemble
maint show dwarf2 always-disassemble
info address
when using DWARF debugging
information.
The default is off
, which means that gdb should try to
describe a variable's location in an easily readable format. When
on
, gdb will instead display the DWARF location
expression in an assembly-like format. Note that some locations are
too complex for gdb to describe simply; in this case you will
always see the disassembly form.
Here is an example of the resulting disassembly:
(gdb) info addr argc Symbol "argc" is a complex DWARF expression: 1: DW_OP_fbreg 0
For more information on these expressions, see the DWARF standard.
maint set dwarf2 max-cache-age
maint show dwarf2 max-cache-age
In object files with inter-compilation-unit references, such as those produced by the GCC option `-feliminate-dwarf2-dups', the DWARF 2 reader needs to frequently refer to previously read compilation units. This setting controls how long a compilation unit will remain in the cache if it is not referenced. A higher limit means that cached compilation units will be stored in memory longer, and more total memory will be used. Setting it to zero disables caching, which will slow down gdb startup, but reduce memory consumption.
maint set profile
maint show profile
Profiling will be disabled until you use the `maint set profile' command to enable it. When you enable profiling, the system will begin collecting timing and execution count data; when you disable profiling or exit gdb, the results will be written to a log file. Remember that if you use profiling, gdb will overwrite the profiling log file (often called gmon.out). If you have a record of important profiling data in a gmon.out file, be sure to move it to a safe location.
Configuring with `--enable-profiling' arranges for gdb to be compiled with the `-pg' compiler option.
maint set show-debug-regs
maint show show-debug-regs
ON
to enable, OFF
to disable. If
enabled, the debug registers values are shown when gdb inserts or
removes a hardware breakpoint or watchpoint, and when the inferior
triggers a hardware-assisted breakpoint or watchpoint.
maint set show-all-tib
maint show show-all-tib
maint space
maint time
maint translate-address
[section] addrinfo address
command (see Symbols), except that this
command also allows to find symbols in other sections.
If section was not specified, the section in which the symbol was found is also printed. For dynamically linked executables, the name of executable or shared library containing the symbol is printed as well.
The following command is useful for non-interactive invocations of gdb, such as in the test suite.
set watchdog
nsecshow watchdog