70
Chapter 10. Examining Data
n
, the repeat count
The repeat count is a decimal integer; the default is 1. It specifies how much memory (counting
by units
u
) to display.
f
, the display format
The display format is one of the formats used by
,
s
(null-terminated string), or
i
(machine
instruction). The default is
x
(hexadecimal) initially. The default changes each time you use either
x
or
.
u
, the unit size
The unit size is any of
b
Bytes.
h
Halfwords (two bytes).
w
Words (four bytes). This is the initial default.
g
Giant words (eight bytes).
Each time you specify a unit size with
x
, that size becomes the default unit the next time you use
x
. (For the
s
and
i
formats, the unit size is ignored and is normally not written.)
addr
, starting display address
addr
is the address where you want gdb to begin displaying memory. The expression need not
have a pointer value (though it may); it is always interpreted as an integer address of a byte of
memory. Refer to Section 10.1
Expressions
, for more information on expressions. The default
for
addr
is usually just after the last address examined--but several other commands also set the
default address:
info breakpoints
(to the address of the last breakpoint listed),
info line
(to the starting address of a line), and
(if you use it to display a value from memory).
For example,
x/3uh 0x54320
is a request to display three halfwords (
h
) of memory, formatted as
unsigned decimal integers (
u
), starting at address
0x54320
.
x/4xw $sp
prints the four words (
w
) of
memory above the stack pointer (here,
$sp
; (refer to Section 10.10
Registers
) in hexadecimal (
x
).
Since the letters indicating unit sizes are all distinct from the letters specifying output formats, you
do not have to remember whether unit size or format comes first; either order works. The output
specifications
4xw
and
4wx
mean exactly the same thing. (However, the count
n
must come first;
wx4
does not work.)
Even though the unit size
u
is ignored for the formats
s
and
i
, you might still want to use a count
n
;
for example,
3i
specifies that you want to see three machine instructions, including any operands. The
command
disassemble
gives an alternative way of inspecting machine instructions; refer to Section
9.5
Source and machine code
.
All the defaults for the arguments to
x
are designed to make it easy to continue scanning memory with
minimal specifications each time you use
x
. For example, after you have inspected three machine
instructions with
x/3i
addr
, you can inspect the next seven with just
x/7
. If you use [RET] to repeat
the
x
command, the repeat count
n
is used again; the other arguments default as for successive uses
of
x
.
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......