Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
frame={level="3 ",addr="0x000107b4",func="callee1",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"},
frame={level="4 ",addr="0x000107e0",func="main",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"}]
(gdb)
-stack-list-arguments 0
^done,
stack-args=[
frame={level="0",args=[]},
frame={level="1",args=[name="strarg"]},
frame={level="2",args=[name="intarg",name="strarg"]},
frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
frame={level="4",args=[]}]
(gdb)
-stack-list-arguments 1
^done,
stack-args=[
frame={level="0",args=[]},
frame={level="1",
args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
frame={level="2",args=[
{name="intarg",value="2"},
{name="strarg",value="0x11940 \"A string argument.\""}]},
{frame={level="3",args=[
{name="intarg",value="2"},
{name="strarg",value="0x11940 \"A string argument.\""},
{name="fltarg",value="3.5"}]},
frame={level="4",args=[]}]
(gdb)
-stack-list-arguments 0 2 2
^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
(gdb)
-stack-list-arguments 1 2 2
^done,stack-args=[frame={level="2",
args=[{name="intarg",value="2"},
{name="strarg",value="0x11940 \"A string argument.\""}]}]
(gdb)
The -stack-list-frames command
Synopsis
-stack-list-frames [ low-frame high-frame ]
List the frames currently on the stack. For each frame it displays the following info:
'level' The frame number, 0 being the topmost frame, that is the innermost function.
'addr' The $pc value for that frame.
'func' Function name.
'file' File name of the source file where the function lives.
'line' Line number corresponding to the $pc.
If invoked without arguments, this command prints a backtrace for the whole stack. If given two
integer arguments, it shows the frames whose levels are between the two arguments (inclusive). If
the two arguments are equal, it shows the single frame at the corresponding level.
GDB command
The corresponding GDB commands are 'backtrace' and 'where'.
Example
Full stack backtrace:
262 The GDB/MI Interface