• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gcc/
1<html lang="en">
2<head>
3<title>Return Address - Using the GNU Compiler Collection (GCC)</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Using the GNU Compiler Collection (GCC)">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="C-Extensions.html#C-Extensions" title="C Extensions">
9<link rel="prev" href="Function-Names.html#Function-Names" title="Function Names">
10<link rel="next" href="Vector-Extensions.html#Vector-Extensions" title="Vector Extensions">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Funding Free Software'', the Front-Cover
19Texts being (a) (see below), and with the Back-Cover Texts being (b)
20(see below).  A copy of the license is included in the section entitled
21``GNU Free Documentation License''.
22
23(a) The FSF's Front-Cover Text is:
24
25     A GNU Manual
26
27(b) The FSF's Back-Cover Text is:
28
29     You have freedom to copy and modify this GNU Manual, like GNU
30     software.  Copies published by the Free Software Foundation raise
31     funds for GNU development.-->
32<meta http-equiv="Content-Style-Type" content="text/css">
33<style type="text/css"><!--
34  pre.display { font-family:inherit }
35  pre.format  { font-family:inherit }
36  pre.smalldisplay { font-family:inherit; font-size:smaller }
37  pre.smallformat  { font-family:inherit; font-size:smaller }
38  pre.smallexample { font-size:smaller }
39  pre.smalllisp    { font-size:smaller }
40  span.sc    { font-variant:small-caps }
41  span.roman { font-family:serif; font-weight:normal; } 
42  span.sansserif { font-family:sans-serif; font-weight:normal; } 
43--></style>
44<link rel="stylesheet" type="text/css" href="../cs.css">
45</head>
46<body>
47<div class="node">
48<a name="Return-Address"></a>
49<p>
50Next:&nbsp;<a rel="next" accesskey="n" href="Vector-Extensions.html#Vector-Extensions">Vector Extensions</a>,
51Previous:&nbsp;<a rel="previous" accesskey="p" href="Function-Names.html#Function-Names">Function Names</a>,
52Up:&nbsp;<a rel="up" accesskey="u" href="C-Extensions.html#C-Extensions">C Extensions</a>
53<hr>
54</div>
55
56<h3 class="section">6.48 Getting the Return or Frame Address of a Function</h3>
57
58<p>These functions may be used to get information about the callers of a
59function.
60
61<div class="defun">
62&mdash; Built-in Function: void * <b>__builtin_return_address</b> (<var>unsigned int level</var>)<var><a name="index-g_t_005f_005fbuiltin_005freturn_005faddress-2905"></a></var><br>
63<blockquote><p>This function returns the return address of the current function, or of
64one of its callers.  The <var>level</var> argument is number of frames to
65scan up the call stack.  A value of <code>0</code> yields the return address
66of the current function, a value of <code>1</code> yields the return address
67of the caller of the current function, and so forth.  When inlining
68the expected behavior is that the function returns the address of
69the function that is returned to.  To work around this behavior use
70the <code>noinline</code> function attribute.
71
72      <p>The <var>level</var> argument must be a constant integer.
73
74      <p>On some machines it may be impossible to determine the return address of
75any function other than the current one; in such cases, or when the top
76of the stack has been reached, this function returns <code>0</code> or a
77random value.  In addition, <code>__builtin_frame_address</code> may be used
78to determine if the top of the stack has been reached.
79
80      <p>Additional post-processing of the returned value may be needed, see
81<code>__builtin_extract_return_addr</code>.
82
83      <p>This function should only be used with a nonzero argument for debugging
84purposes. 
85</p></blockquote></div>
86
87<div class="defun">
88&mdash; Built-in Function: void * <b>__builtin_extract_return_addr</b> (<var>void *addr</var>)<var><a name="index-g_t_005f_005fbuiltin_005fextract_005freturn_005faddr-2906"></a></var><br>
89<blockquote><p>The address as returned by <code>__builtin_return_address</code> may have to be fed
90through this function to get the actual encoded address.  For example, on the
9131-bit S/390 platform the highest bit has to be masked out, or on SPARC
92platforms an offset has to be added for the true next instruction to be
93executed.
94
95      <p>If no fixup is needed, this function simply passes through <var>addr</var>. 
96</p></blockquote></div>
97
98<div class="defun">
99&mdash; Built-in Function: void * <b>__builtin_frob_return_address</b> (<var>void *addr</var>)<var><a name="index-g_t_005f_005fbuiltin_005ffrob_005freturn_005faddress-2907"></a></var><br>
100<blockquote><p>This function does the reverse of <code>__builtin_extract_return_addr</code>. 
101</p></blockquote></div>
102
103<div class="defun">
104&mdash; Built-in Function: void * <b>__builtin_frame_address</b> (<var>unsigned int level</var>)<var><a name="index-g_t_005f_005fbuiltin_005fframe_005faddress-2908"></a></var><br>
105<blockquote><p>This function is similar to <code>__builtin_return_address</code>, but it
106returns the address of the function frame rather than the return address
107of the function.  Calling <code>__builtin_frame_address</code> with a value of
108<code>0</code> yields the frame address of the current function, a value of
109<code>1</code> yields the frame address of the caller of the current function,
110and so forth.
111
112      <p>The frame is the area on the stack that holds local variables and saved
113registers.  The frame address is normally the address of the first word
114pushed on to the stack by the function.  However, the exact definition
115depends upon the processor and the calling convention.  If the processor
116has a dedicated frame pointer register, and the function has a frame,
117then <code>__builtin_frame_address</code> returns the value of the frame
118pointer register.
119
120      <p>On some machines it may be impossible to determine the frame address of
121any function other than the current one; in such cases, or when the top
122of the stack has been reached, this function returns <code>0</code> if
123the first frame pointer is properly initialized by the startup code.
124
125      <p>This function should only be used with a nonzero argument for debugging
126purposes. 
127</p></blockquote></div>
128
129 </body></html>
130
131