mprof and new systems..
Peter Wemm
peter at wemm.org
Sat Jun 14 09:02:09 UTC 2008
On Sat, Jun 14, 2008 at 1:10 AM, Julian Elischer <julian at elischer.org> wrote:
> Julian Elischer wrote:
[..]
>> Anyone with ideas as to how to make the port act reliably?
Check out __builtin_return_address() and __builtin_frame_pointer().
Or look at src/sys/i386/i386/stack_machdep.c (it is present on all platforms).
info gcc -> 'C Extensions' -> 'Return Address'
-- Built-in Function: void * __builtin_return_address (unsigned int
LEVEL)
This function returns the return address of the current function,
or of one of its callers.
..
-- Built-in Function: void * __builtin_frame_address (unsigned int
LEVEL)
This function is similar to `__builtin_return_address', but it
returns the address of the function frame rather than the return
address of the function.
__builtin_frame_address() on i386 is basically:
register_t ebp;
__asm __volatile("movl %%ebp,%0" : "=r" (ebp));
or for amd64:
register_t rbp;
__asm __volatile("movq %%rbp,%0" : "=r" (rbp));
--
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5
"If Java had true garbage collection, most programs would delete
themselves upon execution." -- Robert Sewell
More information about the freebsd-current
mailing list