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
[-at
location,] expressionmaint agent-eval
[-at
location,] 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.
If -at
is given, generate remote agent bytecode for location.
If not, generate remote agent bytecode for current frame PC address.
maint agent-printf
format,
expr,...
maint info breakpoints
breakpoint
watchpoint
longjmp
longjmp
calls.
longjmp resume
longjmp
.
until
until
command.
finish
finish
command.
shlib events
maint info btrace
maint btrace packet-history
bts
pt
maint btrace clear-packet-history
maint btrace clear
This implicitly truncates the branch trace to a single branch trace buffer. When updating branch trace incrementally, the branch trace available to gdb may be bigger than a single branch trace buffer.
maint set btrace pt skip-pad
maint show btrace pt skip-pad
maint info jit
set displaced-stepping
show displaced-stepping
set displaced-stepping on
set displaced-stepping off
set displaced-stepping auto
maint check-psymtabs
maint check-symtabs
maint expand-symtabs [
regexp]
maint set catch-demangler-crashes [on|off]
maint show catch-demangler-crashes
maint cplus first_component
namemaint cplus namespace
maint deprecate
command [replacement]maint undeprecate
commandmaint dump-me
SIGQUIT
signal.
maint internal-error
[message-text]maint internal-warning
[message-text]maint demangler-warning
[message-text]internal_error
,
internal_warning
or demangler_warning
and hence behave
as though an internal problem has been detected. In addition to
reporting the internal problem, these functions give the user the
opportunity to either quit gdb or (for internal_error
and internal_warning
) 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 set demangler-warning
action [ask|yes|no]
maint show demangler-warning
actioncorefile
option for demangler-warning
:
demangler warnings always create a core file and this cannot be
disabled.
maint set internal-error backtrace
[on|off
]maint show internal-error backtrace
maint set internal-warning backtrace
[on|off
]maint show internal-warning backtrace
internal-error
and `off' by default for internal-warning
.
maint packet
textAny non-printable characters in the reply are printed as escaped hex, e.g. `\x00', `\x01', etc.
maint print architecture
[file]maint print c-tdesc
[-single-feature
] [file]When the optional flag `-single-feature' is provided then the target description being processed (either the default, or from file) must only contain a single feature. The source file produced is different in this case.
maint print xml-tdesc
[file]maint check xml-descriptions
dirmaint check libthread-db
libthread_db
functionality used by
gdb on GNU/Linux systems, and by extension also exercises the
proc_service
functions provided by gdb that
libthread_db
uses. Note that parts of the test may be skipped
on some platforms when debugging core files.
maint print core-file-backed-mappings
info proc mappings
command.
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 0xa8206d8: id={stack=0xbfffe734,code=0xbfffe73f,!special}, ptid=process 9353 (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.
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
maint flush register-cache
flushregs
flushregs
is deprecated in favor of maint flush register-cache
.
maint flush source-cache
This command is useful when debugging issues related to source code styling. After flushing the cache any source code displayed by gdb will be re-read and re-styled.
maint print objfiles
[regexp]maint print user-registers
$fp
, $pc
,
$sp
, and $ps
. See standard registers. User
registers can be used in expressions in the same way as the canonical
register names, but only the latter are listed by the info
registers
and maint print registers
commands.
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 selftest
[-verbose
] [filter]-verbose
is passed, the self tests can be
more verbose.
maint set selftest verbose
maint show selftest verbose
maint info selftests
maint set dwarf always-disassemble
maint show dwarf 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 dwarf max-cache-age
maint show dwarf max-cache-age
In object files with inter-compilation-unit references, such as those produced by the GCC option `-feliminate-dwarf2-dups', the DWARF 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 dwarf unwinders
maint show dwarf unwinders
Many targets that support DWARF debugging use gdb's DWARF frame unwinders to build the backtrace. Many of these targets will also have a second mechanism for building the backtrace for use in cases where DWARF information is not available, this second mechanism is often an analysis of a function's prologue.
In order to extend testing coverage of the second level stack unwinding mechanisms it is helpful to be able to disable the DWARF stack unwinders, this can be done with this switch.
In normal use of gdb disabling the DWARF unwinders is not advisable, there are cases that are better handled through DWARF than prologue analysis, and the debug experience is likely to be better with the DWARF frame unwinders enabled.
If DWARF frame unwinders are not supported for a particular target architecture, then enabling this flag does not cause them to be used.
maint set worker-threads
maint show worker-threads
unlimited
, which lets gdb choose a reasonable
number. Note that this only controls worker threads started by
gdb itself; libraries used by gdb may start threads
of their own.
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 set target-async
maint show target-async
maint set target-non-stop
maint show target-non-stop
set non-stop
is off
(see Non-Stop Mode). The default is auto
, meaning non-stop mode is enabled
if supported by the target.
maint set target-non-stop auto
maint set target-non-stop on
maint set target-non-stop off
maint set tui-resize-message
maint show tui-resize-message
off
, which means
that gdb is silent during resizes. When on
,
gdb will display a message after a resize is completed; the
message will include a number indicating how many times the terminal
has been resized. This setting is intended for use by the test suite,
where it would otherwise be difficult to determine when a resize and
refresh has been completed.
maint set per-command
maint show per-command
maint set per-command space [on|off]
maint show per-command space
maint set per-command time [on|off]
maint show per-command time
maint set per-command symtab [on|off]
maint show per-command symtab
maint set check-libthread-db [on|off]
maint show check-libthread-db
maint set gnu-source-highlight enabled
[on|off
]maint show gnu-source-highlight enabled
If the GNU Source Highlight library is not being used, then gdb will use the Python Pygments package for source code styling, if it is available.
This option is useful for debugging gdb's use of the Pygments library when gdb is linked against the GNU Source Highlight library.
maint space
valuemaint set per-command space
.
A non-zero value enables it, zero disables it.
maint time
valuemaint set per-command time
.
A non-zero value enables it, zero disables it.
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.
maint test-options require-delimiter
maint test-options unknown-is-error
maint test-options unknown-is-operand
require-delimiter
variant requires a
double-dash delimiter to indicate end of options. The
unknown-is-error
and unknown-is-operand
do not. The
unknown-is-error
variant throws an error on unknown option,
while unknown-is-operand
treats unknown options as the start of
the command's operands. When run, the commands output the result of
the processed options. When completed, the commands store the
internal result of completion in a variable exposed by the maint
show test-options-completion-result
command.
maint show test-options-completion-result
maint test-options
subcommands. This is used by the testsuite to validate completion
support in the command options framework.
maint set test-settings
kindmaint show test-settings
kindmaint set backtrace-on-fatal-signal [on|off]
maint show backtrace-on-fatal-signal
on
, if gdb itself terminates with
a fatal signal (e.g. SIGSEGV), then a limited backtrace will be
printed to the standard error stream. This backtrace can be used to
help diagnose crashes within gdb in situations where a user
is unable to share a corefile with the gdb developers.
If the functionality to provide this backtrace is not available for
the platform on which GDB is running then this feature will be
off
by default, and attempting to turn this feature on will
give an error.
For platforms that do support creating the backtrace this feature is
on
by default.
maint with
setting [
value] [--
command]
with
command, but works with maintenance set
variables. This is used by the testsuite to exercise the with
command's infrastructure.
The following command is useful for non-interactive invocations of gdb, such as in the test suite.
set watchdog
nsecshow watchdog