Supported on windows
Supported on linux
Supported on embedded
Supported on android

set print address command

Specifies whether GDB will print addresses when evaluating pointers.


set print address on
set print address off
show print address


When printing a value of a pointer, GDB will print the raw address along with any other information (e.g. $1 = 0xbffff232 "Hello, World").
When printing a value of a pointer, GDB will hide the raw address from the output (e.g. $1 = "Hello, World").

Default mode

The default value for the print address setting is 'on'.


Note that if address printing is disabled, pointer values will not be displayed even if the pointer value was the only meaningful part of the output. Hence evaluating many pointer types (e.g. int *) will produce meaningless results (e.g. $1 = (int *) ).


Below is a log of sample GDB session illustrating how set print address command affects the output of the print command:

(gdb) start
Temporary breakpoint 1 at 0x80483f0: file test.cpp, line 5.
Starting program: /home/bazis/test

Temporary breakpoint 1, main (argc=1, argv=0xbffff064) at test.cpp:5
5 return 0;
(gdb) print argc
$1 = 1
(gdb) print argv
$2 = (char **) 0xbffff064
(gdb) print argv[0]
$3 = 0xbffff232 "/home/bazis/test"
(gdb) print &argc
$4 = (int *) 0xbfffefd0
(gdb) show print address
Printing of addresses is on.
(gdb) set print address off
(gdb) print argc
$5 = 1
(gdb) print argv
$6 = (char **)
(gdb) print argv[0]
$7 = "/home/bazis/test"
(gdb) print &argc
$8 = (int *)

Compatibility with VisualGDB

Do not use the set print address command with VisualGDB. VisualGDB relies on pointer addresses printed by GDB and disabling this feature can stop VisualGDB from functioning correctly.

See also