Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)

display/fmt addr For fmt 'i' or 's', or including a unit-size or a number of units, add the
expression addr as a memory address to be examined each time your
program stops. Examining means in effect doing 'x/fmt addr'. See
“Examining memory” (page 61).
For example, `display/i $pc' can be helpful, to view the machine instruction about to be
executed each time execution stops (`$pc' is a common name for the program counter; see
“Registers” (page 69)).
undisplay dnums..., delete
display dnums...
Remove item numbers dnums from the list of expressions to
display. undisplay does not repeat if you press RET after
using it. (Otherwise you would just get the error 'No display
number ...'.)
disable display dnums... Disable the display of item numbers dnums. A disabled
display item is not printed automatically, but is not forgotten.
It may be enabled again later.
enable display dnums... Enable display of item numbers dnums. It becomes effective
once again in auto display of its expression, until you specify
otherwise.
display Display the current values of the expressions on the list, just
as is done when your program stops.
info display Print the list of expressions previously set up to display
automatically, each one with its item number, but without
showing the values. This includes disabled expressions,
which are marked as such. It also includes expressions which
would not be displayed right now because they refer to
automatic variables not currently available.
If a display expression refers to local variables, then it does not make sense outside the lexical
context for which it was set up. Such an expression is disabled when execution enters a context
where one of its variables is not defined. For example, if you give the command display
last_char while inside a function with an argument last_char, GDB displays this argument
while your program continues to stop inside that function. When it stops elsewhere, where there
is no variable last_char, the display is disabled automatically. The next time your program
stops where last_char is meaningful, you can enable the display expression again.
Print settings
GDB provides the following ways to control how arrays, structures, and symbols are printed.
These settings are useful for debugging programs in any language:
set print subcommand This command is a generic command to set or change the print
settings. It must always combine with a subcommand as shown
in the following commands.
show print Displays the print settings of all the print subcommands.
set print address, set
print address on
GDB prints memory addresses showing the location of stack
traces, structure values, pointer values, breakpoints, and so forth,
even when it also displays the contents of those addresses. The
default is on. For example, this is what a stack frame display
looks like with set print address on:
((gdb)) f
#0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>")
at input.c:530
530 if (lquote != def_lquote)
Print settings 63