Chapter 8. Examining the Stack
55
the backtrace, to avoid tracing into highly system-specific (and generally uninteresting) code. If you
need to examine the startup code, then you can change this behavior.
set backtrace-below-main off
Backtraces will stop when they encounter the user entry point. This is the default.
set backtrace-below-main
set backtrace-below-main on
Backtraces will continue past the user entry point to the top of the stack.
show backtrace-below-main
Display the current backtrace policy.
8.3. Selecting a frame
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
n
f
n
Select frame number
n
. Recall that frame zero is the innermost (currently executing) frame, frame
one is the frame that called the innermost one, and so on. The highest-numbered frame is the one
for
main
.
frame
addr
f
addr
Select the frame at address
addr
. This is useful mainly if the chaining of stack frames has been
damaged by a bug, making it impossible for gdb to assign numbers properly to all frames. In
addition, this can be useful when your program has multiple stacks and switches between them.
On 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
n
Move
n
frames up the stack. For positive numbers
n
, this advances toward the outermost frame,
to higher frame numbers, to frames that have existed longer.
n
defaults to one.
down
n
Move
n
frames down the stack. For positive numbers
n
, this advances toward the innermost
frame, to lower frame numbers, to frames that were created more recently.
n
defaults to one. You
may abbreviate
down
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.
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......