Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
set print address off Do not print addresses when displaying their contents. For
example, this is the same stack frame displayed with set print
address off:
((gdb)) set print addr off
((gdb)) f
#0 set_quotes (lq="<<", rq=">>") at input.c:530
530 if (lquote != def_lquote)
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 backtraces 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 previous 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 it. 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 the 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
disassembling 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 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.
Other settings to control how different kinds of objects are printed:
set print array, set print
array on
Pretty print arrays. This format is more convenient to read,
but uses more space. The default is off.
64 Examining Data