Supported on windows
Supported on linux
Supported on android
set print frame-arguments command
Specifies the types of arguments fo which the backtrace command will display values.
Syntax
set print frame-arguments all
set print frame-arguments scalar
set print frame-arguments none
show print frame-arguments
set print frame-arguments scalar
set print frame-arguments none
show print frame-arguments
Modes
- all
- In this mode the backtrace command will show argument values for all argument types including structures.
- scalar
- In this mode the backtrace command will only show argument values for scalar arguments (including pointers and C strings).
- none
- In this mode the backtrace command will not show values for any of the arguments.
Default mode
The default value for the print frame-arguments setting is scalar.
Examples
To illustrate the set print frame-arguments command we will use a basic C++ program that has a function accepting 2 scalar arguments and one structure argument:
struct CompositeStruct
{
int Field1, Field2;
};
void testfunc(int arg1, const char *arg2, CompositeStruct arg3)
{
asm("int3"); //Forced breakpoint
}
int main(int argc, char **argv)
{
CompositeStruct test = {1, 2};
testfunc(123, "test", test);
return 0;
}
{
int Field1, Field2;
};
void testfunc(int arg1, const char *arg2, CompositeStruct arg3)
{
asm("int3"); //Forced breakpoint
}
int main(int argc, char **argv)
{
CompositeStruct test = {1, 2};
testfunc(123, "test", test);
return 0;
}
We will run the program until it hits a breakpoint in testfunc() and then use the backtrace command to display the frames and the argument values for each frame:
(gdb) run
Starting program: /home/bazis/test
Program received signal SIGTRAP, Trace/breakpoint trap.
testfunc (arg1=123, arg2=0x80484d0 "test", arg3=...) at test.cpp:11
11 }
(gdb) backtrace
#0 testfunc (arg1=123, arg2=0x80484d0 "test", arg3=...) at test.cpp:11
#1 0x0804842d in main (argc=1, argv=0xbffff034) at test.cpp:16
(gdb) show print frame-arguments
Printing of non-scalar frame arguments is "scalars".
(gdb) set print frame-arguments all
(gdb) backtrace
#0 testfunc (arg1=123, arg2=0x80484d0 "test", arg3={Field1 = 1, Field2 = 2}) at test.cpp:11
#1 0x0804842d in main (argc=1, argv=0xbffff034) at test.cpp:16
(gdb) set print frame-arguments none
(gdb) backtrace
#0 testfunc (arg1=..., arg2=..., arg3=...) at test.cpp:11
#1 0x0804842d in main (argc=..., argv=...) at test.cpp:16
Starting program: /home/bazis/test
Program received signal SIGTRAP, Trace/breakpoint trap.
testfunc (arg1=123, arg2=0x80484d0 "test", arg3=...) at test.cpp:11
11 }
(gdb) backtrace
#0 testfunc (arg1=123, arg2=0x80484d0 "test", arg3=...) at test.cpp:11
#1 0x0804842d in main (argc=1, argv=0xbffff034) at test.cpp:16
(gdb) show print frame-arguments
Printing of non-scalar frame arguments is "scalars".
(gdb) set print frame-arguments all
(gdb) backtrace
#0 testfunc (arg1=123, arg2=0x80484d0 "test", arg3={Field1 = 1, Field2 = 2}) at test.cpp:11
#1 0x0804842d in main (argc=1, argv=0xbffff034) at test.cpp:16
(gdb) set print frame-arguments none
(gdb) backtrace
#0 testfunc (arg1=..., arg2=..., arg3=...) at test.cpp:11
#1 0x0804842d in main (argc=..., argv=...) at test.cpp:16
Compatibility with VisualGDB
Do not use the set print frame-arguments command with VisualGDB. Instead right-click on the Call Stack pane in Visual Studio and select the information displayed about each frame via a context menu.