Chapter 10. Examining Data
73
You can use
set print address off
to eliminate all machine dependent displays from the
gdb interface. For example, with
print address off
, you should get the same text for back-
traces on all machines--whether or not they involve pointer arguments.
show print address
Show whether or not addresses are to be printed.
When gdb prints a symbolic address, it normally prints the closest earlier symbol plus an offset. If
that symbol does not uniquely identify the address (for example, it is a name whose scope is a single
source file), you may need to clarify. One way to do this is with
info line
, for example
info
line *0x4537
. Alternately, you can set gdb to print the source file and line number when it prints a
symbolic address:
set print symbol-filename on
Tell gdb to print the source file name and line number of a symbol in the symbolic form of an
address.
set print symbol-filename off
Do not print source file name and line number of a symbol. This is the default.
show print symbol-filename
Show whether or not gdb will print the source file name and line number of a symbol in the
symbolic form of an address.
Another situation where it is helpful to show symbol filenames and line numbers is when disassem-
bling code; gdb shows you the line number and source file that corresponds to each instruction.
Also, you may wish to see the symbolic form only if the address being printed is reasonably close to
the closest earlier symbol:
set print max-symbolic-offset
max-offset
Tell gdb to only display the symbolic form of an address if the offset between the closest earlier
symbol and the address is less than
max-offset
. The default is 0, which tells gdb to always
print the symbolic form of an address if any symbol precedes it.
show print max-symbolic-offset
Ask how large the maximum offset is that gdb prints in a symbolic address.
If you have a pointer and you are not sure where it points, try
set print symbol-filename on
.
Then you can determine the name and source file location of the variable where it points, using
p/a
pointer
. This interprets the address in symbolic form. For example, here gdb shows that a variable
ptt
points at another variable
t
, defined in
hi2.c
:
(gdb) set print symbol-filename on
(gdb) p/a ptt
$4 = 0xe008
t in hi2.c
Warning:
For pointers that point to a local variable,
p/a
does not show the symbol name and filename of
the referent, even with the appropriate
set print
options turned on.
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: ......