78
Chapter 10. Examining Data
Note that the history records values, not expressions. If the value of
x
is 4 and you type these com-
mands:
print x
set x=5
then the value recorded in the value history by the
command remains 4 even though the value
of
x
has changed.
show values
Print the last ten values in the value history, with their item numbers. This is like
p $$9
repeated
ten times, except that
show values
does not change the history.
show values
n
Print ten history values centered on history item number
n
.
show
Print ten history values just after the values last printed. If no more values are available,
show
produces no display.
Pressing [RET] to repeat
show values
n
has exactly the same effect as
show
.
10.9. Convenience variables
gdb provides
convenience variables
that you can use within gdb to hold on to a value and refer to
it later. These variables exist entirely within gdb; they are not part of your program, and setting a
convenience variable has no direct effect on further execution of your program. That is why you can
use them freely.
Convenience variables are prefixed with
$
. Any name preceded by
$
can be used for a convenience
variable, unless it is one of the predefined machine-specific register names (refer to Section 10.10
Registers
). (Value history references, in contrast, are
numbers
preceded by
$
. Refer to Section 10.8
Value history
.)
You can save a value in a convenience variable with an assignment expression, just as you would set
a variable in your program. For example:
set $foo = *object_ptr
would save in
$foo
the value contained in the object pointed to by
object_ptr
.
Using a convenience variable for the first time creates it, but its value is
void
until you assign a new
value. You can alter the value with another assignment at any time.
Convenience variables have no fixed types. You can assign a convenience variable any type of value,
including structures and arrays, even if that variable already has a value of a different type. The
convenience variable, when used as an expression, has the type of its current value.
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......