
D-28
Motorola DSP56000 Family Optimizing C Compiler User’s Manual
For More Information On This Product,
Go to: www.freescale.com
Motorola
Examining the Stack
exist in your program; they are to give you a way of talking about stack frames in GDB
commands.
Many GDB commands refer implicitly to one stack frame. GDB records a stack frame that
is called the
selected
stack frame; you can select any frame using one set of GDB
commands, and then other commands will operate on that frame. When your program
stops, GDB automatically selects the innermost frame.
Some functions can be compiled to run without a frame reserved for them on the stack.
This is occasionally done with heavily used library functions to save the frame setup time.
GDB has limited facilities for dealing with these function invocations; if the innermost
function invocation has no stack frame, GDB will give it a virtual stack frame of 0 and
correctly allow tracing of the function call chain. Results are undefined if a function
invocation besides the innermost one is frameless.
D.7.2 Backtraces
A backtrace is a summary of how the program got where it is. It shows one line per frame,
for many frames, starting with the currently executing frame (frame zero), followed by its
caller (frame one), and on up the stack. See Table D-6.
If the function is in a source file whose symbol table data has been fully read, the
backtrace shows the source file name and line number, as well as the arguments to the
function. (The program counter value is omitted if it is at the beginning of the code for that
line number.)
If the source file’s symbol data has not been fully read, just scanned, this extra information
is replaced with an ellipsis. You can force the symbol data for that frame’s source file to
be read by selecting the frame. (See section Selection).
Table D-9. Backtraces
Backtrace
Description
backtrace
bt
Print a backtrace of the entire stack: one line per frame for all frames in the stack.
You can stop the backtrace at any time by typing the system interrupt character, normally
Control-C.
backtrace n
bt n
Similar, but print only the innermost n frames.
backtrace -n
bt -n
Similar, but print only the outermost n frames.
The names ‘where’ and ‘info stack’ are additional aliases for ‘backtrace’.
Every line in the backtrace shows the frame number, the function name and the program counter
value.
F
Freescale Semiconductor, Inc.
n
.