how to access PC

Richard Henderson rth@redhat.com
Tue Sep 9 06:35:00 GMT 2003


On Mon, Sep 08, 2003 at 06:26:34PM -0700, Andrew Pinski wrote:
> Try this function:
> void * __attribute__((noinline)) getpc()
> {
> 	void *t;
> 	asm("mflr %0":"=r"(t));
> 	return t;
> }

If you're not going to inline, __builtin_return_address(0) will work.


r~



More information about the Gcc mailing list