【发布时间】:2012-01-05 03:51:06
【问题描述】:
我正在使用 gdb,我想打印一个当前不在范围内的变量。我不确定变量的确切名称是什么,所以我希望能够更改范围而不是在特定文件中打印特定变量。
【问题讨论】:
标签: scope gdb local-variables callstack
我正在使用 gdb,我想打印一个当前不在范围内的变量。我不确定变量的确切名称是什么,所以我希望能够更改范围而不是在特定文件中打印特定变量。
【问题讨论】:
标签: scope gdb local-variables callstack
您可以使用frame、up 和down 命令访问堆栈上的范围。
frame N
f N
Select frame number N. (The current instruction is in frame 0.)
up [N]
Move N frames up the stack (away from frame 0).
down [N]
Move N frames down the stack (towards frame 0).
【讨论】: