Next: Frame Info, Previous: Backtrace, Up: Stack
Most commands for examining the stack and other data in your program work on whichever stack frame is selected at the moment. Here are the commands for selecting a stack frame; all of them finish by printing a brief description of the stack frame just selected.
frame
nf
nmain
.
frame
addrf
addrOn the SPARC architecture, frame
needs two addresses to
select an arbitrary frame: a frame pointer and a stack pointer.
On the MIPS and Alpha architecture, it needs two addresses: a stack pointer and a program counter.
On the 29k architecture, it needs three addresses: a register stack pointer, a program counter, and a memory stack pointer.
up
ndown
ndown
as do
.
All of these commands end by printing two lines of output describing the frame. The first line shows the frame number, the function name, the arguments, and the source file and line number of execution in that frame. The second line shows the text of that source line.
For example:
(gdb) up #1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) at env.c:10 10 read_input_file (argv[i]);
After such a printout, the list
command with no arguments
prints ten lines centered on the point of execution in the frame.
You can also edit the program at the point of execution with your favorite
editing program by typing edit
.
See Printing Source Lines,
for details.
up-silently
ndown-silently
nup
and down
,
respectively; they differ in that they do their work silently, without
causing display of the new frame. They are intended primarily for use
in gdb command scripts, where the output might be unnecessary and
distracting.