Chapter 10. Examining Data
79
show convenience
Print a list of convenience variables used so far, and their values. Abbreviated
show conv
.
One of the ways to use a convenience variable is as a counter to be incremented or a pointer to be
advanced. For example, to print a field from successive elements of an array of structures:
set $i = 0
print bar[$i++]-
contents
Repeat that command by typing [RET].
Some convenience variables are created automatically by gdb and given values likely to be useful.
$_
The variable
$_
is automatically set by the
x
command to the last address examined (refer to
Section 10.5
Examining memory
). Other commands which provide a default address for
x
to ex-
amine also set
$_
to that address; these commands include
info line
and
info breakpoint
.
The type of
$_
is
void *
except when set by the
x
command, in which case it is a pointer to the
type of
$__
.
$__
The variable
$__
is automatically set by the
x
command to the value found in the last address
examined. Its type is chosen to match the format in which the data was printed.
$_exitcode
The variable
$_exitcode
is automatically set to the exit code when the program being debugged
terminates.
On HP-UX systems, if you refer to a function or variable name that begins with a dollar sign, gdb
searches for a user or system name first, before it searches for a convenience variable.
10.10. Registers
You can refer to machine register contents, in expressions, as variables with names starting with
$
.
The names of registers are different for each machine; use
info registers
to see the names used
on your machine.
info registers
Print the names and values of all registers except floating-point and vector registers (in the se-
lected stack frame).
info all-registers
Print the names and values of all registers, including floating-point and vector registers (in the
selected stack frame).
info registers
regname
...
Print the
relativized
value of each specified register
regname
. As discussed in detail below,
register values are normally relative to the selected stack frame.
regname
may be any register
name valid on the machine you are using, with or without the initial
$
.
Summary of Contents for ENTERPRISE LINUX 3 - SECURITY GUIDE
Page 1: ...Red Hat Enterprise Linux 3 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: ......