version 1.1.1.2, 2013/07/21 23:54:39
|
version 1.1.1.3, 2016/11/02 10:09:10
|
Line 175 program_counter(void *context)
|
Line 175 program_counter(void *context)
|
{ |
{ |
#ifdef HAVE_UCONTEXT_H |
#ifdef HAVE_UCONTEXT_H |
#ifdef GNU_LINUX |
#ifdef GNU_LINUX |
#ifdef REG_EIP | /* these are from GNU libc, rather than Linux, strictly speaking */ |
if (context) | # if defined(REG_EIP) |
return (void *)(((ucontext_t *)context)->uc_mcontext.gregs[REG_EIP]); | # define REG_INDEX REG_EIP |
#endif /* REG_EIP */ | # elif defined(REG_RIP) |
| # define REG_INDEX REG_RIP |
| # elif defined(__powerpc__) |
| # define REG_INDEX 32 |
| # endif |
| #elif defined(SUNOS_5) /* !GNU_LINUX */ |
| # define REG_INDEX REG_PC |
#endif /* GNU_LINUX */ |
#endif /* GNU_LINUX */ |
|
|
|
#ifdef REG_INDEX |
|
# ifdef HAVE_UCONTEXT_T_UC_MCONTEXT_GREGS |
|
# define REGS gregs[REG_INDEX] |
|
# elif defined(HAVE_UCONTEXT_T_UC_MCONTEXT_UC_REGS) |
|
# define REGS uc_regs->gregs[REG_INDEX] |
|
# endif /* HAVE_UCONTEXT_T_UC_MCONTEXT_GREGS */ |
|
#endif /* REG_INDEX */ |
|
|
|
#ifdef REGS |
|
if (context) |
|
return (void *)(((ucontext_t *)context)->uc_mcontext.REGS); |
|
#elif defined(HAVE_UCONTEXT_T_UC_MCONTEXT_REGS__NIP) |
|
/* older Linux / struct pt_regs ? */ |
|
if (context) |
|
return (void *)(((ucontext_t *)context)->uc_mcontext.regs->nip); |
|
#endif /* REGS */ |
|
|
#endif /* HAVE_UCONTEXT_H */ |
#endif /* HAVE_UCONTEXT_H */ |
return NULL; |
return NULL; |
} |
} |