Reputation: 3053
I am using gdb and I was wanting to print a variable not currently in the scope. I am not sure what the exact name of the variable is so I would like to be able to change scopes rather than printing a specific variable in a specific file.
Upvotes: 9
Views: 3116
Reputation: 55392
You can use the frame
, up
and down
commands to access scopes on the stack.
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).
Upvotes: 14