forked from OSchip/llvm-project
[libunwind] Export the unw_* symbols as weak symbols
libunwind defines the _Unwind_* ABI used by libc++abi. This ABI is a stable quasi-standard common between multiple implementations such as LLVM and GNU. The _U* symbol name space is also safely within the symbol name space that standard C & C++ reserve for the implementation. Futhermore, libunwind also defines several unw_* symbols, and references these from the _Unwind_* entry points so the standard/reserved part of the ABI is dependent on the unw_* part of the ABI. This is not OK for a C or C++ implementation. The unw_* symbols are reserved for C and extern "C" used by application code. This change renames each unw_* function to __unw* and adds a weak alias unw_* to keep the public <libunwind.h> ABI unchanged for backwards compatibility. Every reference to unw_* in the implementation has been changed to use __unw* so that if other unw_* definitions are in force because nothing uses <libunwind.h> in a particular program, no _Unwind* code path depends on any unw_* symbol. Furthemore, __unw_* symbols are hidden, which saves PLT overhead in the shared library case. In the future, we should cconsider untangling the unw_* API/ABI from the _Unwind_* API/ABI. The internal API backing the _Unwind_* ABI implementation should not rely on any nonstandard symbols not in the implementation-reserved name space. This would then allow separating the _Unwind_* API/ABI from unw_* entirely, but that's a more substantial change that's going to require more significant refactoring. Differential Revision: https://reviews.llvm.org/D59921 llvm-svn: 357640
This commit is contained in:
parent
306809f292
commit
e369a989fc
|
@ -2154,7 +2154,7 @@ inline Registers_arm::Registers_arm(const void *registers)
|
|||
_saved_vfp_d16_d31(false) {
|
||||
static_assert((check_fit<Registers_arm, unw_context_t>::does_fit),
|
||||
"arm registers do not fit into unw_context_t");
|
||||
// See unw_getcontext() note about data.
|
||||
// See __unw_getcontext() note about data.
|
||||
memcpy(&_registers, registers, sizeof(_registers));
|
||||
memset(&_vfp_d0_d15_pad, 0, sizeof(_vfp_d0_d15_pad));
|
||||
memset(&_vfp_d16_d31, 0, sizeof(_vfp_d16_d31));
|
||||
|
@ -2433,7 +2433,7 @@ inline const char *Registers_arm::getRegisterName(int regNum) {
|
|||
|
||||
inline bool Registers_arm::validFloatRegister(int regNum) const {
|
||||
// NOTE: Consider the intel MMX registers floating points so the
|
||||
// unw_get_fpreg can be used to transmit the 64-bit data back.
|
||||
// __unw_get_fpreg can be used to transmit the 64-bit data back.
|
||||
return ((regNum >= UNW_ARM_D0) && (regNum <= UNW_ARM_D31))
|
||||
#if defined(__ARM_WMMX)
|
||||
|| ((regNum >= UNW_ARM_WR0) && (regNum <= UNW_ARM_WR15))
|
||||
|
|
|
@ -179,7 +179,7 @@ static _Unwind_Reason_Code unwindOneFrame(_Unwind_State state,
|
|||
if (result != _URC_CONTINUE_UNWIND)
|
||||
return result;
|
||||
|
||||
if (unw_step(reinterpret_cast<unw_cursor_t*>(context)) != UNW_STEP_SUCCESS)
|
||||
if (__unw_step(reinterpret_cast<unw_cursor_t *>(context)) != UNW_STEP_SUCCESS)
|
||||
return _URC_FAILURE;
|
||||
return _URC_CONTINUE_UNWIND;
|
||||
}
|
||||
|
@ -440,17 +440,18 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
// In this implementation, the phases don't share the VRS backing store.
|
||||
// Instead, they are passed the original |uc| and they create a new VRS
|
||||
// from scratch thus achieving the same effect.
|
||||
unw_init_local(cursor, uc);
|
||||
__unw_init_local(cursor, uc);
|
||||
|
||||
// Walk each frame looking for a place to stop.
|
||||
for (bool handlerNotFound = true; handlerNotFound;) {
|
||||
|
||||
// See if frame has code to run (has personality routine).
|
||||
unw_proc_info_t frameInfo;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE1_ERROR",
|
||||
static_cast<void *>(exception_object));
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): __unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE1_ERROR",
|
||||
static_cast<void *>(exception_object));
|
||||
return _URC_FATAL_PHASE1_ERROR;
|
||||
}
|
||||
|
||||
|
@ -459,12 +460,12 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
char functionBuf[512];
|
||||
const char *functionName = functionBuf;
|
||||
unw_word_t offset;
|
||||
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
(frameInfo.start_ip + offset > frameInfo.end_ip))
|
||||
functionName = ".anonymous.";
|
||||
unw_word_t pc;
|
||||
unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
__unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIxPTR ", start_ip=0x%" PRIxPTR ", func=%s, "
|
||||
"lsda=0x%" PRIxPTR ", personality=0x%" PRIxPTR,
|
||||
|
@ -534,7 +535,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
|
|||
_Unwind_Exception *exception_object,
|
||||
bool resume) {
|
||||
// See comment at the start of unwind_phase1 regarding VRS integrity.
|
||||
unw_init_local(cursor, uc);
|
||||
__unw_init_local(cursor, uc);
|
||||
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)",
|
||||
static_cast<void *>(exception_object));
|
||||
|
@ -556,19 +557,20 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
|
|||
// for. After this, continue unwinding as if normal.
|
||||
//
|
||||
// See #7.4.6 for details.
|
||||
unw_set_reg(cursor, UNW_REG_IP,
|
||||
exception_object->unwinder_cache.reserved2);
|
||||
__unw_set_reg(cursor, UNW_REG_IP,
|
||||
exception_object->unwinder_cache.reserved2);
|
||||
resume = false;
|
||||
}
|
||||
|
||||
// Get info about this frame.
|
||||
unw_word_t sp;
|
||||
unw_proc_info_t frameInfo;
|
||||
unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE2_ERROR",
|
||||
static_cast<void *>(exception_object));
|
||||
__unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase2(ex_ojb=%p): __unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE2_ERROR",
|
||||
static_cast<void *>(exception_object));
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
}
|
||||
|
||||
|
@ -577,8 +579,8 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
|
|||
char functionBuf[512];
|
||||
const char *functionName = functionBuf;
|
||||
unw_word_t offset;
|
||||
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
(frameInfo.start_ip + offset > frameInfo.end_ip))
|
||||
functionName = ".anonymous.";
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
|
@ -622,8 +624,8 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
|
|||
// We may get control back if landing pad calls _Unwind_Resume().
|
||||
if (_LIBUNWIND_TRACING_UNWINDING) {
|
||||
unw_word_t pc;
|
||||
unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
__unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
__unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
|
||||
"user code with ip=0x%" PRIxPTR ", sp=0x%" PRIxPTR,
|
||||
static_cast<void *>(exception_object),
|
||||
|
@ -634,11 +636,11 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
|
|||
// EHABI #7.4.1 says we need to preserve pc for when _Unwind_Resume
|
||||
// is called back, to find this same frame.
|
||||
unw_word_t pc;
|
||||
unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
__unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
exception_object->unwinder_cache.reserved2 = (uint32_t)pc;
|
||||
}
|
||||
unw_resume(cursor);
|
||||
// unw_resume() only returns if there was an error.
|
||||
__unw_resume(cursor);
|
||||
// __unw_resume() only returns if there was an error.
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
|
||||
// # EHABI #7.4.3
|
||||
|
@ -667,7 +669,7 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
|
|||
static_cast<void *>(exception_object));
|
||||
unw_context_t uc;
|
||||
unw_cursor_t cursor;
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
|
||||
// This field for is for compatibility with GCC to say this isn't a forced
|
||||
// unwind. EHABI #7.2
|
||||
|
@ -705,7 +707,7 @@ _Unwind_Resume(_Unwind_Exception *exception_object) {
|
|||
static_cast<void *>(exception_object));
|
||||
unw_context_t uc;
|
||||
unw_cursor_t cursor;
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
|
||||
// _Unwind_RaiseException on EHABI will always set the reserved1 field to 0,
|
||||
// which is in the same position as private_1 below.
|
||||
|
@ -722,7 +724,7 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
|
|||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_proc_info_t frameInfo;
|
||||
uintptr_t result = 0;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
result = (uintptr_t)frameInfo.lsda;
|
||||
_LIBUNWIND_TRACE_API(
|
||||
"_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx",
|
||||
|
@ -762,8 +764,8 @@ _Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
|
|||
case _UVRSC_CORE:
|
||||
if (representation != _UVRSD_UINT32 || regno > 15)
|
||||
return _UVRSR_FAILED;
|
||||
return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
|
||||
*(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
|
||||
*(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
case _UVRSC_VFP:
|
||||
|
@ -773,28 +775,28 @@ _Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
|
|||
// Can only touch d0-15 with FSTMFDX.
|
||||
if (regno > 15)
|
||||
return _UVRSR_FAILED;
|
||||
unw_save_vfp_as_X(cursor);
|
||||
__unw_save_vfp_as_X(cursor);
|
||||
} else {
|
||||
if (regno > 31)
|
||||
return _UVRSR_FAILED;
|
||||
}
|
||||
return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno),
|
||||
*(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno),
|
||||
*(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
#if defined(__ARM_WMMX)
|
||||
case _UVRSC_WMMXC:
|
||||
if (representation != _UVRSD_UINT32 || regno > 3)
|
||||
return _UVRSR_FAILED;
|
||||
return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
|
||||
*(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
|
||||
*(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
case _UVRSC_WMMXD:
|
||||
if (representation != _UVRSD_DOUBLE || regno > 31)
|
||||
return _UVRSR_FAILED;
|
||||
return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
|
||||
*(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
|
||||
*(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
#else
|
||||
|
@ -816,8 +818,8 @@ _Unwind_VRS_Get_Internal(_Unwind_Context *context,
|
|||
case _UVRSC_CORE:
|
||||
if (representation != _UVRSD_UINT32 || regno > 15)
|
||||
return _UVRSR_FAILED;
|
||||
return unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
|
||||
(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
|
||||
(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
case _UVRSC_VFP:
|
||||
|
@ -827,28 +829,28 @@ _Unwind_VRS_Get_Internal(_Unwind_Context *context,
|
|||
// Can only touch d0-15 with FSTMFDX.
|
||||
if (regno > 15)
|
||||
return _UVRSR_FAILED;
|
||||
unw_save_vfp_as_X(cursor);
|
||||
__unw_save_vfp_as_X(cursor);
|
||||
} else {
|
||||
if (regno > 31)
|
||||
return _UVRSR_FAILED;
|
||||
}
|
||||
return unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno),
|
||||
(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno),
|
||||
(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
#if defined(__ARM_WMMX)
|
||||
case _UVRSC_WMMXC:
|
||||
if (representation != _UVRSD_UINT32 || regno > 3)
|
||||
return _UVRSR_FAILED;
|
||||
return unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
|
||||
(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
|
||||
(unw_word_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
case _UVRSC_WMMXD:
|
||||
if (representation != _UVRSD_DOUBLE || regno > 31)
|
||||
return _UVRSR_FAILED;
|
||||
return unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
|
||||
(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
return __unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
|
||||
(unw_fpreg_t *)valuep) == UNW_ESUCCESS
|
||||
? _UVRSR_OK
|
||||
: _UVRSR_FAILED;
|
||||
#else
|
||||
|
@ -957,7 +959,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
|
|||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_proc_info_t frameInfo;
|
||||
uintptr_t result = 0;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
result = (uintptr_t)frameInfo.start_ip;
|
||||
_LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX",
|
||||
static_cast<void *>(context), (long long)result);
|
||||
|
@ -980,7 +982,7 @@ extern "C" _LIBUNWIND_EXPORT _Unwind_Reason_Code
|
|||
__gnu_unwind_frame(_Unwind_Exception *exception_object,
|
||||
struct _Unwind_Context *context) {
|
||||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
if (unw_step(cursor) != UNW_STEP_SUCCESS)
|
||||
if (__unw_step(cursor) != UNW_STEP_SUCCESS)
|
||||
return _URC_FAILURE;
|
||||
return _URC_OK;
|
||||
}
|
||||
|
|
|
@ -58,9 +58,10 @@ static void seh_exc_cleanup(_Unwind_Reason_Code urc, _Unwind_Exception *exc) {
|
|||
free(exc);
|
||||
}
|
||||
|
||||
static int _unw_init_seh(unw_cursor_t *cursor, CONTEXT *ctx);
|
||||
static DISPATCHER_CONTEXT *_unw_seh_get_disp_ctx(unw_cursor_t *cursor);
|
||||
static void _unw_seh_set_disp_ctx(unw_cursor_t *cursor, DISPATCHER_CONTEXT *disp);
|
||||
static int __unw_init_seh(unw_cursor_t *cursor, CONTEXT *ctx);
|
||||
static DISPATCHER_CONTEXT *__unw_seh_get_disp_ctx(unw_cursor_t *cursor);
|
||||
static void __unw_seh_set_disp_ctx(unw_cursor_t *cursor,
|
||||
DISPATCHER_CONTEXT *disp);
|
||||
|
||||
/// Common implementation of SEH-style handler functions used by Itanium-
|
||||
/// style frames. Depending on how and why it was called, it may do one of:
|
||||
|
@ -113,9 +114,9 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
|
|||
memset(exc->private_, 0, sizeof(exc->private_));
|
||||
}
|
||||
if (!ctx) {
|
||||
_unw_init_seh(&cursor, disp->ContextRecord);
|
||||
_unw_seh_set_disp_ctx(&cursor, disp);
|
||||
unw_set_reg(&cursor, UNW_REG_IP, disp->ControlPc-1);
|
||||
__unw_init_seh(&cursor, disp->ContextRecord);
|
||||
__unw_seh_set_disp_ctx(&cursor, disp);
|
||||
__unw_set_reg(&cursor, UNW_REG_IP, disp->ControlPc - 1);
|
||||
ctx = (struct _Unwind_Context *)&cursor;
|
||||
|
||||
if (!IS_UNWINDING(ms_exc->ExceptionFlags)) {
|
||||
|
@ -172,18 +173,18 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
|
|||
_LIBUNWIND_ABORT("Personality installed context during phase 1!");
|
||||
#ifdef __x86_64__
|
||||
exc->private_[2] = disp->TargetIp;
|
||||
unw_get_reg(&cursor, UNW_X86_64_RAX, &retval);
|
||||
unw_get_reg(&cursor, UNW_X86_64_RDX, &exc->private_[3]);
|
||||
__unw_get_reg(&cursor, UNW_X86_64_RAX, &retval);
|
||||
__unw_get_reg(&cursor, UNW_X86_64_RDX, &exc->private_[3]);
|
||||
#elif defined(__arm__)
|
||||
exc->private_[2] = disp->TargetPc;
|
||||
unw_get_reg(&cursor, UNW_ARM_R0, &retval);
|
||||
unw_get_reg(&cursor, UNW_ARM_R1, &exc->private_[3]);
|
||||
__unw_get_reg(&cursor, UNW_ARM_R0, &retval);
|
||||
__unw_get_reg(&cursor, UNW_ARM_R1, &exc->private_[3]);
|
||||
#elif defined(__aarch64__)
|
||||
exc->private_[2] = disp->TargetPc;
|
||||
unw_get_reg(&cursor, UNW_ARM64_X0, &retval);
|
||||
unw_get_reg(&cursor, UNW_ARM64_X1, &exc->private_[3]);
|
||||
__unw_get_reg(&cursor, UNW_ARM64_X0, &retval);
|
||||
__unw_get_reg(&cursor, UNW_ARM64_X1, &exc->private_[3]);
|
||||
#endif
|
||||
unw_get_reg(&cursor, UNW_REG_IP, &target);
|
||||
__unw_get_reg(&cursor, UNW_REG_IP, &target);
|
||||
ms_exc->ExceptionCode = STATUS_GCC_UNWIND;
|
||||
#ifdef __x86_64__
|
||||
ms_exc->ExceptionInformation[2] = disp->TargetIp;
|
||||
|
@ -203,7 +204,7 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
|
|||
}
|
||||
}
|
||||
|
||||
/// Personality function returned by \c unw_get_proc_info() in SEH contexts.
|
||||
/// Personality function returned by \c __unw_get_proc_info() in SEH contexts.
|
||||
/// This is a wrapper that calls the real SEH handler function, which in
|
||||
/// turn (at least, for Itanium-style frames) calls the real Itanium
|
||||
/// personality function (see \c _GCC_specific_handler()).
|
||||
|
@ -221,7 +222,8 @@ __libunwind_seh_personality(int version, _Unwind_Action state,
|
|||
ms_exc.ExceptionInformation[0] = (ULONG_PTR)exc;
|
||||
ms_exc.ExceptionInformation[1] = (ULONG_PTR)context;
|
||||
ms_exc.ExceptionInformation[2] = state;
|
||||
DISPATCHER_CONTEXT *disp_ctx = _unw_seh_get_disp_ctx((unw_cursor_t *)context);
|
||||
DISPATCHER_CONTEXT *disp_ctx =
|
||||
__unw_seh_get_disp_ctx((unw_cursor_t *)context);
|
||||
EXCEPTION_DISPOSITION ms_act = disp_ctx->LanguageHandler(&ms_exc,
|
||||
(PVOID)disp_ctx->EstablisherFrame,
|
||||
disp_ctx->ContextRecord,
|
||||
|
@ -240,15 +242,15 @@ unwind_phase2_forced(unw_context_t *uc,
|
|||
_Unwind_Exception *exception_object,
|
||||
_Unwind_Stop_Fn stop, void *stop_parameter) {
|
||||
unw_cursor_t cursor2;
|
||||
unw_init_local(&cursor2, uc);
|
||||
__unw_init_local(&cursor2, uc);
|
||||
|
||||
// Walk each frame until we reach where search phase said to stop
|
||||
while (unw_step(&cursor2) > 0) {
|
||||
while (__unw_step(&cursor2) > 0) {
|
||||
|
||||
// Update info about this frame.
|
||||
unw_proc_info_t frameInfo;
|
||||
if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step "
|
||||
if (__unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): __unw_step "
|
||||
"failed => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
|
@ -259,8 +261,8 @@ unwind_phase2_forced(unw_context_t *uc,
|
|||
char functionBuf[512];
|
||||
const char *functionName = functionBuf;
|
||||
unw_word_t offset;
|
||||
if ((unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
if ((__unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
(frameInfo.start_ip + offset > frameInfo.end_ip))
|
||||
functionName = ".anonymous.";
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
|
@ -310,7 +312,7 @@ unwind_phase2_forced(unw_context_t *uc,
|
|||
"_URC_INSTALL_CONTEXT",
|
||||
(void *)exception_object);
|
||||
// We may get control back if landing pad calls _Unwind_Resume().
|
||||
unw_resume(&cursor2);
|
||||
__unw_resume(&cursor2);
|
||||
break;
|
||||
default:
|
||||
// Personality routine returned an unknown result code.
|
||||
|
@ -375,7 +377,7 @@ _Unwind_Resume(_Unwind_Exception *exception_object) {
|
|||
if (exception_object->private_[0] != 0) {
|
||||
unw_context_t uc;
|
||||
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
unwind_phase2_forced(&uc, exception_object,
|
||||
(_Unwind_Stop_Fn) exception_object->private_[0],
|
||||
(void *)exception_object->private_[4]);
|
||||
|
@ -413,7 +415,7 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
|
|||
_LIBUNWIND_TRACE_API("_Unwind_ForcedUnwind(ex_obj=%p, stop=%p)",
|
||||
(void *)exception_object, (void *)(uintptr_t)stop);
|
||||
unw_context_t uc;
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
|
||||
// Mark that this is a forced unwind, so _Unwind_Resume() can do
|
||||
// the right thing.
|
||||
|
@ -427,7 +429,8 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
|
|||
/// Called by personality handler during phase 2 to get LSDA for current frame.
|
||||
_LIBUNWIND_EXPORT uintptr_t
|
||||
_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
|
||||
uintptr_t result = (uintptr_t)_unw_seh_get_disp_ctx((unw_cursor_t *)context)->HandlerData;
|
||||
uintptr_t result =
|
||||
(uintptr_t)__unw_seh_get_disp_ctx((unw_cursor_t *)context)->HandlerData;
|
||||
_LIBUNWIND_TRACE_API(
|
||||
"_Unwind_GetLanguageSpecificData(context=%p) => 0x%" PRIxPTR,
|
||||
(void *)context, result);
|
||||
|
@ -438,15 +441,14 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
|
|||
/// function.
|
||||
_LIBUNWIND_EXPORT uintptr_t
|
||||
_Unwind_GetRegionStart(struct _Unwind_Context *context) {
|
||||
DISPATCHER_CONTEXT *disp = _unw_seh_get_disp_ctx((unw_cursor_t *)context);
|
||||
DISPATCHER_CONTEXT *disp = __unw_seh_get_disp_ctx((unw_cursor_t *)context);
|
||||
uintptr_t result = (uintptr_t)disp->FunctionEntry->BeginAddress + disp->ImageBase;
|
||||
_LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR,
|
||||
(void *)context, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
_unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) {
|
||||
static int __unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) {
|
||||
#ifdef _LIBUNWIND_TARGET_X86_64
|
||||
new (reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor))
|
||||
UnwindCursor<LocalAddressSpace, Registers_x86_64>(
|
||||
|
@ -473,8 +475,7 @@ _unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static DISPATCHER_CONTEXT *
|
||||
_unw_seh_get_disp_ctx(unw_cursor_t *cursor) {
|
||||
static DISPATCHER_CONTEXT *__unw_seh_get_disp_ctx(unw_cursor_t *cursor) {
|
||||
#ifdef _LIBUNWIND_TARGET_X86_64
|
||||
return reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor)->getDispatcherContext();
|
||||
#elif defined(_LIBUNWIND_TARGET_ARM)
|
||||
|
@ -486,8 +487,8 @@ _unw_seh_get_disp_ctx(unw_cursor_t *cursor) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
_unw_seh_set_disp_ctx(unw_cursor_t *cursor, DISPATCHER_CONTEXT *disp) {
|
||||
static void __unw_seh_set_disp_ctx(unw_cursor_t *cursor,
|
||||
DISPATCHER_CONTEXT *disp) {
|
||||
#ifdef _LIBUNWIND_TARGET_X86_64
|
||||
reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor)->setDispatcherContext(disp);
|
||||
#elif defined(_LIBUNWIND_TARGET_ARM)
|
||||
|
|
|
@ -177,9 +177,10 @@ unwind_phase2(struct _Unwind_Exception *exception_object) {
|
|||
|
||||
// check for no more frames
|
||||
if (c == NULL) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase2(ex_ojb=%p): __unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
return _URC_END_OF_STACK;
|
||||
}
|
||||
|
||||
|
@ -215,7 +216,7 @@ unwind_phase2(struct _Unwind_Exception *exception_object) {
|
|||
// we may get control back if landing pad calls _Unwind_Resume()
|
||||
__Unwind_SjLj_SetTopOfFunctionStack(c);
|
||||
__builtin_longjmp(c->jbuf, 1);
|
||||
// unw_resume() only returns if there was an error
|
||||
// __unw_resume() only returns if there was an error
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
default:
|
||||
// something went wrong
|
||||
|
@ -242,9 +243,10 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
|
|||
|
||||
// get next frame (skip over first which is _Unwind_RaiseException)
|
||||
if (c == NULL) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase2(ex_ojb=%p): __unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
return _URC_END_OF_STACK;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,10 +93,10 @@ _LIBUNWIND_EXPORT void *_Unwind_FindEnclosingFunction(void *pc) {
|
|||
unw_cursor_t cursor;
|
||||
unw_context_t uc;
|
||||
unw_proc_info_t info;
|
||||
unw_getcontext(&uc);
|
||||
unw_init_local(&cursor, &uc);
|
||||
unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t) pc);
|
||||
if (unw_get_proc_info(&cursor, &info) == UNW_ESUCCESS)
|
||||
__unw_getcontext(&uc);
|
||||
__unw_init_local(&cursor, &uc);
|
||||
__unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t)pc);
|
||||
if (__unw_get_proc_info(&cursor, &info) == UNW_ESUCCESS)
|
||||
return (void *)(intptr_t) info.start_ip;
|
||||
else
|
||||
return NULL;
|
||||
|
@ -108,8 +108,8 @@ _LIBUNWIND_EXPORT _Unwind_Reason_Code
|
|||
_Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
|
||||
unw_cursor_t cursor;
|
||||
unw_context_t uc;
|
||||
unw_getcontext(&uc);
|
||||
unw_init_local(&cursor, &uc);
|
||||
__unw_getcontext(&uc);
|
||||
__unw_init_local(&cursor, &uc);
|
||||
|
||||
_LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)",
|
||||
(void *)(uintptr_t)callback);
|
||||
|
@ -128,7 +128,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
|
|||
#if !defined(_LIBUNWIND_ARM_EHABI)
|
||||
// ask libunwind to get next frame (skip over first frame which is
|
||||
// _Unwind_Backtrace())
|
||||
if (unw_step(&cursor) <= 0) {
|
||||
if (__unw_step(&cursor) <= 0) {
|
||||
_LIBUNWIND_TRACE_UNWINDING(" _backtrace: ended because cursor reached "
|
||||
"bottom of stack, returning %d",
|
||||
_URC_END_OF_STACK);
|
||||
|
@ -137,7 +137,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
|
|||
#else
|
||||
// Get the information for this frame.
|
||||
unw_proc_info_t frameInfo;
|
||||
if (unw_get_proc_info(&cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
if (__unw_get_proc_info(&cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
return _URC_END_OF_STACK;
|
||||
}
|
||||
|
||||
|
@ -164,8 +164,8 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
|
|||
char functionName[512];
|
||||
unw_proc_info_t frame;
|
||||
unw_word_t offset;
|
||||
unw_get_proc_name(&cursor, functionName, 512, &offset);
|
||||
unw_get_proc_info(&cursor, &frame);
|
||||
__unw_get_proc_name(&cursor, functionName, 512, &offset);
|
||||
__unw_get_proc_info(&cursor, &frame);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
" _backtrace: start_ip=0x%" PRIxPTR ", func=%s, lsda=0x%" PRIxPTR ", context=%p",
|
||||
frame.start_ip, functionName, frame.lsda,
|
||||
|
@ -191,10 +191,10 @@ _LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc,
|
|||
unw_cursor_t cursor;
|
||||
unw_context_t uc;
|
||||
unw_proc_info_t info;
|
||||
unw_getcontext(&uc);
|
||||
unw_init_local(&cursor, &uc);
|
||||
unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t) pc);
|
||||
unw_get_proc_info(&cursor, &info);
|
||||
__unw_getcontext(&uc);
|
||||
__unw_init_local(&cursor, &uc);
|
||||
__unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t)pc);
|
||||
__unw_get_proc_info(&cursor, &info);
|
||||
bases->tbase = (uintptr_t)info.extra;
|
||||
bases->dbase = 0; // dbase not used on Mac OS X
|
||||
bases->func = (uintptr_t)info.start_ip;
|
||||
|
@ -208,7 +208,7 @@ _LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc,
|
|||
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) {
|
||||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_word_t result;
|
||||
unw_get_reg(cursor, UNW_REG_SP, &result);
|
||||
__unw_get_reg(cursor, UNW_REG_SP, &result);
|
||||
_LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p) => 0x%" PRIxPTR,
|
||||
(void *)context, result);
|
||||
return (uintptr_t)result;
|
||||
|
@ -233,7 +233,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
|
|||
/// was broken until 10.6.
|
||||
_LIBUNWIND_EXPORT void __register_frame(const void *fde) {
|
||||
_LIBUNWIND_TRACE_API("__register_frame(%p)", fde);
|
||||
_unw_add_dynamic_fde((unw_word_t)(uintptr_t) fde);
|
||||
__unw_add_dynamic_fde((unw_word_t)(uintptr_t)fde);
|
||||
}
|
||||
|
||||
|
||||
|
@ -243,7 +243,7 @@ _LIBUNWIND_EXPORT void __register_frame(const void *fde) {
|
|||
/// was broken until 10.6.
|
||||
_LIBUNWIND_EXPORT void __deregister_frame(const void *fde) {
|
||||
_LIBUNWIND_TRACE_API("__deregister_frame(%p)", fde);
|
||||
_unw_remove_dynamic_fde((unw_word_t)(uintptr_t) fde);
|
||||
__unw_remove_dynamic_fde((unw_word_t)(uintptr_t)fde);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,9 +25,10 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libunwind.h"
|
||||
#include "unwind.h"
|
||||
#include "config.h"
|
||||
#include "libunwind.h"
|
||||
#include "libunwind_ext.h"
|
||||
#include "unwind.h"
|
||||
|
||||
#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__)
|
||||
|
||||
|
@ -35,33 +36,36 @@
|
|||
|
||||
static _Unwind_Reason_Code
|
||||
unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
|
||||
unw_init_local(cursor, uc);
|
||||
__unw_init_local(cursor, uc);
|
||||
|
||||
// Walk each frame looking for a place to stop.
|
||||
bool handlerNotFound = true;
|
||||
while (handlerNotFound) {
|
||||
// Ask libunwind to get next frame (skip over first which is
|
||||
// _Unwind_RaiseException).
|
||||
int stepResult = unw_step(cursor);
|
||||
int stepResult = __unw_step(cursor);
|
||||
if (stepResult == 0) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): __unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
return _URC_END_OF_STACK;
|
||||
} else if (stepResult < 0) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step failed => "
|
||||
"_URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): __unw_step failed => "
|
||||
"_URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
return _URC_FATAL_PHASE1_ERROR;
|
||||
}
|
||||
|
||||
// See if frame has code to run (has personality routine).
|
||||
unw_proc_info_t frameInfo;
|
||||
unw_word_t sp;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): __unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
return _URC_FATAL_PHASE1_ERROR;
|
||||
}
|
||||
|
||||
|
@ -70,12 +74,12 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
char functionBuf[512];
|
||||
const char *functionName = functionBuf;
|
||||
unw_word_t offset;
|
||||
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
(frameInfo.start_ip + offset > frameInfo.end_ip))
|
||||
functionName = ".anonymous.";
|
||||
unw_word_t pc;
|
||||
unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
__unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIxPTR ", start_ip=0x%" PRIxPTR
|
||||
", func=%s, lsda=0x%" PRIxPTR ", personality=0x%" PRIxPTR "",
|
||||
|
@ -99,7 +103,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
// found a catch clause or locals that need destructing in this frame
|
||||
// stop search and remember stack pointer at the frame
|
||||
handlerNotFound = false;
|
||||
unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
__unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
exception_object->private_2 = (uintptr_t)sp;
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND",
|
||||
|
@ -128,7 +132,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
|
||||
static _Unwind_Reason_Code
|
||||
unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
|
||||
unw_init_local(cursor, uc);
|
||||
__unw_init_local(cursor, uc);
|
||||
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)",
|
||||
(void *)exception_object);
|
||||
|
@ -138,27 +142,30 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
|
||||
// Ask libunwind to get next frame (skip over first which is
|
||||
// _Unwind_RaiseException).
|
||||
int stepResult = unw_step(cursor);
|
||||
int stepResult = __unw_step(cursor);
|
||||
if (stepResult == 0) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase2(ex_ojb=%p): __unw_step() reached "
|
||||
"bottom => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
return _URC_END_OF_STACK;
|
||||
} else if (stepResult < 0) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step failed => "
|
||||
"_URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase2(ex_ojb=%p): __unw_step failed => "
|
||||
"_URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
}
|
||||
|
||||
// Get info about this frame.
|
||||
unw_word_t sp;
|
||||
unw_proc_info_t frameInfo;
|
||||
unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
__unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
"unwind_phase2(ex_ojb=%p): __unw_get_proc_info "
|
||||
"failed => _URC_FATAL_PHASE1_ERROR",
|
||||
(void *)exception_object);
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
}
|
||||
|
||||
|
@ -167,8 +174,8 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
char functionBuf[512];
|
||||
const char *functionName = functionBuf;
|
||||
unw_word_t offset;
|
||||
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
(frameInfo.start_ip + offset > frameInfo.end_ip))
|
||||
functionName = ".anonymous.";
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIxPTR
|
||||
|
@ -211,15 +218,15 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
|
|||
// We may get control back if landing pad calls _Unwind_Resume().
|
||||
if (_LIBUNWIND_TRACING_UNWINDING) {
|
||||
unw_word_t pc;
|
||||
unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
__unw_get_reg(cursor, UNW_REG_IP, &pc);
|
||||
__unw_get_reg(cursor, UNW_REG_SP, &sp);
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
|
||||
"user code with ip=0x%" PRIxPTR
|
||||
", sp=0x%" PRIxPTR,
|
||||
(void *)exception_object, pc, sp);
|
||||
}
|
||||
unw_resume(cursor);
|
||||
// unw_resume() only returns if there was an error.
|
||||
__unw_resume(cursor);
|
||||
// __unw_resume() only returns if there was an error.
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
default:
|
||||
// Personality routine returned an unknown result code.
|
||||
|
@ -239,15 +246,15 @@ static _Unwind_Reason_Code
|
|||
unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
|
||||
_Unwind_Exception *exception_object,
|
||||
_Unwind_Stop_Fn stop, void *stop_parameter) {
|
||||
unw_init_local(cursor, uc);
|
||||
__unw_init_local(cursor, uc);
|
||||
|
||||
// Walk each frame until we reach where search phase said to stop
|
||||
while (unw_step(cursor) > 0) {
|
||||
while (__unw_step(cursor) > 0) {
|
||||
|
||||
// Update info about this frame.
|
||||
unw_proc_info_t frameInfo;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step "
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
|
||||
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): __unw_step "
|
||||
"failed => _URC_END_OF_STACK",
|
||||
(void *)exception_object);
|
||||
return _URC_FATAL_PHASE2_ERROR;
|
||||
|
@ -258,8 +265,8 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
|
|||
char functionBuf[512];
|
||||
const char *functionName = functionBuf;
|
||||
unw_word_t offset;
|
||||
if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
|
||||
&offset) != UNW_ESUCCESS) ||
|
||||
(frameInfo.start_ip + offset > frameInfo.end_ip))
|
||||
functionName = ".anonymous.";
|
||||
_LIBUNWIND_TRACE_UNWINDING(
|
||||
|
@ -309,7 +316,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
|
|||
"_URC_INSTALL_CONTEXT",
|
||||
(void *)exception_object);
|
||||
// We may get control back if landing pad calls _Unwind_Resume().
|
||||
unw_resume(cursor);
|
||||
__unw_resume(cursor);
|
||||
break;
|
||||
default:
|
||||
// Personality routine returned an unknown result code.
|
||||
|
@ -345,7 +352,7 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
|
|||
(void *)exception_object);
|
||||
unw_context_t uc;
|
||||
unw_cursor_t cursor;
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
|
||||
// Mark that this is a non-forced unwind, so _Unwind_Resume()
|
||||
// can do the right thing.
|
||||
|
@ -379,7 +386,7 @@ _Unwind_Resume(_Unwind_Exception *exception_object) {
|
|||
_LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)", (void *)exception_object);
|
||||
unw_context_t uc;
|
||||
unw_cursor_t cursor;
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
|
||||
if (exception_object->private_1 != 0)
|
||||
unwind_phase2_forced(&uc, &cursor, exception_object,
|
||||
|
@ -404,7 +411,7 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
|
|||
(void *)exception_object, (void *)(uintptr_t)stop);
|
||||
unw_context_t uc;
|
||||
unw_cursor_t cursor;
|
||||
unw_getcontext(&uc);
|
||||
__unw_getcontext(&uc);
|
||||
|
||||
// Mark that this is a forced unwind, so _Unwind_Resume() can do
|
||||
// the right thing.
|
||||
|
@ -422,7 +429,7 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
|
|||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_proc_info_t frameInfo;
|
||||
uintptr_t result = 0;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
result = (uintptr_t)frameInfo.lsda;
|
||||
_LIBUNWIND_TRACE_API(
|
||||
"_Unwind_GetLanguageSpecificData(context=%p) => 0x%" PRIxPTR,
|
||||
|
@ -443,7 +450,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
|
|||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_proc_info_t frameInfo;
|
||||
uintptr_t result = 0;
|
||||
if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
if (__unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
|
||||
result = (uintptr_t)frameInfo.start_ip;
|
||||
_LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR,
|
||||
(void *)context, result);
|
||||
|
@ -468,7 +475,7 @@ _LIBUNWIND_EXPORT uintptr_t
|
|||
_Unwind_GetGR(struct _Unwind_Context *context, int index) {
|
||||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_word_t result;
|
||||
unw_get_reg(cursor, index, &result);
|
||||
__unw_get_reg(cursor, index, &result);
|
||||
_LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d) => 0x%" PRIxPTR,
|
||||
(void *)context, index, result);
|
||||
return (uintptr_t)result;
|
||||
|
@ -481,14 +488,14 @@ _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,
|
|||
")",
|
||||
(void *)context, index, value);
|
||||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_set_reg(cursor, index, value);
|
||||
__unw_set_reg(cursor, index, value);
|
||||
}
|
||||
|
||||
/// Called by personality handler during phase 2 to get instruction pointer.
|
||||
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
|
||||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_word_t result;
|
||||
unw_get_reg(cursor, UNW_REG_IP, &result);
|
||||
__unw_get_reg(cursor, UNW_REG_IP, &result);
|
||||
_LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIxPTR,
|
||||
(void *)context, result);
|
||||
return (uintptr_t)result;
|
||||
|
@ -502,7 +509,7 @@ _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
|
|||
_LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0" PRIxPTR ")",
|
||||
(void *)context, value);
|
||||
unw_cursor_t *cursor = (unw_cursor_t *)context;
|
||||
unw_set_reg(cursor, UNW_REG_IP, value);
|
||||
__unw_set_reg(cursor, UNW_REG_IP, value);
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#if !defined(__USING_SJLJ_EXCEPTIONS__)
|
||||
|
||||
#if defined(__i386__)
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv)
|
||||
#
|
||||
# void libunwind::Registers_x86::jumpto()
|
||||
#
|
||||
|
@ -60,7 +60,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv)
|
|||
|
||||
#elif defined(__x86_64__)
|
||||
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind16Registers_x86_646jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind16Registers_x86_646jumptoEv)
|
||||
#
|
||||
# void libunwind::Registers_x86_64::jumpto()
|
||||
#
|
||||
|
@ -129,7 +129,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind16Registers_x86_646jumptoEv)
|
|||
|
||||
#elif defined(__powerpc64__)
|
||||
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_ppc646jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_ppc646jumptoEv)
|
||||
//
|
||||
// void libunwind::Registers_ppc64::jumpto()
|
||||
//
|
||||
|
@ -394,7 +394,7 @@ Lnovec:
|
|||
|
||||
#elif defined(__ppc__)
|
||||
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
|
||||
;
|
||||
; void libunwind::Registers_ppc::jumpto()
|
||||
;
|
||||
|
@ -566,7 +566,7 @@ Lnovec:
|
|||
// thread_state pointer is in x0
|
||||
//
|
||||
.p2align 2
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
|
||||
// skip restore of x0,x1 for now
|
||||
ldp x2, x3, [x0, #0x010]
|
||||
ldp x4, x5, [x0, #0x020]
|
||||
|
@ -620,7 +620,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
|
|||
@ thread_state pointer is in r0
|
||||
@
|
||||
.p2align 2
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm20restoreCoreAndJumpToEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm20restoreCoreAndJumpToEv)
|
||||
#if !defined(__ARM_ARCH_ISA_ARM) && __ARM_ARCH_ISA_THUMB == 1
|
||||
@ r8-r11: ldm into r1-r4, then mov to r8-r11
|
||||
adds r0, #0x20
|
||||
|
@ -658,7 +658,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm20restoreCoreAndJu
|
|||
#if defined(__ELF__)
|
||||
.fpu vfpv3-d16
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPv)
|
||||
@ VFP and iwMMX instructions are only available when compiling with the flags
|
||||
@ that enable them. We do not want to do that in the library (because we do not
|
||||
@ want the compiler to generate instructions that access those) but this is
|
||||
|
@ -679,7 +679,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFL
|
|||
#if defined(__ELF__)
|
||||
.fpu vfpv3-d16
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPv)
|
||||
vldmia r0, {d0-d15} @ fldmiax is deprecated in ARMv7+ and now behaves like vldmia
|
||||
JMP(lr)
|
||||
|
||||
|
@ -693,7 +693,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFL
|
|||
#if defined(__ELF__)
|
||||
.fpu vfpv3
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPv)
|
||||
vldmia r0, {d16-d31}
|
||||
JMP(lr)
|
||||
|
||||
|
@ -709,7 +709,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPv)
|
|||
#if defined(__ELF__)
|
||||
.arch armv5te
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPv)
|
||||
ldcl p1, cr0, [r0], #8 @ wldrd wR0, [r0], #8
|
||||
ldcl p1, cr1, [r0], #8 @ wldrd wR1, [r0], #8
|
||||
ldcl p1, cr2, [r0], #8 @ wldrd wR2, [r0], #8
|
||||
|
@ -738,7 +738,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPv)
|
|||
#if defined(__ELF__)
|
||||
.arch armv5te
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj)
|
||||
ldc2 p1, cr8, [r0], #4 @ wldrw wCGR0, [r0], #4
|
||||
ldc2 p1, cr9, [r0], #4 @ wldrw wCGR1, [r0], #4
|
||||
ldc2 p1, cr10, [r0], #4 @ wldrw wCGR2, [r0], #4
|
||||
|
@ -749,7 +749,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreiWMMXCont
|
|||
|
||||
#elif defined(__or1k__)
|
||||
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Registers_or1k6jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind14Registers_or1k6jumptoEv)
|
||||
#
|
||||
# void libunwind::Registers_or1k::jumpto()
|
||||
#
|
||||
|
@ -808,7 +808,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Registers_or1k6jumptoEv)
|
|||
// On entry:
|
||||
// thread state pointer is in a0 ($4)
|
||||
//
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv)
|
||||
.set push
|
||||
.set noat
|
||||
.set noreorder
|
||||
|
@ -917,7 +917,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind18Registers_mips_o326jumptoEv)
|
|||
// On entry:
|
||||
// thread state pointer is in a0 ($4)
|
||||
//
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind21Registers_mips_newabi6jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind21Registers_mips_newabi6jumptoEv)
|
||||
.set push
|
||||
.set noat
|
||||
.set noreorder
|
||||
|
@ -1007,7 +1007,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind21Registers_mips_newabi6jumptoEv)
|
|||
// On entry:
|
||||
// thread_state pointer is in o0
|
||||
//
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_sparc6jumptoEv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_sparc6jumptoEv)
|
||||
ta 3
|
||||
ldd [%o0 + 64], %l0
|
||||
ldd [%o0 + 72], %l2
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#if defined(__i386__)
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# On entry:
|
||||
# + +
|
||||
|
@ -26,7 +26,7 @@
|
|||
# +-----------------------+ <-- SP
|
||||
# + +
|
||||
#
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
push %eax
|
||||
movl 8(%esp), %eax
|
||||
movl %ebx, 4(%eax)
|
||||
|
@ -56,12 +56,12 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#elif defined(__x86_64__)
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# On entry:
|
||||
# thread_state pointer is in rdi
|
||||
#
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
#if defined(_WIN64)
|
||||
#define PTR %rcx
|
||||
#define TMP %rdx
|
||||
|
@ -118,12 +118,12 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#elif defined(__mips__) && defined(_ABIO32) && _MIPS_SIM == _ABIO32
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# On entry:
|
||||
# thread_state pointer is in a0 ($4)
|
||||
#
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
.set push
|
||||
.set noat
|
||||
.set noreorder
|
||||
|
@ -227,12 +227,12 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#elif defined(__mips64)
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# On entry:
|
||||
# thread_state pointer is in a0 ($4)
|
||||
#
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
.set push
|
||||
.set noat
|
||||
.set noreorder
|
||||
|
@ -317,21 +317,21 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
# elif defined(__mips__)
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# Just trap for the time being.
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
teq $0, $0
|
||||
|
||||
#elif defined(__powerpc64__)
|
||||
|
||||
//
|
||||
// extern int unw_getcontext(unw_context_t* thread_state)
|
||||
// extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
//
|
||||
// On entry:
|
||||
// thread_state pointer is in r3
|
||||
//
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
|
||||
// store register (GPR)
|
||||
#define PPC64_STR(n) \
|
||||
|
@ -557,12 +557,12 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#elif defined(__ppc__)
|
||||
|
||||
;
|
||||
; extern int unw_getcontext(unw_context_t* thread_state)
|
||||
; extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
;
|
||||
; On entry:
|
||||
; thread_state pointer is in r3
|
||||
;
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
stw r0, 8(r3)
|
||||
mflr r0
|
||||
stw r0, 0(r3) ; store lr as ssr0
|
||||
|
@ -700,13 +700,13 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#elif defined(__arm64__) || defined(__aarch64__)
|
||||
|
||||
//
|
||||
// extern int unw_getcontext(unw_context_t* thread_state)
|
||||
// extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
//
|
||||
// On entry:
|
||||
// thread_state pointer is in x0
|
||||
//
|
||||
.p2align 2
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
stp x0, x1, [x0, #0x000]
|
||||
stp x2, x3, [x0, #0x010]
|
||||
stp x4, x5, [x0, #0x020]
|
||||
|
@ -754,7 +754,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#endif
|
||||
|
||||
@
|
||||
@ extern int unw_getcontext(unw_context_t* thread_state)
|
||||
@ extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
@
|
||||
@ On entry:
|
||||
@ thread_state pointer is in r0
|
||||
|
@ -763,10 +763,10 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
@ EHABI #7.4.5 notes that in general all VRS registers should be restored
|
||||
@ however this is very hard to do for VFP registers because it is unknown
|
||||
@ to the library how many registers are implemented by the architecture.
|
||||
@ Instead, VFP registers are demand saved by logic external to unw_getcontext.
|
||||
@ Instead, VFP registers are demand saved by logic external to __unw_getcontext.
|
||||
@
|
||||
.p2align 2
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
#if !defined(__ARM_ARCH_ISA_ARM) && __ARM_ARCH_ISA_THUMB == 1
|
||||
stm r0!, {r0-r7}
|
||||
mov r1, r8
|
||||
|
@ -807,7 +807,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#if defined(__ELF__)
|
||||
.fpu vfpv3-d16
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMDEPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMDEPv)
|
||||
vstmia r0, {d0-d15}
|
||||
JMP(lr)
|
||||
|
||||
|
@ -821,7 +821,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMD
|
|||
#if defined(__ELF__)
|
||||
.fpu vfpv3-d16
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMXEPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMXEPv)
|
||||
vstmia r0, {d0-d15} @ fstmiax is deprecated in ARMv7+ and now behaves like vstmia
|
||||
JMP(lr)
|
||||
|
||||
|
@ -835,7 +835,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMX
|
|||
#if defined(__ELF__)
|
||||
.fpu vfpv3
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPv)
|
||||
@ VFP and iwMMX instructions are only available when compiling with the flags
|
||||
@ that enable them. We do not want to do that in the library (because we do not
|
||||
@ want the compiler to generate instructions that access those) but this is
|
||||
|
@ -858,7 +858,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPv)
|
|||
#if defined(__ELF__)
|
||||
.arch armv5te
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPv)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPv)
|
||||
stcl p1, cr0, [r0], #8 @ wstrd wR0, [r0], #8
|
||||
stcl p1, cr1, [r0], #8 @ wstrd wR1, [r0], #8
|
||||
stcl p1, cr2, [r0], #8 @ wstrd wR2, [r0], #8
|
||||
|
@ -887,7 +887,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPv)
|
|||
#if defined(__ELF__)
|
||||
.arch armv5te
|
||||
#endif
|
||||
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveiWMMXControlEPj)
|
||||
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_arm16saveiWMMXControlEPj)
|
||||
stc2 p1, cr8, [r0], #4 @ wstrw wCGR0, [r0], #4
|
||||
stc2 p1, cr9, [r0], #4 @ wstrw wCGR1, [r0], #4
|
||||
stc2 p1, cr10, [r0], #4 @ wstrw wCGR2, [r0], #4
|
||||
|
@ -899,12 +899,12 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveiWMMXControl
|
|||
#elif defined(__or1k__)
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# On entry:
|
||||
# thread_state pointer is in r3
|
||||
#
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
l.sw 0(r3), r0
|
||||
l.sw 4(r3), r1
|
||||
l.sw 8(r3), r2
|
||||
|
@ -945,12 +945,12 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#elif defined(__sparc__)
|
||||
|
||||
#
|
||||
# extern int unw_getcontext(unw_context_t* thread_state)
|
||||
# extern int __unw_getcontext(unw_context_t* thread_state)
|
||||
#
|
||||
# On entry:
|
||||
# thread_state pointer is in o0
|
||||
#
|
||||
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
||||
DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
|
||||
ta 3
|
||||
add %o7, 8, %o7
|
||||
std %g0, [%o0 + 0]
|
||||
|
@ -974,4 +974,6 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
|
|||
#endif
|
||||
#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */
|
||||
|
||||
WEAK_ALIAS(__unw_getcontext, unw_getcontext)
|
||||
|
||||
NO_EXEC_STACK_DIRECTIVE
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
#define SYMBOL_IS_FUNC(name)
|
||||
#define EXPORT_SYMBOL(name)
|
||||
#define HIDDEN_SYMBOL(name) .private_extern name
|
||||
#define WEAK_SYMBOL(name) .weak_reference name
|
||||
#define WEAK_ALIAS(name, aliasname) \
|
||||
WEAK_SYMBOL(aliasname) SEPARATOR \
|
||||
SYMBOL_NAME(aliasname) = SYMBOL_NAME(name)
|
||||
|
||||
#define NO_EXEC_STACK_DIRECTIVE
|
||||
|
||||
#elif defined(__ELF__)
|
||||
|
@ -56,6 +61,10 @@
|
|||
#endif
|
||||
#define EXPORT_SYMBOL(name)
|
||||
#define HIDDEN_SYMBOL(name) .hidden name
|
||||
#define WEAK_SYMBOL(name) .weak name
|
||||
#define WEAK_ALIAS(name, aliasname) \
|
||||
WEAK_SYMBOL(aliasname) SEPARATOR \
|
||||
SYMBOL_NAME(aliasname) = SYMBOL_NAME(name)
|
||||
|
||||
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
|
||||
defined(__linux__)
|
||||
|
@ -71,9 +80,9 @@
|
|||
.scl 2 SEPARATOR \
|
||||
.type 32 SEPARATOR \
|
||||
.endef
|
||||
#define EXPORT_SYMBOL2(name) \
|
||||
.section .drectve,"yn" SEPARATOR \
|
||||
.ascii "-export:", #name, "\0" SEPARATOR \
|
||||
#define EXPORT_SYMBOL2(name) \
|
||||
.section .drectve,"yn" SEPARATOR \
|
||||
.ascii "-export:", #name, "\0" SEPARATOR \
|
||||
.text
|
||||
#if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define EXPORT_SYMBOL(name)
|
||||
|
@ -82,6 +91,23 @@
|
|||
#endif
|
||||
#define HIDDEN_SYMBOL(name)
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#define WEAK_ALIAS(name, aliasname) \
|
||||
.globl SYMBOL_NAME(aliasname) SEPARATOR \
|
||||
EXPORT_SYMBOL(aliasname) SEPARATOR \
|
||||
SYMBOL_NAME(aliasname) = SYMBOL_NAME(name)
|
||||
#else
|
||||
#define WEAK_ALIAS3(name, aliasname) \
|
||||
.section .drectve,"yn" SEPARATOR \
|
||||
.ascii "-alternatename:", #aliasname, "=", #name, "\0" SEPARATOR \
|
||||
.text
|
||||
#define WEAK_ALIAS2(name, aliasname) \
|
||||
WEAK_ALIAS3(name, aliasname)
|
||||
#define WEAK_ALIAS(name, aliasname) \
|
||||
EXPORT_SYMBOL(SYMBOL_NAME(aliasname)) SEPARATOR \
|
||||
WEAK_ALIAS2(SYMBOL_NAME(name), SYMBOL_NAME(aliasname))
|
||||
#endif
|
||||
|
||||
#define NO_EXEC_STACK_DIRECTIVE
|
||||
|
||||
#elif defined(__sparc__)
|
||||
|
@ -92,16 +118,10 @@
|
|||
|
||||
#endif
|
||||
|
||||
#define DEFINE_LIBUNWIND_FUNCTION(name) \
|
||||
.globl SYMBOL_NAME(name) SEPARATOR \
|
||||
EXPORT_SYMBOL(name) SEPARATOR \
|
||||
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
||||
SYMBOL_NAME(name):
|
||||
|
||||
#define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name) \
|
||||
.globl SYMBOL_NAME(name) SEPARATOR \
|
||||
HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
|
||||
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
||||
#define DEFINE_LIBUNWIND_FUNCTION(name) \
|
||||
.globl SYMBOL_NAME(name) SEPARATOR \
|
||||
HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \
|
||||
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
|
||||
SYMBOL_NAME(name):
|
||||
|
||||
#if defined(__arm__)
|
||||
|
|
|
@ -62,6 +62,36 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define STR(a) #a
|
||||
#define XSTR(a) STR(a)
|
||||
#define SYMBOL_NAME(name) XSTR(__USER_LABEL_PREFIX__) #name
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \
|
||||
__asm__(".globl " SYMBOL_NAME(aliasname)); \
|
||||
__asm__(SYMBOL_NAME(aliasname) " = " SYMBOL_NAME(name)); \
|
||||
_LIBUNWIND_EXPORT \
|
||||
extern "C" __typeof(name) aliasname __attribute__((weak_import));
|
||||
#elif defined(__ELF__)
|
||||
#define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \
|
||||
_LIBUNWIND_EXPORT \
|
||||
extern "C" __typeof(name) aliasname __attribute__((weak, alias(#name)));
|
||||
#elif defined(_WIN32)
|
||||
#if defined(__MINGW32__)
|
||||
#define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \
|
||||
_LIBUNWIND_EXPORT \
|
||||
extern "C" __typeof(name) aliasname __attribute__((alias(#name)));
|
||||
#else
|
||||
#define _LIBUNWIND_WEAK_ALIAS(name, aliasname) \
|
||||
__pragma(comment(linker, "/alternatename:" SYMBOL_NAME(aliasname) "=" \
|
||||
SYMBOL_NAME(name))) \
|
||||
_LIBUNWIND_EXPORT \
|
||||
extern "C" __typeof(name) aliasname;
|
||||
#endif
|
||||
#else
|
||||
#error Unsupported target
|
||||
#endif
|
||||
|
||||
#if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__)
|
||||
#define _LIBUNWIND_BUILD_SJLJ_APIS
|
||||
#endif
|
||||
|
|
|
@ -29,15 +29,11 @@ LocalAddressSpace LocalAddressSpace::sThisAddressSpace;
|
|||
_LIBUNWIND_EXPORT unw_addr_space_t unw_local_addr_space =
|
||||
(unw_addr_space_t)&LocalAddressSpace::sThisAddressSpace;
|
||||
|
||||
/// record the registers and stack position of the caller
|
||||
extern int unw_getcontext(unw_context_t *);
|
||||
// note: unw_getcontext() implemented in assembly
|
||||
|
||||
/// Create a cursor of a thread in this process given 'context' recorded by
|
||||
/// unw_getcontext().
|
||||
_LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
|
||||
unw_context_t *context) {
|
||||
_LIBUNWIND_TRACE_API("unw_init_local(cursor=%p, context=%p)",
|
||||
/// __unw_getcontext().
|
||||
_LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
|
||||
unw_context_t *context) {
|
||||
_LIBUNWIND_TRACE_API("__unw_init_local(cursor=%p, context=%p)",
|
||||
static_cast<void *>(cursor),
|
||||
static_cast<void *>(context));
|
||||
#if defined(__i386__)
|
||||
|
@ -75,11 +71,12 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
|
|||
|
||||
return UNW_ESUCCESS;
|
||||
}
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_init_local, unw_init_local)
|
||||
|
||||
/// Get value of specified register at cursor position in stack frame.
|
||||
_LIBUNWIND_EXPORT int unw_get_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_word_t *value) {
|
||||
_LIBUNWIND_TRACE_API("unw_get_reg(cursor=%p, regNum=%d, &value=%p)",
|
||||
_LIBUNWIND_HIDDEN int __unw_get_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_word_t *value) {
|
||||
_LIBUNWIND_TRACE_API("__unw_get_reg(cursor=%p, regNum=%d, &value=%p)",
|
||||
static_cast<void *>(cursor), regNum,
|
||||
static_cast<void *>(value));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
|
@ -89,12 +86,13 @@ _LIBUNWIND_EXPORT int unw_get_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
|||
}
|
||||
return UNW_EBADREG;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_get_reg, unw_get_reg)
|
||||
|
||||
/// Set value of specified register at cursor position in stack frame.
|
||||
_LIBUNWIND_EXPORT int unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_word_t value) {
|
||||
_LIBUNWIND_TRACE_API("unw_set_reg(cursor=%p, regNum=%d, value=0x%" PRIxPTR ")",
|
||||
_LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_word_t value) {
|
||||
_LIBUNWIND_TRACE_API("__unw_set_reg(cursor=%p, regNum=%d, value=0x%" PRIxPTR
|
||||
")",
|
||||
static_cast<void *>(cursor), regNum, value);
|
||||
typedef LocalAddressSpace::pint_t pint_t;
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
|
@ -120,12 +118,12 @@ _LIBUNWIND_EXPORT int unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
|||
}
|
||||
return UNW_EBADREG;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_set_reg, unw_set_reg)
|
||||
|
||||
/// Get value of specified float register at cursor position in stack frame.
|
||||
_LIBUNWIND_EXPORT int unw_get_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_fpreg_t *value) {
|
||||
_LIBUNWIND_TRACE_API("unw_get_fpreg(cursor=%p, regNum=%d, &value=%p)",
|
||||
_LIBUNWIND_HIDDEN int __unw_get_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_fpreg_t *value) {
|
||||
_LIBUNWIND_TRACE_API("__unw_get_fpreg(cursor=%p, regNum=%d, &value=%p)",
|
||||
static_cast<void *>(cursor), regNum,
|
||||
static_cast<void *>(value));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
|
@ -135,16 +133,16 @@ _LIBUNWIND_EXPORT int unw_get_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
|||
}
|
||||
return UNW_EBADREG;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_get_fpreg, unw_get_fpreg)
|
||||
|
||||
/// Set value of specified float register at cursor position in stack frame.
|
||||
_LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_fpreg_t value) {
|
||||
_LIBUNWIND_HIDDEN int __unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
||||
unw_fpreg_t value) {
|
||||
#if defined(_LIBUNWIND_ARM_EHABI)
|
||||
_LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)",
|
||||
_LIBUNWIND_TRACE_API("__unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)",
|
||||
static_cast<void *>(cursor), regNum, value);
|
||||
#else
|
||||
_LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%g)",
|
||||
_LIBUNWIND_TRACE_API("__unw_set_fpreg(cursor=%p, regNum=%d, value=%g)",
|
||||
static_cast<void *>(cursor), regNum, value);
|
||||
#endif
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
|
@ -154,20 +152,20 @@ _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
|||
}
|
||||
return UNW_EBADREG;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_set_fpreg, unw_set_fpreg)
|
||||
|
||||
/// Move cursor to next frame.
|
||||
_LIBUNWIND_EXPORT int unw_step(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("unw_step(cursor=%p)", static_cast<void *>(cursor));
|
||||
_LIBUNWIND_HIDDEN int __unw_step(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("__unw_step(cursor=%p)", static_cast<void *>(cursor));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
return co->step();
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_step, unw_step)
|
||||
|
||||
/// Get unwind info at cursor position in stack frame.
|
||||
_LIBUNWIND_EXPORT int unw_get_proc_info(unw_cursor_t *cursor,
|
||||
unw_proc_info_t *info) {
|
||||
_LIBUNWIND_TRACE_API("unw_get_proc_info(cursor=%p, &info=%p)",
|
||||
_LIBUNWIND_HIDDEN int __unw_get_proc_info(unw_cursor_t *cursor,
|
||||
unw_proc_info_t *info) {
|
||||
_LIBUNWIND_TRACE_API("__unw_get_proc_info(cursor=%p, &info=%p)",
|
||||
static_cast<void *>(cursor), static_cast<void *>(info));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
co->getInfo(info);
|
||||
|
@ -176,21 +174,21 @@ _LIBUNWIND_EXPORT int unw_get_proc_info(unw_cursor_t *cursor,
|
|||
else
|
||||
return UNW_ESUCCESS;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_get_proc_info, unw_get_proc_info)
|
||||
|
||||
/// Resume execution at cursor position (aka longjump).
|
||||
_LIBUNWIND_EXPORT int unw_resume(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("unw_resume(cursor=%p)", static_cast<void *>(cursor));
|
||||
_LIBUNWIND_HIDDEN int __unw_resume(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("__unw_resume(cursor=%p)", static_cast<void *>(cursor));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
co->jumpto();
|
||||
return UNW_EUNSPEC;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_resume, unw_resume)
|
||||
|
||||
/// Get name of function at cursor position in stack frame.
|
||||
_LIBUNWIND_EXPORT int unw_get_proc_name(unw_cursor_t *cursor, char *buf,
|
||||
size_t bufLen, unw_word_t *offset) {
|
||||
_LIBUNWIND_TRACE_API("unw_get_proc_name(cursor=%p, &buf=%p, bufLen=%lu)",
|
||||
_LIBUNWIND_HIDDEN int __unw_get_proc_name(unw_cursor_t *cursor, char *buf,
|
||||
size_t bufLen, unw_word_t *offset) {
|
||||
_LIBUNWIND_TRACE_API("__unw_get_proc_name(cursor=%p, &buf=%p, bufLen=%lu)",
|
||||
static_cast<void *>(cursor), static_cast<void *>(buf),
|
||||
static_cast<unsigned long>(bufLen));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
|
@ -199,58 +197,62 @@ _LIBUNWIND_EXPORT int unw_get_proc_name(unw_cursor_t *cursor, char *buf,
|
|||
else
|
||||
return UNW_EUNSPEC;
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_get_proc_name, unw_get_proc_name)
|
||||
|
||||
/// Checks if a register is a floating-point register.
|
||||
_LIBUNWIND_EXPORT int unw_is_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum) {
|
||||
_LIBUNWIND_TRACE_API("unw_is_fpreg(cursor=%p, regNum=%d)",
|
||||
_LIBUNWIND_HIDDEN int __unw_is_fpreg(unw_cursor_t *cursor,
|
||||
unw_regnum_t regNum) {
|
||||
_LIBUNWIND_TRACE_API("__unw_is_fpreg(cursor=%p, regNum=%d)",
|
||||
static_cast<void *>(cursor), regNum);
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
return co->validFloatReg(regNum);
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_is_fpreg, unw_is_fpreg)
|
||||
|
||||
/// Checks if a register is a floating-point register.
|
||||
_LIBUNWIND_EXPORT const char *unw_regname(unw_cursor_t *cursor,
|
||||
unw_regnum_t regNum) {
|
||||
_LIBUNWIND_TRACE_API("unw_regname(cursor=%p, regNum=%d)",
|
||||
_LIBUNWIND_HIDDEN const char *__unw_regname(unw_cursor_t *cursor,
|
||||
unw_regnum_t regNum) {
|
||||
_LIBUNWIND_TRACE_API("__unw_regname(cursor=%p, regNum=%d)",
|
||||
static_cast<void *>(cursor), regNum);
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
return co->getRegisterName(regNum);
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_regname, unw_regname)
|
||||
|
||||
/// Checks if current frame is signal trampoline.
|
||||
_LIBUNWIND_EXPORT int unw_is_signal_frame(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("unw_is_signal_frame(cursor=%p)",
|
||||
_LIBUNWIND_HIDDEN int __unw_is_signal_frame(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("__unw_is_signal_frame(cursor=%p)",
|
||||
static_cast<void *>(cursor));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
return co->isSignalFrame();
|
||||
}
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_is_signal_frame, unw_is_signal_frame)
|
||||
|
||||
#ifdef __arm__
|
||||
// Save VFP registers d0-d15 using FSTMIADX instead of FSTMIADD
|
||||
_LIBUNWIND_EXPORT void unw_save_vfp_as_X(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("unw_fpreg_save_vfp_as_X(cursor=%p)",
|
||||
_LIBUNWIND_HIDDEN void __unw_save_vfp_as_X(unw_cursor_t *cursor) {
|
||||
_LIBUNWIND_TRACE_API("__unw_get_fpreg_save_vfp_as_X(cursor=%p)",
|
||||
static_cast<void *>(cursor));
|
||||
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
|
||||
return co->saveVFPAsX();
|
||||
}
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_save_vfp_as_X, unw_save_cfp_as_X)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
|
||||
/// SPI: walks cached DWARF entries
|
||||
_LIBUNWIND_EXPORT void unw_iterate_dwarf_unwind_cache(void (*func)(
|
||||
_LIBUNWIND_HIDDEN void __unw_iterate_dwarf_unwind_cache(void (*func)(
|
||||
unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh)) {
|
||||
_LIBUNWIND_TRACE_API("unw_iterate_dwarf_unwind_cache(func=%p)",
|
||||
_LIBUNWIND_TRACE_API("__unw_iterate_dwarf_unwind_cache(func=%p)",
|
||||
reinterpret_cast<void *>(func));
|
||||
DwarfFDECache<LocalAddressSpace>::iterateCacheEntries(func);
|
||||
}
|
||||
|
||||
_LIBUNWIND_WEAK_ALIAS(__unw_iterate_dwarf_unwind_cache,
|
||||
unw_iterate_dwarf_unwind_cache)
|
||||
|
||||
/// IPI: for __register_frame()
|
||||
void _unw_add_dynamic_fde(unw_word_t fde) {
|
||||
void __unw_add_dynamic_fde(unw_word_t fde) {
|
||||
CFI_Parser<LocalAddressSpace>::FDE_Info fdeInfo;
|
||||
CFI_Parser<LocalAddressSpace>::CIE_Info cieInfo;
|
||||
const char *message = CFI_Parser<LocalAddressSpace>::decodeFDE(
|
||||
|
@ -264,12 +266,12 @@ void _unw_add_dynamic_fde(unw_word_t fde) {
|
|||
fdeInfo.pcStart, fdeInfo.pcEnd,
|
||||
fdeInfo.fdeStart);
|
||||
} else {
|
||||
_LIBUNWIND_DEBUG_LOG("_unw_add_dynamic_fde: bad fde: %s", message);
|
||||
_LIBUNWIND_DEBUG_LOG("__unw_add_dynamic_fde: bad fde: %s", message);
|
||||
}
|
||||
}
|
||||
|
||||
/// IPI: for __deregister_frame()
|
||||
void _unw_remove_dynamic_fde(unw_word_t fde) {
|
||||
void __unw_remove_dynamic_fde(unw_word_t fde) {
|
||||
// fde is own mh_group
|
||||
DwarfFDECache<LocalAddressSpace>::removeAllIn((LocalAddressSpace::pint_t)fde);
|
||||
}
|
||||
|
|
|
@ -22,15 +22,34 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int __unw_getcontext(unw_context_t *);
|
||||
extern int __unw_init_local(unw_cursor_t *, unw_context_t *);
|
||||
extern int __unw_step(unw_cursor_t *);
|
||||
extern int __unw_get_reg(unw_cursor_t *, unw_regnum_t, unw_word_t *);
|
||||
extern int __unw_get_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t *);
|
||||
extern int __unw_set_reg(unw_cursor_t *, unw_regnum_t, unw_word_t);
|
||||
extern int __unw_set_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t);
|
||||
extern int __unw_resume(unw_cursor_t *);
|
||||
|
||||
#ifdef __arm__
|
||||
/* Save VFP registers in FSTMX format (instead of FSTMD). */
|
||||
extern void __unw_save_vfp_as_X(unw_cursor_t *);
|
||||
#endif
|
||||
|
||||
extern const char *__unw_regname(unw_cursor_t *, unw_regnum_t);
|
||||
extern int __unw_get_proc_info(unw_cursor_t *, unw_proc_info_t *);
|
||||
extern int __unw_is_fpreg(unw_cursor_t *, unw_regnum_t);
|
||||
extern int __unw_is_signal_frame(unw_cursor_t *);
|
||||
extern int __unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *);
|
||||
|
||||
// SPI
|
||||
extern void unw_iterate_dwarf_unwind_cache(void (*func)(unw_word_t ip_start,
|
||||
unw_word_t ip_end,
|
||||
unw_word_t fde,
|
||||
unw_word_t mh));
|
||||
extern void __unw_iterate_dwarf_unwind_cache(void (*func)(
|
||||
unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh));
|
||||
|
||||
// IPI
|
||||
extern void _unw_add_dynamic_fde(unw_word_t fde);
|
||||
extern void _unw_remove_dynamic_fde(unw_word_t fde);
|
||||
extern void __unw_add_dynamic_fde(unw_word_t fde);
|
||||
extern void __unw_remove_dynamic_fde(unw_word_t fde);
|
||||
|
||||
#if defined(_LIBUNWIND_ARM_EHABI)
|
||||
extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*);
|
||||
|
|
Loading…
Reference in New Issue