info address command
Displays the address of a given symbol
Syntax
Parameters
- Symbol name
- Specifies the symbol (function or variable) which address should be displayed.
Remarks
The info address
Note that the program does not need to be running in order to use the info address command.
In order to do the reverse operation (get a symbol name from address), use the info symbol command.
Examples
We will demonstrate the use of the info address command using a basic C++ program consisting of a main() function and a global variable. We will show the output of the info address command and the output of an equivalent print command:
Symbol "main(int, char**)" is a function at address 0x804841d.
(gdb) info address g_GlobalVar
Symbol "g_GlobalVar" is static storage at address 0x804a020.
(gdb) print &main
$1 = (int (*)(int, char **)) 0x804841d <main(int, char**)>
(gdb) print &g_GlobalVar
$2 = (int *) 0x804a020 <g_GlobalVar>
Compatibility with VisualGDB
You can execute the info address command under VisualGDB using the GDB Session window in Visual Studio.