next up previous


Pile d'exécution

The call stack is divided up into contiguous pieces called "frames";
each frame is the data associated with one call to one function.  The frame
contains the arguments given to the function, the function's local
variables, and the address at which the function is executing.

When your program is started, the stack has only one frame, that of the
function `main'.  This is called the "initial" frame or the
"outermost" frame.  Each time a function is called, a new frame is
made.  Each time a function returns, the frame for that function invocation
is eliminated.  If a function is recursive, there can be many frames for
the same function.  The frame for the function in which execution is
actually occurring is called the "innermost" frame.  This is the most
recently created of all the stack frames that still exist.

Inside your program, stack frames are identified by their addresses.  A
stack frame consists of many bytes, each of which has its own address; each
kind of computer has a convention for choosing one of those bytes whose
address serves as the address of the frame.  Usually this address is kept
in a register called the "frame pointer register" while execution is
going on in that frame.

GDB assigns numbers to all existing stack frames, starting with zero for
the innermost frame, one for the frame that called it, and so on upward.
These numbers do not really 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.
The call stack is divided up into contiguous pieces called "frames";
each frame is the data associated with one call to one function.  The frame
contains the arguments given to the function, the function's local
variables, and the address at which the function is executing.

When your program is started, the stack has only one frame, that of the
function `main'.  This is called the "initial" frame or the
"outermost" frame.  Each time a function is called, a new frame is
made.  Each time a function returns, the frame for that function invocation
is eliminated.  If a function is recursive, there can be many frames for
the same function.  The frame for the function in which execution is
actually occurring is called the "innermost" frame.  This is the most
recently created of all the stack frames that still exist.

Inside your program, stack frames are identified by their addresses.  A
stack frame consists of many bytes, each of which has its own address; each
kind of computer has a convention for choosing one of those bytes whose
address serves as the address of the frame.  Usually this address is kept
in a register called the "frame pointer register" while execution is
going on in that frame.

GDB assigns numbers to all existing stack frames, starting with zero for
the innermost frame, one for the frame that called it, and so on upward.
These numbers do not really 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.