Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Frames.html
blob4dd637239c70bbb3589f03f93d1ef64d891f6921
1 <html lang="en">
2 <head>
3 <title>Debugging with GDB</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="Debugging with GDB">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Frames">Frames</a>,
13 Next:<a rel="next" accesskey="n" href="Backtrace.html#Backtrace">Backtrace</a>,
14 Up:<a rel="up" accesskey="u" href="Stack.html#Stack">Stack</a>
15 <hr><br>
16 </div>
18 <h3 class="section">Stack frames</h3>
20 <p>The call stack is divided up into contiguous pieces called <dfn>stack
21 frames</dfn>, or <dfn>frames</dfn> for short; each frame is the data associated
22 with one call to one function. The frame contains the arguments given
23 to the function, the function's local variables, and the address at
24 which the function is executing.
26 <p>When your program is started, the stack has only one frame, that of the
27 function <code>main</code>. This is called the <dfn>initial</dfn> frame or the
28 <dfn>outermost</dfn> frame. Each time a function is called, a new frame is
29 made. Each time a function returns, the frame for that function invocation
30 is eliminated. If a function is recursive, there can be many frames for
31 the same function. The frame for the function in which execution is
32 actually occurring is called the <dfn>innermost</dfn> frame. This is the most
33 recently created of all the stack frames that still exist.
35 <p>Inside your program, stack frames are identified by their addresses. A
36 stack frame consists of many bytes, each of which has its own address; each
37 kind of computer has a convention for choosing one byte whose
38 address serves as the address of the frame. Usually this address is kept
39 in a register called the <dfn>frame pointer register</dfn> while execution is
40 going on in that frame.
42 GDB assigns numbers to all existing stack frames, starting with
43 zero for the innermost frame, one for the frame that called it,
44 and so on upward. These numbers do not really exist in your program;
45 they are assigned by GDB to give you a way of designating stack
46 frames in GDB commands.
48 <p>Some compilers provide a way to compile functions so that they operate
49 without stack frames. (For example, the gcc option
50 <pre class="example"> <code>-fomit-frame-pointer</code>
51 </pre>
52 generates functions without a frame.)
53 This is occasionally done with heavily used library functions to save
54 the frame setup time. GDB has limited facilities for dealing
55 with these function invocations. If the innermost function invocation
56 has no stack frame, GDB nevertheless regards it as though
57 it had a separate frame, which is numbered zero as usual, allowing
58 correct tracing of the function call chain. However, GDB has
59 no provision for frameless functions elsewhere in the stack.
61 <dl>
62 <dt><code>frame </code><var>args</var><code></code>
63 <dd>The <code>frame</code> command allows you to move from one stack frame to another,
64 and to print the stack frame you select. <var>args</var> may be either the
65 address of the frame or the stack frame number. Without an argument,
66 <code>frame</code> prints the current stack frame.
68 <br><dt><code>select-frame</code>
69 <dd>The <code>select-frame</code> command allows you to move from one stack frame
70 to another without printing the frame. This is the silent version of
71 <code>frame</code>.
72 </dl>
74 </body></html>