Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Returning.html
blobdfa711174a72883fb99c0b7618a108899751e1f5
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="Returning">Returning</a>,
13 Next:<a rel="next" accesskey="n" href="Calling.html#Calling">Calling</a>,
14 Previous:<a rel="previous" accesskey="p" href="Signaling.html#Signaling">Signaling</a>,
15 Up:<a rel="up" accesskey="u" href="Altering.html#Altering">Altering</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Returning from a function</h3>
21 <dl>
22 <dt><code>return</code>
23 <dd><dt><code>return </code><var>expression</var><code></code>
24 <dd>You can cancel execution of a function call with the <code>return</code>
25 command. If you give an
26 <var>expression</var> argument, its value is used as the function's return
27 value.
28 </dl>
30 <p>When you use <code>return</code>, GDB discards the selected stack frame
31 (and all frames within it). You can think of this as making the
32 discarded frame return prematurely. If you wish to specify a value to
33 be returned, give that value as the argument to <code>return</code>.
35 <p>This pops the selected stack frame (see <a href="Selection.html#Selection">Selecting a frame</a>), and any other frames inside of it, leaving its caller as the
36 innermost remaining frame. That frame becomes selected. The
37 specified value is stored in the registers used for returning values
38 of functions.
40 <p>The <code>return</code> command does not resume execution; it leaves the
41 program stopped in the state that would exist if the function had just
42 returned. In contrast, the <code>finish</code> command (see <a href="Continuing-and-Stepping.html#Continuing%20and%20Stepping">Continuing and stepping</a>) resumes execution until the
43 selected stack frame returns naturally.
45 </body></html>