我正在使用gdb,我想要打印当前不在范围内的变量.我不确定变量的确切名称是什么,所以我希望能够更改范围而不是在特定文件中打印特定变量.
您可以使用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).
Run Code Online (Sandbox Code Playgroud)