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

info variables command

Dislays the list of global/static variables present in the debugged program


info variables
info variables [Regex]


If specified, the info variables command will list the global/static variables matching the regex. If omitted, the command wil list all global/static variables in all loaded modules (main program and shared libraries).


Below is a sample use of the info variables for a very basic program containing one global variable. Note that many variables (listed under "Non-debugging symbols" are implicitly defined by the compiler):

(gdb) info variables
All defined variables:

File test.cpp:
int g_GlobalVariable;

Non-debugging symbols:
0x08048528 _fp_hw
0x0804852c _IO_stdin_used
0x08048650 __FRAME_END__
0x08049f14 __CTOR_LIST__
0x08049f14 __init_array_end
0x08049f14 __init_array_start
0x08049f18 __CTOR_END__
0x08049f1c __DTOR_LIST__
0x08049f20 __DTOR_END__
0x08049f24 __JCR_END__
0x08049f24 __JCR_LIST__
0x08049f28 _DYNAMIC
0x0804a00c __data_start
0x0804a00c data_start
0x0804a010 __dso_handle
0x0804a014 completed.6159
0x0804a018 dtor_idx.6161
(gdb) info variables start
All variables matching regular expression "start":

Non-debugging symbols:
0x08049f14 __init_array_start
0x0804a00c __data_start
0x0804a00c data_start

Compatibility with VisualGDB

You can execute the info variables command under VisualGDB using the GDB Session window in Visual Studio.

See also