This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to access PC


Try this function:
void * __attribute__((noinline)) getpc()
{
void *t;
asm("mflr %0":"=r"(t));
return t;
}
It might not work always because of sibcalling optimizations but it should get you started.


Thanks,
Andrew Pinski



On Monday, September 8, 2003, at 05:03 PM, Mohammed Tajuddin wrote:

Hello,

Has anyone tried accessing the program counter on linux powerpc64?  I
notice struct pt_regs defined in ptrace.h, does not contain any place
holder for program counter which is defined on mac-osx for example.
Basically I was trying to access PC, PS from within a program.
Appreciate your feedback.


Regards, TAJ




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]