This repository was archived by the owner on Jun 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
GetPC() always returns nullptr #953
Copy link
Copy link
Closed
Description
As PC_FROM_UCONTEXT is never defined, GetPC() always returns nullptr:
Lines 76 to 86 in 6482757
| void* GetPC(void* ucontext_in_void) { | |
| #if (defined(HAVE_UCONTEXT_H) || defined(HAVE_SYS_UCONTEXT_H)) && defined(PC_FROM_UCONTEXT) | |
| if (ucontext_in_void != nullptr) { | |
| ucontext_t *context = reinterpret_cast<ucontext_t *>(ucontext_in_void); | |
| return (void*)context->PC_FROM_UCONTEXT; | |
| } | |
| #else | |
| (void)ucontext_in_void; | |
| #endif | |
| return nullptr; | |
| } |
Possible fix:
- update by prefixing each entry with
Lines 215 to 233 in 6482757
set (_PC_FIELDS "gregs[REG_PC]" "gregs[REG_EIP]" "gregs[REG_RIP]" "sc_ip" "uc_regs->gregs[PT_NIP]" "gregs[R15]" "arm_pc" "mc_eip" "mc_rip" "__gregs[REG_EIP]" "__gregs[REG_RIP]" "ss.eip" "__ss.__eip" "ss.rip" "__ss.__rip" "ss.srr0" "__ss.__srr0" ) uc_mcontext./uc_mcontext->(https://github.com/couchbase/gperftools/blob/846b775dfadb77901202ae7ddbac30ad1de7df01/m4/pc_from_ucontext.m4#L23-L43 seems to provide an up-to-date list of fields) - update
try_compile ()invocation.should sayLines 251 to 252 in 6482757
try_compile (HAVE_PC_FROM_UCONTEXT ${CMAKE_CURRENT_BINARY_DIR} ${_TMP} COMPILE_DEFINITIONS _GNU_SOURCE=1) -D_GNU_SOURCE=1 - set cache variable correctly (
set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE STRING "")) - define the macro correctly (
#cmakedefine PC_FROM_UCONTEXT ${PC_FROM_UCONTEXT})