gdb.info: Auto Display
Go forward to Print Settings
Go backward to Memory
Go up to Data
Go to the top op gdb
If you find that you want to print the value of an expression frequently
(to see how it changes), you might want to add it to the "automatic
display list" so that GDB prints its value each time your program stops.
Each expression added to the list is given a number to identify it; to
remove an expression from the list, you specify that number. The
automatic display looks like this:
2: foo = 38
3: bar = (struct hack *) 0x3804
This display shows item numbers, expressions and their current values.
As with displays you request manually using `x' or `print', you can
specify the output format you prefer; in fact, `display' decides
whether to use `print' or `x' depending on how elaborate your format
specification is--it uses `x' if you specify a unit size, or one of the
two formats (`i' and `s') that are only supported by `x'; otherwise it
Add the expression EXPR to the list of expressions to display each
time your program stops. *Note Expressions: Expressions.
`display' does not repeat if you press <RET> again after using it.
For FMT specifying only a display format and not a size or count,
add the expression EXPR to the auto-display list but arrange to
display it each time in the specified format FMT. *Note Output
formats: Output Formats.
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'. *Note Examining memory: Memory.
For example, `display/i $pc' can be helpful, to see the machine
instruction about to be executed each time execution stops (`$pc' is a
common name for the program counter; *note Registers: Registers.).
`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
Display the current values of the expressions on the list, just as
is done when your program stops.
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
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 once again.
Created Mon Nov 8 17:42:36 2004 on tillpc with info_to_html version 0.9.6.