Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
Linux powerpc64 / ppc64le
Description
While building couchbase on ppc64le architecture we were getting the below error :
/root/couchbase/forestdb/utils/debug.cc: In function 'void sigsegv_handler(int, siginfo_t*, void*)': |
/root/couchbase/forestdb/utils/debug.cc:93:57: error: 'struct mcontext_t' has no member named 'gregs'; did you mean 'regs'? |
unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_EIP]; |
^~~~~
|
regs
|
/root/couchbase/forestdb/utils/debug.cc:93:63: error: 'REG_EIP' was not declared in this scope |
unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_EIP]; |
^~~~~~~
|
forestdb/CMakeFiles/forestdb.dir/build.make:504: recipe for target 'forestdb/CMakeFiles/forestdb.dir/utils/debug.cc.o' failed |
make[2]: *** [forestdb/CMakeFiles/forestdb.dir/utils/debug.cc.o] Error 1 |
CMakeFiles/Makefile2:7439: recipe for target 'forestdb/CMakeFiles/forestdb.dir/all' failed |
make[1]: *** [forestdb/CMakeFiles/forestdb.dir/all] Error 2 |
To resolve the issue , we need below changes to add program counter for ppc64le.
diff --git a/utils/debug.cc b/utils/debug.cc
|
index 7e70d75..78b0440 100644 |
--- a/utils/debug.cc
|
+++ b/utils/debug.cc
|
@@ -88,6 +88,8 @@ static void sigsegv_handler(int sig, siginfo_t *siginfo, void *context) |
ucontext *u = (ucontext *)context;
|
#ifdef REG_RIP // Test if the Program Counter is 64 bits |
unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_RIP]; |
+#elif defined (__PPC64__) && defined (__LITTLE_ENDIAN__)
|
+ unsigned char *pc = (unsigned char *)u->uc_mcontext.regs->nip; |
#else |
#ifdef __s390x__ //Program Counter for s390x architecture |
unsigned char *pc = (unsigned char *)u->uc_mcontext.psw.addr; |