help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __builtin_return_address and -fomit-frame-pointer


From: Paul Pluzhnikov
Subject: Re: __builtin_return_address and -fomit-frame-pointer
Date: Wed, 03 Jan 2007 07:03:18 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

jbmailbox@gmail.com writes:

> I am planning to use to __builtin_return_address to get the caller's
> address of a function.  My understanding is that this built-in function
> uses frame pointers (PUSH EBP to the stack) to track caller functions
> of multiple levels.

On x86, yes.

> If this is correct, does that also mean omit-frame-pointer compiler
> option has to always be OFF when __built_return_address(1) is used?

Yes: if '-fomit-frame-pointer' is in effect, then
__built_return_address(1) may return anything, or even crash.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]