From b4b98912429504111c63a5e4c3b9672cbebaa23f Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Wed, 27 Jan 2010 10:59:59 +0000 Subject: [PATCH] fix for gprof in 64 bit OSX. --- C/gprof.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/C/gprof.c b/C/gprof.c index ccbf808b8..6e533177f 100644 --- a/C/gprof.c +++ b/C/gprof.c @@ -913,16 +913,27 @@ showprofres(UInt type) { #ifdef __APPLE__ #include +#ifdef __x86_64__ #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 #define CONTEXT_STATE (((ucontext_t *)context)->uc_mcontext->ss) -#define CONTEXT_PC (CONTEXT_STATE.eip) -#define CONTEXT_BP (CONTEXT_STATE.ebp) +#define CONTEXT_PC (CONTEXT_STATE.rip) +#define CONTEXT_BP (CONTEXT_STATE.rbp) +#else +#define CONTEXT_STATE (((ucontext_t *)scv)->uc_mcontext->__ss) +#define CONTEXT_PC (CONTEXT_STATE.__rip) +#define CONTEXT_BP (CONTEXT_STATE.__rbp) +#endif +#else /* i386 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#define CONTEXT_STATE (((ucontext_t *)context)->uc_mcontext->ss) +#define CONTEXT_PC (CONTEXT_STATE.rip) +#define CONTEXT_BP (CONTEXT_STATE.rbp) #else #define CONTEXT_STATE (((ucontext_t *)scv)->uc_mcontext->__ss) #define CONTEXT_PC (CONTEXT_STATE.__eip) #define CONTEXT_BP (CONTEXT_STATE.__ebp) #endif - +#endif #endif static void