libunwind: consistently add \n to log and trace messages

Previously most messages included a newline in the string, but a few of
them were missing. Fix these and simplify by just adding the newline in
the _LIBUNWIND_LOG macro itself.

While here correct 'libuwind' typo (missing 'n').

Upstream LLVM libunwind commits r280086 and r280103.
This commit is contained in:
emaste 2016-10-28 00:04:04 +00:00
parent 46d7e8f428
commit 63b87fecb9
11 changed files with 149 additions and 149 deletions

View File

@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
// //
// Compatible with libuwind API documented at: // Compatible with libunwind API documented at:
// http://www.nongnu.org/libunwind/man/libunwind(3).html // http://www.nongnu.org/libunwind/man/libunwind(3).html
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -120,7 +120,7 @@ extern int unw_init_remote_thread(unw_cursor_t *, unw_addr_space_t, thread_t *);
#endif /* UNW_REMOTE */ #endif /* UNW_REMOTE */
/* /*
* traditional libuwind "remote" API * traditional libunwind "remote" API
* NOT IMPLEMENTED on Mac OS X * NOT IMPLEMENTED on Mac OS X
* *
* extern int unw_init_remote(unw_cursor_t*, unw_addr_space_t, * extern int unw_init_remote(unw_cursor_t*, unw_addr_space_t,

View File

@ -374,7 +374,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
(_Unwind_Ptr) targetAddr, &length); (_Unwind_Ptr) targetAddr, &length);
info.arm_section_length = (uintptr_t)length; info.arm_section_length = (uintptr_t)length;
#endif #endif
_LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x\n", _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
info.arm_section, info.arm_section_length); info.arm_section, info.arm_section_length);
if (info.arm_section && info.arm_section_length) if (info.arm_section && info.arm_section_length)
return true; return true;

View File

@ -105,7 +105,7 @@ int CompactUnwinder_x86<A>::stepWithCompactEncodingEBPFrame(
default: default:
(void)functionStart; (void)functionStart;
_LIBUNWIND_DEBUG_LOG("bad register for EBP frame, encoding=%08X for " _LIBUNWIND_DEBUG_LOG("bad register for EBP frame, encoding=%08X for "
"function starting at 0x%X\n", "function starting at 0x%X",
compactEncoding, functionStart); compactEncoding, functionStart);
_LIBUNWIND_ABORT("invalid compact unwind encoding"); _LIBUNWIND_ABORT("invalid compact unwind encoding");
} }
@ -224,7 +224,7 @@ int CompactUnwinder_x86<A>::stepWithCompactEncodingFrameless(
break; break;
default: default:
_LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for " _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for "
"function starting at 0x%X\n", "function starting at 0x%X",
encoding, functionStart); encoding, functionStart);
_LIBUNWIND_ABORT("invalid compact unwind encoding"); _LIBUNWIND_ABORT("invalid compact unwind encoding");
} }
@ -336,7 +336,7 @@ int CompactUnwinder_x86_64<A>::stepWithCompactEncodingRBPFrame(
default: default:
(void)functionStart; (void)functionStart;
_LIBUNWIND_DEBUG_LOG("bad register for RBP frame, encoding=%08X for " _LIBUNWIND_DEBUG_LOG("bad register for RBP frame, encoding=%08X for "
"function starting at 0x%llX\n", "function starting at 0x%llX",
compactEncoding, functionStart); compactEncoding, functionStart);
_LIBUNWIND_ABORT("invalid compact unwind encoding"); _LIBUNWIND_ABORT("invalid compact unwind encoding");
} }
@ -455,7 +455,7 @@ int CompactUnwinder_x86_64<A>::stepWithCompactEncodingFrameless(
break; break;
default: default:
_LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for " _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for "
"function starting at 0x%llX\n", "function starting at 0x%llX",
encoding, functionStart); encoding, functionStart);
_LIBUNWIND_ABORT("invalid compact unwind encoding"); _LIBUNWIND_ABORT("invalid compact unwind encoding");
} }

View File

@ -85,7 +85,7 @@ bool EHHeaderParser<A>::decodeTableEntry(
const char *message = const char *message =
CFI_Parser<A>::decodeFDE(addressSpace, fde, fdeInfo, cieInfo); CFI_Parser<A>::decodeFDE(addressSpace, fde, fdeInfo, cieInfo);
if (message != NULL) { if (message != NULL) {
_LIBUNWIND_DEBUG_LOG("EHHeaderParser::decodeTableEntry: bad fde: %s\n", _LIBUNWIND_DEBUG_LOG("EHHeaderParser::decodeTableEntry: bad fde: %s",
message); message);
return false; return false;
} }

View File

@ -454,7 +454,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_proc_info_t frameInfo; unw_proc_info_t frameInfo;
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n", "failed => _URC_FATAL_PHASE1_ERROR",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
@ -472,7 +472,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_get_reg(cursor, UNW_REG_IP, &pc); unw_get_reg(cursor, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, " "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
"lsda=0x%llX, personality=0x%llX\n", "lsda=0x%llX, personality=0x%llX",
static_cast<void *>(exception_object), (long long)pc, static_cast<void *>(exception_object), (long long)pc,
(long long)frameInfo.start_ip, functionName, (long long)frameInfo.start_ip, functionName,
(long long)frameInfo.lsda, (long long)frameInfo.handler); (long long)frameInfo.lsda, (long long)frameInfo.handler);
@ -484,7 +484,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
__personality_routine p = __personality_routine p =
(__personality_routine)(long)(frameInfo.handler); (__personality_routine)(long)(frameInfo.handler);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): calling personality function %p\n", "unwind_phase1(ex_ojb=%p): calling personality function %p",
static_cast<void *>(exception_object), static_cast<void *>(exception_object),
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(p))); reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(p)));
struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor); struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
@ -496,7 +496,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
(*p)(_US_VIRTUAL_UNWIND_FRAME, exception_object, context); (*p)(_US_VIRTUAL_UNWIND_FRAME, exception_object, context);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): personality result %d start_ip %x ehtp %p " "unwind_phase1(ex_ojb=%p): personality result %d start_ip %x ehtp %p "
"additional %x\n", "additional %x",
static_cast<void *>(exception_object), personalityResult, static_cast<void *>(exception_object), personalityResult,
exception_object->pr_cache.fnstart, exception_object->pr_cache.fnstart,
static_cast<void *>(exception_object->pr_cache.ehtp), static_cast<void *>(exception_object->pr_cache.ehtp),
@ -508,13 +508,13 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
handlerNotFound = false; handlerNotFound = false;
// p should have initialized barrier_cache. EHABI #7.3.5 // p should have initialized barrier_cache. EHABI #7.3.5
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n", "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
return _URC_NO_REASON; return _URC_NO_REASON;
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
// continue unwinding // continue unwinding
break; break;
@ -526,7 +526,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
default: default:
// something went wrong // something went wrong
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n", "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
@ -541,13 +541,13 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
// See comment at the start of unwind_phase1 regarding VRS integrity. // 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)\n", _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
int frame_count = 0; int frame_count = 0;
// Walk each frame until we reach where search phase said to stop. // Walk each frame until we reach where search phase said to stop.
while (true) { while (true) {
// Ask libuwind to get next frame (skip over first which is // Ask libunwind to get next frame (skip over first which is
// _Unwind_RaiseException or _Unwind_Resume). // _Unwind_RaiseException or _Unwind_Resume).
// //
// Resume only ever makes sense for 1 frame. // Resume only ever makes sense for 1 frame.
@ -572,7 +572,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
unw_get_reg(cursor, UNW_REG_SP, &sp); unw_get_reg(cursor, UNW_REG_SP, &sp);
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE2_ERROR\n", "failed => _URC_FATAL_PHASE2_ERROR",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -588,7 +588,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
functionName = ".anonymous."; functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, " "unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, "
"lsda=0x%llX, personality=0x%llX\n", "lsda=0x%llX, personality=0x%llX",
static_cast<void *>(exception_object), (long long)frameInfo.start_ip, static_cast<void *>(exception_object), (long long)frameInfo.start_ip,
functionName, (long long)sp, (long long)frameInfo.lsda, functionName, (long long)sp, (long long)frameInfo.lsda,
(long long)frameInfo.handler); (long long)frameInfo.handler);
@ -610,7 +610,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
// Continue unwinding // Continue unwinding
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
// EHABI #7.2 // EHABI #7.2
if (sp == exception_object->barrier_cache.sp) { if (sp == exception_object->barrier_cache.sp) {
@ -621,7 +621,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
break; break;
case _URC_INSTALL_CONTEXT: case _URC_INSTALL_CONTEXT:
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT\n", "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
// Personality routine says to transfer control to landing pad. // Personality routine says to transfer control to landing pad.
// We may get control back if landing pad calls _Unwind_Resume(). // We may get control back if landing pad calls _Unwind_Resume().
@ -630,7 +630,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
unw_get_reg(cursor, UNW_REG_IP, &pc); unw_get_reg(cursor, UNW_REG_IP, &pc);
unw_get_reg(cursor, UNW_REG_SP, &sp); unw_get_reg(cursor, UNW_REG_SP, &sp);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
"user code with ip=0x%llX, sp=0x%llX\n", "user code with ip=0x%llX, sp=0x%llX",
static_cast<void *>(exception_object), static_cast<void *>(exception_object),
(long long)pc, (long long)sp); (long long)pc, (long long)sp);
} }
@ -668,7 +668,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor
/// Called by __cxa_throw. Only returns if there is a fatal error. /// Called by __cxa_throw. Only returns if there is a fatal error.
_LIBUNWIND_EXPORT _Unwind_Reason_Code _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_RaiseException(_Unwind_Exception *exception_object) { _Unwind_RaiseException(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
unw_context_t uc; unw_context_t uc;
unw_cursor_t cursor; unw_cursor_t cursor;
@ -706,7 +706,7 @@ _LIBUNWIND_EXPORT void _Unwind_Complete(_Unwind_Exception* exception_object) {
/// in turn calls _Unwind_Resume_or_Rethrow(). /// in turn calls _Unwind_Resume_or_Rethrow().
_LIBUNWIND_EXPORT void _LIBUNWIND_EXPORT void
_Unwind_Resume(_Unwind_Exception *exception_object) { _Unwind_Resume(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
unw_context_t uc; unw_context_t uc;
unw_cursor_t cursor; unw_cursor_t cursor;
@ -730,7 +730,7 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS) if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
result = (uintptr_t)frameInfo.lsda; result = (uintptr_t)frameInfo.lsda;
_LIBUNWIND_TRACE_API( _LIBUNWIND_TRACE_API(
"_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx\n", "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx",
static_cast<void *>(context), (long long)result); static_cast<void *>(context), (long long)result);
return result; return result;
} }
@ -758,7 +758,7 @@ _Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
uint32_t regno, _Unwind_VRS_DataRepresentation representation, uint32_t regno, _Unwind_VRS_DataRepresentation representation,
void *valuep) { void *valuep) {
_LIBUNWIND_TRACE_API("_Unwind_VRS_Set(context=%p, regclass=%d, reg=%d, " _LIBUNWIND_TRACE_API("_Unwind_VRS_Set(context=%p, regclass=%d, reg=%d, "
"rep=%d, value=0x%llX)\n", "rep=%d, value=0x%llX)",
static_cast<void *>(context), regclass, regno, static_cast<void *>(context), regclass, regno,
representation, representation,
ValueAsBitPattern(representation, valuep)); ValueAsBitPattern(representation, valuep));
@ -863,7 +863,7 @@ _Unwind_VRS_Result _Unwind_VRS_Get(
_Unwind_VRS_Get_Internal(context, regclass, regno, representation, _Unwind_VRS_Get_Internal(context, regclass, regno, representation,
valuep); valuep);
_LIBUNWIND_TRACE_API("_Unwind_VRS_Get(context=%p, regclass=%d, reg=%d, " _LIBUNWIND_TRACE_API("_Unwind_VRS_Get(context=%p, regclass=%d, reg=%d, "
"rep=%d, value=0x%llX, result = %d)\n", "rep=%d, value=0x%llX, result = %d)",
static_cast<void *>(context), regclass, regno, static_cast<void *>(context), regclass, regno,
representation, representation,
ValueAsBitPattern(representation, valuep), result); ValueAsBitPattern(representation, valuep), result);
@ -875,7 +875,7 @@ _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
uint32_t discriminator, uint32_t discriminator,
_Unwind_VRS_DataRepresentation representation) { _Unwind_VRS_DataRepresentation representation) {
_LIBUNWIND_TRACE_API("_Unwind_VRS_Pop(context=%p, regclass=%d, " _LIBUNWIND_TRACE_API("_Unwind_VRS_Pop(context=%p, regclass=%d, "
"discriminator=%d, representation=%d)\n", "discriminator=%d, representation=%d)",
static_cast<void *>(context), regclass, discriminator, static_cast<void *>(context), regclass, discriminator,
representation); representation);
switch (regclass) { switch (regclass) {
@ -948,7 +948,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
uintptr_t result = 0; 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; result = (uintptr_t)frameInfo.start_ip;
_LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX\n", _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX",
static_cast<void *>(context), (long long)result); static_cast<void *>(context), (long long)result);
return result; return result;
} }
@ -958,7 +958,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
// is caught. // is caught.
_LIBUNWIND_EXPORT void _LIBUNWIND_EXPORT void
_Unwind_DeleteException(_Unwind_Exception *exception_object) { _Unwind_DeleteException(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)",
static_cast<void *>(exception_object)); static_cast<void *>(exception_object));
if (exception_object->exception_cleanup != NULL) if (exception_object->exception_cleanup != NULL)
(*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT, (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,

View File

@ -72,7 +72,7 @@ _Unwind_SjLj_Unregister(struct _Unwind_FunctionContext *fc) {
static _Unwind_Reason_Code static _Unwind_Reason_Code
unwind_phase1(struct _Unwind_Exception *exception_object) { unwind_phase1(struct _Unwind_Exception *exception_object) {
_Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack(); _Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack();
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p\n", c); _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p", c);
// walk each frame looking for a place to stop // walk each frame looking for a place to stop
for (bool handlerNotFound = true; handlerNotFound; c = c->prev) { for (bool handlerNotFound = true; handlerNotFound; c = c->prev) {
@ -80,17 +80,17 @@ unwind_phase1(struct _Unwind_Exception *exception_object) {
// check for no more frames // check for no more frames
if (c == NULL) { if (c == NULL) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): reached " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): reached "
"bottom => _URC_END_OF_STACK\n", "bottom => _URC_END_OF_STACK",
exception_object); exception_object);
return _URC_END_OF_STACK; return _URC_END_OF_STACK;
} }
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p\n", c); _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p", c);
// if there is a personality routine, ask it if it will want to stop at this // if there is a personality routine, ask it if it will want to stop at this
// frame // frame
if (c->personality != NULL) { if (c->personality != NULL) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): calling " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): calling "
"personality function %p\n", "personality function %p",
exception_object, c->personality); exception_object, c->personality);
_Unwind_Reason_Code personalityResult = (*c->personality)( _Unwind_Reason_Code personalityResult = (*c->personality)(
1, _UA_SEARCH_PHASE, exception_object->exception_class, 1, _UA_SEARCH_PHASE, exception_object->exception_class,
@ -102,19 +102,19 @@ unwind_phase1(struct _Unwind_Exception *exception_object) {
handlerNotFound = false; handlerNotFound = false;
exception_object->private_2 = (uintptr_t) c; exception_object->private_2 = (uintptr_t) c;
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): "
"_URC_HANDLER_FOUND\n", exception_object); "_URC_HANDLER_FOUND", exception_object);
return _URC_NO_REASON; return _URC_NO_REASON;
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): "
"_URC_CONTINUE_UNWIND\n", exception_object); "_URC_CONTINUE_UNWIND", exception_object);
// continue unwinding // continue unwinding
break; break;
default: default:
// something went wrong // something went wrong
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n", "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR",
exception_object); exception_object);
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
@ -126,18 +126,18 @@ unwind_phase1(struct _Unwind_Exception *exception_object) {
static _Unwind_Reason_Code static _Unwind_Reason_Code
unwind_phase2(struct _Unwind_Exception *exception_object) { unwind_phase2(struct _Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n", exception_object); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)", exception_object);
// walk each frame until we reach where search phase said to stop // walk each frame until we reach where search phase said to stop
_Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack(); _Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack();
while (true) { while (true) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2s(ex_ojb=%p): context=%p\n", _LIBUNWIND_TRACE_UNWINDING("unwind_phase2s(ex_ojb=%p): context=%p",
exception_object, c); exception_object, c);
// check for no more frames // check for no more frames
if (c == NULL) { if (c == NULL) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n", "bottom => _URC_END_OF_STACK",
exception_object); exception_object);
return _URC_END_OF_STACK; return _URC_END_OF_STACK;
} }
@ -157,7 +157,7 @@ unwind_phase2(struct _Unwind_Exception *exception_object) {
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
// continue unwinding // continue unwinding
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND",
exception_object); exception_object);
if ((uintptr_t) c == exception_object->private_2) { if ((uintptr_t) c == exception_object->private_2) {
// phase 1 said we would stop at this frame, but we did not... // phase 1 said we would stop at this frame, but we did not...
@ -168,7 +168,7 @@ unwind_phase2(struct _Unwind_Exception *exception_object) {
case _URC_INSTALL_CONTEXT: case _URC_INSTALL_CONTEXT:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): "
"_URC_INSTALL_CONTEXT, will resume at " "_URC_INSTALL_CONTEXT, will resume at "
"landing pad %p\n", "landing pad %p",
exception_object, c->jbuf[1]); exception_object, c->jbuf[1]);
// personality routine says to transfer control to landing pad // personality routine says to transfer control to landing pad
// we may get control back if landing pad calls _Unwind_Resume() // we may get control back if landing pad calls _Unwind_Resume()
@ -202,7 +202,7 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
// get next frame (skip over first which is _Unwind_RaiseException) // get next frame (skip over first which is _Unwind_RaiseException)
if (c == NULL) { if (c == NULL) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n", "bottom => _URC_END_OF_STACK",
exception_object); exception_object);
return _URC_END_OF_STACK; return _URC_END_OF_STACK;
} }
@ -214,11 +214,11 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
(*stop)(1, action, exception_object->exception_class, exception_object, (*stop)(1, action, exception_object->exception_class, exception_object,
(struct _Unwind_Context *)c, stop_parameter); (struct _Unwind_Context *)c, stop_parameter);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"stop function returned %d\n", "stop function returned %d",
exception_object, stopResult); exception_object, stopResult);
if (stopResult != _URC_NO_REASON) { if (stopResult != _URC_NO_REASON) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"stopped by stop function\n", "stopped by stop function",
exception_object); exception_object);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -227,7 +227,7 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
if (c->personality != NULL) { if (c->personality != NULL) {
__personality_routine p = (__personality_routine) c->personality; __personality_routine p = (__personality_routine) c->personality;
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"calling personality function %p\n", "calling personality function %p",
exception_object, p); exception_object, p);
_Unwind_Reason_Code personalityResult = _Unwind_Reason_Code personalityResult =
(*p)(1, action, exception_object->exception_class, exception_object, (*p)(1, action, exception_object->exception_class, exception_object,
@ -235,13 +235,13 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
switch (personalityResult) { switch (personalityResult) {
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"personality returned _URC_CONTINUE_UNWIND\n", "personality returned _URC_CONTINUE_UNWIND",
exception_object); exception_object);
// destructors called, continue unwinding // destructors called, continue unwinding
break; break;
case _URC_INSTALL_CONTEXT: case _URC_INSTALL_CONTEXT:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"personality returned _URC_INSTALL_CONTEXT\n", "personality returned _URC_INSTALL_CONTEXT",
exception_object); exception_object);
// we may get control back if landing pad calls _Unwind_Resume() // we may get control back if landing pad calls _Unwind_Resume()
__Unwind_SjLj_SetTopOfFunctionStack(c); __Unwind_SjLj_SetTopOfFunctionStack(c);
@ -251,7 +251,7 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
// something went wrong // something went wrong
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"personality returned %d, " "personality returned %d, "
"_URC_FATAL_PHASE2_ERROR\n", "_URC_FATAL_PHASE2_ERROR",
exception_object, personalityResult); exception_object, personalityResult);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -262,7 +262,7 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
// call stop function one last time and tell it we've reached the end of the // call stop function one last time and tell it we've reached the end of the
// stack // stack
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): calling stop " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): calling stop "
"function with _UA_END_OF_STACK\n", "function with _UA_END_OF_STACK",
exception_object); exception_object);
_Unwind_Action lastAction = _Unwind_Action lastAction =
(_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE | _UA_END_OF_STACK); (_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE | _UA_END_OF_STACK);
@ -278,7 +278,7 @@ unwind_phase2_forced(struct _Unwind_Exception *exception_object,
/// Called by __cxa_throw. Only returns if there is a fatal error /// Called by __cxa_throw. Only returns if there is a fatal error
_LIBUNWIND_EXPORT _Unwind_Reason_Code _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object) { _Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_SjLj_RaiseException(ex_obj=%p)\n", exception_object); _LIBUNWIND_TRACE_API("_Unwind_SjLj_RaiseException(ex_obj=%p)", exception_object);
// mark that this is a non-forced unwind, so _Unwind_Resume() can do the right // mark that this is a non-forced unwind, so _Unwind_Resume() can do the right
// thing // thing
@ -308,7 +308,7 @@ _Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object) {
/// __cxa_rethrow() which in turn calls _Unwind_Resume_or_Rethrow() /// __cxa_rethrow() which in turn calls _Unwind_Resume_or_Rethrow()
_LIBUNWIND_EXPORT void _LIBUNWIND_EXPORT void
_Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object) { _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_SjLj_Resume(ex_obj=%p)\n", exception_object); _LIBUNWIND_TRACE_API("_Unwind_SjLj_Resume(ex_obj=%p)", exception_object);
if (exception_object->private_1 != 0) if (exception_object->private_1 != 0)
unwind_phase2_forced(exception_object, unwind_phase2_forced(exception_object,
@ -326,7 +326,7 @@ _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object) {
_LIBUNWIND_EXPORT _Unwind_Reason_Code _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object) { _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("__Unwind_SjLj_Resume_or_Rethrow(ex_obj=%p), " _LIBUNWIND_TRACE_API("__Unwind_SjLj_Resume_or_Rethrow(ex_obj=%p), "
"private_1=%ld\n", "private_1=%ld",
exception_object, exception_object->private_1); exception_object, exception_object->private_1);
// If this is non-forced and a stopping place was found, then this is a // If this is non-forced and a stopping place was found, then this is a
// re-throw. // re-throw.
@ -350,7 +350,7 @@ _LIBUNWIND_EXPORT uintptr_t
_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) { _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
_LIBUNWIND_TRACE_API("_Unwind_GetLanguageSpecificData(context=%p) " _LIBUNWIND_TRACE_API("_Unwind_GetLanguageSpecificData(context=%p) "
"=> 0x%0lX\n", context, ufc->lsda); "=> 0x%0lX", context, ufc->lsda);
return ufc->lsda; return ufc->lsda;
} }
@ -358,7 +358,7 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
/// Called by personality handler during phase 2 to get register values. /// Called by personality handler during phase 2 to get register values.
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, _LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct _Unwind_Context *context,
int index) { int index) {
_LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d)\n", _LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d)",
context, index); context, index);
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
return ufc->resumeParameters[index]; return ufc->resumeParameters[index];
@ -368,7 +368,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetGR(struct _Unwind_Context *context,
/// Called by personality handler during phase 2 to alter register values. /// Called by personality handler during phase 2 to alter register values.
_LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index, _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,
uintptr_t new_value) { uintptr_t new_value) {
_LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0lX)\n" _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0lX)"
, context, index, new_value); , context, index, new_value);
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
ufc->resumeParameters[index] = new_value; ufc->resumeParameters[index] = new_value;
@ -378,7 +378,7 @@ _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,
/// Called by personality handler during phase 2 to get instruction pointer. /// Called by personality handler during phase 2 to get instruction pointer.
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) { _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
_LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%lX\n", context, _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%lX", context,
ufc->resumeLocation + 1); ufc->resumeLocation + 1);
return ufc->resumeLocation + 1; return ufc->resumeLocation + 1;
} }
@ -391,7 +391,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
int *ipBefore) { int *ipBefore) {
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
*ipBefore = 0; *ipBefore = 0;
_LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%lX\n", _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p, %p) => 0x%lX",
context, ipBefore, ufc->resumeLocation + 1); context, ipBefore, ufc->resumeLocation + 1);
return ufc->resumeLocation + 1; return ufc->resumeLocation + 1;
} }
@ -400,7 +400,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
/// Called by personality handler during phase 2 to alter instruction pointer. /// Called by personality handler during phase 2 to alter instruction pointer.
_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context, _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
uintptr_t new_value) { uintptr_t new_value) {
_LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0lX)\n", _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0lX)",
context, new_value); context, new_value);
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
ufc->resumeLocation = new_value - 1; ufc->resumeLocation = new_value - 1;
@ -413,7 +413,7 @@ _LIBUNWIND_EXPORT uintptr_t
_Unwind_GetRegionStart(struct _Unwind_Context *context) { _Unwind_GetRegionStart(struct _Unwind_Context *context) {
// Not supported or needed for sjlj based unwinding // Not supported or needed for sjlj based unwinding
(void)context; (void)context;
_LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p)\n", context); _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p)", context);
return 0; return 0;
} }
@ -422,7 +422,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
/// is caught. /// is caught.
_LIBUNWIND_EXPORT void _LIBUNWIND_EXPORT void
_Unwind_DeleteException(struct _Unwind_Exception *exception_object) { _Unwind_DeleteException(struct _Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)",
exception_object); exception_object);
if (exception_object->exception_cleanup != NULL) if (exception_object->exception_cleanup != NULL)
(*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT, (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,
@ -437,7 +437,7 @@ _LIBUNWIND_EXPORT uintptr_t
_Unwind_GetDataRelBase(struct _Unwind_Context *context) { _Unwind_GetDataRelBase(struct _Unwind_Context *context) {
// Not supported or needed for sjlj based unwinding // Not supported or needed for sjlj based unwinding
(void)context; (void)context;
_LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)\n", context); _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)", context);
_LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented"); _LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented");
} }
@ -448,14 +448,14 @@ _LIBUNWIND_EXPORT uintptr_t
_Unwind_GetTextRelBase(struct _Unwind_Context *context) { _Unwind_GetTextRelBase(struct _Unwind_Context *context) {
// Not supported or needed for sjlj based unwinding // Not supported or needed for sjlj based unwinding
(void)context; (void)context;
_LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)\n", context); _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)", context);
_LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented"); _LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented");
} }
/// Called by personality handler to get "Call Frame Area" for current frame. /// Called by personality handler to get "Call Frame Area" for current frame.
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) { _LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) {
_LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p)\n", context); _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p)", context);
if (context != NULL) { if (context != NULL) {
_Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context; _Unwind_FunctionContext_t ufc = (_Unwind_FunctionContext_t) context;
// Setjmp/longjmp based exceptions don't have a true CFA. // Setjmp/longjmp based exceptions don't have a true CFA.

View File

@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
// //
// C++ interface to lower levels of libuwind // C++ interface to lower levels of libunwind
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef __UNWINDCURSOR_HPP__ #ifndef __UNWINDCURSOR_HPP__
@ -935,7 +935,7 @@ bool UnwindCursor<A, R>::getInfoFromDwarfSection(pint_t pc,
return true; return true;
} }
} }
//_LIBUNWIND_DEBUG_LOG("can't find/use FDE for pc=0x%llX\n", (uint64_t)pc); //_LIBUNWIND_DEBUG_LOG("can't find/use FDE for pc=0x%llX", (uint64_t)pc);
return false; return false;
} }
#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND #endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND
@ -1092,13 +1092,13 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
funcEnd = firstLevelNextPageFunctionOffset + sects.dso_base; funcEnd = firstLevelNextPageFunctionOffset + sects.dso_base;
if (pc < funcStart) { if (pc < funcStart) {
_LIBUNWIND_DEBUG_LOG("malformed __unwind_info, pc=0x%llX not in second " _LIBUNWIND_DEBUG_LOG("malformed __unwind_info, pc=0x%llX not in second "
"level compressed unwind table. funcStart=0x%llX\n", "level compressed unwind table. funcStart=0x%llX",
(uint64_t) pc, (uint64_t) funcStart); (uint64_t) pc, (uint64_t) funcStart);
return false; return false;
} }
if (pc > funcEnd) { if (pc > funcEnd) {
_LIBUNWIND_DEBUG_LOG("malformed __unwind_info, pc=0x%llX not in second " _LIBUNWIND_DEBUG_LOG("malformed __unwind_info, pc=0x%llX not in second "
"level compressed unwind table. funcEnd=0x%llX\n", "level compressed unwind table. funcEnd=0x%llX",
(uint64_t) pc, (uint64_t) funcEnd); (uint64_t) pc, (uint64_t) funcEnd);
return false; return false;
} }
@ -1119,7 +1119,7 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
} }
} else { } else {
_LIBUNWIND_DEBUG_LOG("malformed __unwind_info at 0x%0llX bad second " _LIBUNWIND_DEBUG_LOG("malformed __unwind_info at 0x%0llX bad second "
"level page\n", "level page",
(uint64_t) sects.compact_unwind_section); (uint64_t) sects.compact_unwind_section);
return false; return false;
} }
@ -1149,7 +1149,7 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
} }
if (lsda == 0) { if (lsda == 0) {
_LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with HAS_LSDA bit set for " _LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with HAS_LSDA bit set for "
"pc=0x%0llX, but lsda table has no entry\n", "pc=0x%0llX, but lsda table has no entry",
encoding, (uint64_t) pc); encoding, (uint64_t) pc);
return false; return false;
} }
@ -1162,7 +1162,7 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc,
--personalityIndex; // change 1-based to zero-based index --personalityIndex; // change 1-based to zero-based index
if (personalityIndex > sectionHeader.personalityArrayCount()) { if (personalityIndex > sectionHeader.personalityArrayCount()) {
_LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, " _LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, "
"but personality table has only %d entires\n", "but personality table has only %d entires",
encoding, personalityIndex, encoding, personalityIndex,
sectionHeader.personalityArrayCount()); sectionHeader.personalityArrayCount());
return false; return false;

View File

@ -29,11 +29,11 @@
_LIBUNWIND_EXPORT _Unwind_Reason_Code _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) { _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
#if _LIBUNWIND_ARM_EHABI #if _LIBUNWIND_ARM_EHABI
_LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n", _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld",
(void *)exception_object, (void *)exception_object,
(long)exception_object->unwinder_cache.reserved1); (long)exception_object->unwinder_cache.reserved1);
#else #else
_LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n", _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld",
(void *)exception_object, (void *)exception_object,
(long)exception_object->private_1); (long)exception_object->private_1);
#endif #endif
@ -66,7 +66,7 @@ _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
_LIBUNWIND_EXPORT uintptr_t _LIBUNWIND_EXPORT uintptr_t
_Unwind_GetDataRelBase(struct _Unwind_Context *context) { _Unwind_GetDataRelBase(struct _Unwind_Context *context) {
(void)context; (void)context;
_LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)\n", (void *)context); _LIBUNWIND_TRACE_API("_Unwind_GetDataRelBase(context=%p)", (void *)context);
_LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented"); _LIBUNWIND_ABORT("_Unwind_GetDataRelBase() not implemented");
} }
@ -76,7 +76,7 @@ _Unwind_GetDataRelBase(struct _Unwind_Context *context) {
_LIBUNWIND_EXPORT uintptr_t _LIBUNWIND_EXPORT uintptr_t
_Unwind_GetTextRelBase(struct _Unwind_Context *context) { _Unwind_GetTextRelBase(struct _Unwind_Context *context) {
(void)context; (void)context;
_LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)\n", (void *)context); _LIBUNWIND_TRACE_API("_Unwind_GetTextRelBase(context=%p)", (void *)context);
_LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented"); _LIBUNWIND_ABORT("_Unwind_GetTextRelBase() not implemented");
} }
@ -84,7 +84,7 @@ _Unwind_GetTextRelBase(struct _Unwind_Context *context) {
/// Scans unwind information to find the function that contains the /// Scans unwind information to find the function that contains the
/// specified code address "pc". /// specified code address "pc".
_LIBUNWIND_EXPORT void *_Unwind_FindEnclosingFunction(void *pc) { _LIBUNWIND_EXPORT void *_Unwind_FindEnclosingFunction(void *pc) {
_LIBUNWIND_TRACE_API("_Unwind_FindEnclosingFunction(pc=%p)\n", pc); _LIBUNWIND_TRACE_API("_Unwind_FindEnclosingFunction(pc=%p)", pc);
// This is slow, but works. // This is slow, but works.
// We create an unwind cursor then alter the IP to be pc // We create an unwind cursor then alter the IP to be pc
unw_cursor_t cursor; unw_cursor_t cursor;
@ -108,7 +108,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
unw_getcontext(&uc); unw_getcontext(&uc);
unw_init_local(&cursor, &uc); unw_init_local(&cursor, &uc);
_LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)",
(void *)(uintptr_t)callback); (void *)(uintptr_t)callback);
#if _LIBUNWIND_ARM_EHABI #if _LIBUNWIND_ARM_EHABI
@ -123,11 +123,11 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
_Unwind_Reason_Code result; _Unwind_Reason_Code result;
#if !_LIBUNWIND_ARM_EHABI #if !_LIBUNWIND_ARM_EHABI
// ask libuwind to get next frame (skip over first frame which is // ask libunwind to get next frame (skip over first frame which is
// _Unwind_Backtrace()) // _Unwind_Backtrace())
if (unw_step(&cursor) <= 0) { if (unw_step(&cursor) <= 0) {
_LIBUNWIND_TRACE_UNWINDING(" _backtrace: ended because cursor reached " _LIBUNWIND_TRACE_UNWINDING(" _backtrace: ended because cursor reached "
"bottom of stack, returning %d\n", "bottom of stack, returning %d",
_URC_END_OF_STACK); _URC_END_OF_STACK);
return _URC_END_OF_STACK; return _URC_END_OF_STACK;
} }
@ -164,7 +164,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
unw_get_proc_name(&cursor, functionName, 512, &offset); unw_get_proc_name(&cursor, functionName, 512, &offset);
unw_get_proc_info(&cursor, &frame); unw_get_proc_info(&cursor, &frame);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
" _backtrace: start_ip=0x%llX, func=%s, lsda=0x%llX, context=%p\n", " _backtrace: start_ip=0x%llX, func=%s, lsda=0x%llX, context=%p",
(long long)frame.start_ip, functionName, (long long)frame.lsda, (long long)frame.start_ip, functionName, (long long)frame.lsda,
(void *)&cursor); (void *)&cursor);
} }
@ -173,7 +173,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
result = (*callback)((struct _Unwind_Context *)(&cursor), ref); result = (*callback)((struct _Unwind_Context *)(&cursor), ref);
if (result != _URC_NO_REASON) { if (result != _URC_NO_REASON) {
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
" _backtrace: ended because callback returned %d\n", result); " _backtrace: ended because callback returned %d", result);
return result; return result;
} }
} }
@ -195,7 +195,7 @@ _LIBUNWIND_EXPORT const void *_Unwind_Find_FDE(const void *pc,
bases->tbase = (uintptr_t)info.extra; bases->tbase = (uintptr_t)info.extra;
bases->dbase = 0; // dbase not used on Mac OS X bases->dbase = 0; // dbase not used on Mac OS X
bases->func = (uintptr_t)info.start_ip; bases->func = (uintptr_t)info.start_ip;
_LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p\n", pc, _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p", pc,
(void *)(long) info.unwind_info); (void *)(long) info.unwind_info);
return (void *)(long) info.unwind_info; return (void *)(long) info.unwind_info;
} }
@ -206,7 +206,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) {
unw_cursor_t *cursor = (unw_cursor_t *)context; unw_cursor_t *cursor = (unw_cursor_t *)context;
unw_word_t result; 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%" PRIx64 "\n", _LIBUNWIND_TRACE_API("_Unwind_GetCFA(context=%p) => 0x%" PRIx64,
(void *)context, (uint64_t)result); (void *)context, (uint64_t)result);
return (uintptr_t)result; return (uintptr_t)result;
} }
@ -217,7 +217,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetCFA(struct _Unwind_Context *context) {
/// site address. Normally IP is the return address. /// site address. Normally IP is the return address.
_LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context, _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
int *ipBefore) { int *ipBefore) {
_LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)\n", (void *)context); _LIBUNWIND_TRACE_API("_Unwind_GetIPInfo(context=%p)", (void *)context);
*ipBefore = 0; *ipBefore = 0;
return _Unwind_GetIP(context); return _Unwind_GetIP(context);
} }
@ -229,7 +229,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context,
/// This function has existed on Mac OS X since 10.4, but /// This function has existed on Mac OS X since 10.4, but
/// was broken until 10.6. /// was broken until 10.6.
_LIBUNWIND_EXPORT void __register_frame(const void *fde) { _LIBUNWIND_EXPORT void __register_frame(const void *fde) {
_LIBUNWIND_TRACE_API("__register_frame(%p)\n", 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);
} }
@ -239,7 +239,7 @@ _LIBUNWIND_EXPORT void __register_frame(const void *fde) {
/// This function has existed on Mac OS X since 10.4, but /// This function has existed on Mac OS X since 10.4, but
/// was broken until 10.6. /// was broken until 10.6.
_LIBUNWIND_EXPORT void __deregister_frame(const void *fde) { _LIBUNWIND_EXPORT void __deregister_frame(const void *fde) {
_LIBUNWIND_TRACE_API("__deregister_frame(%p)\n", 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);
} }
@ -259,7 +259,7 @@ _LIBUNWIND_EXPORT void __register_frame_info_bases(const void *fde, void *ob,
(void)ob; (void)ob;
(void)tb; (void)tb;
(void)db; (void)db;
_LIBUNWIND_TRACE_API("__register_frame_info_bases(%p,%p, %p, %p)\n", _LIBUNWIND_TRACE_API("__register_frame_info_bases(%p,%p, %p, %p)",
fde, ob, tb, db); fde, ob, tb, db);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
} }
@ -267,7 +267,7 @@ _LIBUNWIND_EXPORT void __register_frame_info_bases(const void *fde, void *ob,
_LIBUNWIND_EXPORT void __register_frame_info(const void *fde, void *ob) { _LIBUNWIND_EXPORT void __register_frame_info(const void *fde, void *ob) {
(void)fde; (void)fde;
(void)ob; (void)ob;
_LIBUNWIND_TRACE_API("__register_frame_info(%p, %p)\n", fde, ob); _LIBUNWIND_TRACE_API("__register_frame_info(%p, %p)", fde, ob);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
} }
@ -279,33 +279,33 @@ _LIBUNWIND_EXPORT void __register_frame_info_table_bases(const void *fde,
(void)tb; (void)tb;
(void)db; (void)db;
_LIBUNWIND_TRACE_API("__register_frame_info_table_bases" _LIBUNWIND_TRACE_API("__register_frame_info_table_bases"
"(%p,%p, %p, %p)\n", fde, ob, tb, db); "(%p,%p, %p, %p)", fde, ob, tb, db);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
} }
_LIBUNWIND_EXPORT void __register_frame_info_table(const void *fde, void *ob) { _LIBUNWIND_EXPORT void __register_frame_info_table(const void *fde, void *ob) {
(void)fde; (void)fde;
(void)ob; (void)ob;
_LIBUNWIND_TRACE_API("__register_frame_info_table(%p, %p)\n", fde, ob); _LIBUNWIND_TRACE_API("__register_frame_info_table(%p, %p)", fde, ob);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
} }
_LIBUNWIND_EXPORT void __register_frame_table(const void *fde) { _LIBUNWIND_EXPORT void __register_frame_table(const void *fde) {
(void)fde; (void)fde;
_LIBUNWIND_TRACE_API("__register_frame_table(%p)\n", fde); _LIBUNWIND_TRACE_API("__register_frame_table(%p)", fde);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
} }
_LIBUNWIND_EXPORT void *__deregister_frame_info(const void *fde) { _LIBUNWIND_EXPORT void *__deregister_frame_info(const void *fde) {
(void)fde; (void)fde;
_LIBUNWIND_TRACE_API("__deregister_frame_info(%p)\n", fde); _LIBUNWIND_TRACE_API("__deregister_frame_info(%p)", fde);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
return NULL; return NULL;
} }
_LIBUNWIND_EXPORT void *__deregister_frame_info_bases(const void *fde) { _LIBUNWIND_EXPORT void *__deregister_frame_info_bases(const void *fde) {
(void)fde; (void)fde;
_LIBUNWIND_TRACE_API("__deregister_frame_info_bases(%p)\n", fde); _LIBUNWIND_TRACE_API("__deregister_frame_info_bases(%p)", fde);
// do nothing, this function never worked in Mac OS X // do nothing, this function never worked in Mac OS X
return NULL; return NULL;
} }

View File

@ -39,17 +39,17 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
// Walk each frame looking for a place to stop. // Walk each frame looking for a place to stop.
bool handlerNotFound = true; bool handlerNotFound = true;
while (handlerNotFound) { while (handlerNotFound) {
// Ask libuwind to get next frame (skip over first which is // Ask libunwind to get next frame (skip over first which is
// _Unwind_RaiseException). // _Unwind_RaiseException).
int stepResult = unw_step(cursor); int stepResult = unw_step(cursor);
if (stepResult == 0) { if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n", "bottom => _URC_END_OF_STACK",
(void *)exception_object); (void *)exception_object);
return _URC_END_OF_STACK; return _URC_END_OF_STACK;
} else if (stepResult < 0) { } else if (stepResult < 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step failed => " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step failed => "
"_URC_FATAL_PHASE1_ERROR\n", "_URC_FATAL_PHASE1_ERROR",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
@ -59,7 +59,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_word_t sp; unw_word_t sp;
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n", "failed => _URC_FATAL_PHASE1_ERROR",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
@ -77,7 +77,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_get_reg(cursor, UNW_REG_IP, &pc); unw_get_reg(cursor, UNW_REG_IP, &pc);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64 "unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n", ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "",
(void *)exception_object, pc, frameInfo.start_ip, functionName, (void *)exception_object, pc, frameInfo.start_ip, functionName,
frameInfo.lsda, frameInfo.handler); frameInfo.lsda, frameInfo.handler);
} }
@ -88,7 +88,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
__personality_routine p = __personality_routine p =
(__personality_routine)(long)(frameInfo.handler); (__personality_routine)(long)(frameInfo.handler);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): calling personality function %p\n", "unwind_phase1(ex_ojb=%p): calling personality function %p",
(void *)exception_object, (void *)(uintptr_t)p); (void *)exception_object, (void *)(uintptr_t)p);
_Unwind_Reason_Code personalityResult = _Unwind_Reason_Code personalityResult =
(*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class, (*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class,
@ -101,13 +101,13 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_get_reg(cursor, UNW_REG_SP, &sp); unw_get_reg(cursor, UNW_REG_SP, &sp);
exception_object->private_2 = (uintptr_t)sp; exception_object->private_2 = (uintptr_t)sp;
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n", "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND",
(void *)exception_object); (void *)exception_object);
return _URC_NO_REASON; return _URC_NO_REASON;
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND",
(void *)exception_object); (void *)exception_object);
// continue unwinding // continue unwinding
break; break;
@ -115,7 +115,7 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
default: default:
// something went wrong // something went wrong
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n", "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE1_ERROR; return _URC_FATAL_PHASE1_ERROR;
} }
@ -129,23 +129,23 @@ static _Unwind_Reason_Code
unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { 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)\n", _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)",
(void *)exception_object); (void *)exception_object);
// Walk each frame until we reach where search phase said to stop. // Walk each frame until we reach where search phase said to stop.
while (true) { while (true) {
// Ask libuwind to get next frame (skip over first which is // Ask libunwind to get next frame (skip over first which is
// _Unwind_RaiseException). // _Unwind_RaiseException).
int stepResult = unw_step(cursor); int stepResult = unw_step(cursor);
if (stepResult == 0) { if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached "
"bottom => _URC_END_OF_STACK\n", "bottom => _URC_END_OF_STACK",
(void *)exception_object); (void *)exception_object);
return _URC_END_OF_STACK; return _URC_END_OF_STACK;
} else if (stepResult < 0) { } else if (stepResult < 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step failed => " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step failed => "
"_URC_FATAL_PHASE1_ERROR\n", "_URC_FATAL_PHASE1_ERROR",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -156,7 +156,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_get_reg(cursor, UNW_REG_SP, &sp); unw_get_reg(cursor, UNW_REG_SP, &sp);
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
"failed => _URC_FATAL_PHASE1_ERROR\n", "failed => _URC_FATAL_PHASE1_ERROR",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -172,7 +172,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
functionName = ".anonymous."; functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIx64 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIx64
", func=%s, sp=0x%" PRIx64 ", lsda=0x%" PRIx64 ", func=%s, sp=0x%" PRIx64 ", lsda=0x%" PRIx64
", personality=0x%" PRIx64 "\n", ", personality=0x%" PRIx64,
(void *)exception_object, frameInfo.start_ip, (void *)exception_object, frameInfo.start_ip,
functionName, sp, frameInfo.lsda, functionName, sp, frameInfo.lsda,
frameInfo.handler); frameInfo.handler);
@ -194,7 +194,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
// Continue unwinding // Continue unwinding
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n", "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND",
(void *)exception_object); (void *)exception_object);
if (sp == exception_object->private_2) { if (sp == exception_object->private_2) {
// Phase 1 said we would stop at this frame, but we did not... // Phase 1 said we would stop at this frame, but we did not...
@ -204,7 +204,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
break; break;
case _URC_INSTALL_CONTEXT: case _URC_INSTALL_CONTEXT:
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT\n", "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT",
(void *)exception_object); (void *)exception_object);
// Personality routine says to transfer control to landing pad. // Personality routine says to transfer control to landing pad.
// We may get control back if landing pad calls _Unwind_Resume(). // We may get control back if landing pad calls _Unwind_Resume().
@ -214,7 +214,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
unw_get_reg(cursor, UNW_REG_SP, &sp); unw_get_reg(cursor, UNW_REG_SP, &sp);
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
"user code with ip=0x%" PRIx64 "user code with ip=0x%" PRIx64
", sp=0x%" PRIx64 "\n", ", sp=0x%" PRIx64,
(void *)exception_object, pc, sp); (void *)exception_object, pc, sp);
} }
unw_resume(cursor); unw_resume(cursor);
@ -247,7 +247,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
unw_proc_info_t frameInfo; unw_proc_info_t frameInfo;
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step "
"failed => _URC_END_OF_STACK\n", "failed => _URC_END_OF_STACK",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -263,7 +263,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
functionName = ".anonymous."; functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2_forced(ex_ojb=%p): start_ip=0x%" PRIx64 "unwind_phase2_forced(ex_ojb=%p): start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n", ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64,
(void *)exception_object, frameInfo.start_ip, functionName, (void *)exception_object, frameInfo.start_ip, functionName,
frameInfo.lsda, frameInfo.handler); frameInfo.lsda, frameInfo.handler);
} }
@ -275,11 +275,11 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
(*stop)(1, action, exception_object->exception_class, exception_object, (*stop)(1, action, exception_object->exception_class, exception_object,
(struct _Unwind_Context *)(cursor), stop_parameter); (struct _Unwind_Context *)(cursor), stop_parameter);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2_forced(ex_ojb=%p): stop function returned %d\n", "unwind_phase2_forced(ex_ojb=%p): stop function returned %d",
(void *)exception_object, stopResult); (void *)exception_object, stopResult);
if (stopResult != _URC_NO_REASON) { if (stopResult != _URC_NO_REASON) {
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2_forced(ex_ojb=%p): stopped by stop function\n", "unwind_phase2_forced(ex_ojb=%p): stopped by stop function",
(void *)exception_object); (void *)exception_object);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -289,7 +289,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
__personality_routine p = __personality_routine p =
(__personality_routine)(long)(frameInfo.handler); (__personality_routine)(long)(frameInfo.handler);
_LIBUNWIND_TRACE_UNWINDING( _LIBUNWIND_TRACE_UNWINDING(
"unwind_phase2_forced(ex_ojb=%p): calling personality function %p\n", "unwind_phase2_forced(ex_ojb=%p): calling personality function %p",
(void *)exception_object, (void *)(uintptr_t)p); (void *)exception_object, (void *)(uintptr_t)p);
_Unwind_Reason_Code personalityResult = _Unwind_Reason_Code personalityResult =
(*p)(1, action, exception_object->exception_class, exception_object, (*p)(1, action, exception_object->exception_class, exception_object,
@ -298,14 +298,14 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
case _URC_CONTINUE_UNWIND: case _URC_CONTINUE_UNWIND:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"personality returned " "personality returned "
"_URC_CONTINUE_UNWIND\n", "_URC_CONTINUE_UNWIND",
(void *)exception_object); (void *)exception_object);
// Destructors called, continue unwinding // Destructors called, continue unwinding
break; break;
case _URC_INSTALL_CONTEXT: case _URC_INSTALL_CONTEXT:
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"personality returned " "personality returned "
"_URC_INSTALL_CONTEXT\n", "_URC_INSTALL_CONTEXT",
(void *)exception_object); (void *)exception_object);
// We may get control back if landing pad calls _Unwind_Resume(). // We may get control back if landing pad calls _Unwind_Resume().
unw_resume(cursor); unw_resume(cursor);
@ -314,7 +314,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
// Personality routine returned an unknown result code. // Personality routine returned an unknown result code.
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): "
"personality returned %d, " "personality returned %d, "
"_URC_FATAL_PHASE2_ERROR\n", "_URC_FATAL_PHASE2_ERROR",
(void *)exception_object, personalityResult); (void *)exception_object, personalityResult);
return _URC_FATAL_PHASE2_ERROR; return _URC_FATAL_PHASE2_ERROR;
} }
@ -324,7 +324,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
// Call stop function one last time and tell it we've reached the end // Call stop function one last time and tell it we've reached the end
// of the stack. // of the stack.
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): calling stop " _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): calling stop "
"function with _UA_END_OF_STACK\n", "function with _UA_END_OF_STACK",
(void *)exception_object); (void *)exception_object);
_Unwind_Action lastAction = _Unwind_Action lastAction =
(_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE | _UA_END_OF_STACK); (_Unwind_Action)(_UA_FORCE_UNWIND | _UA_CLEANUP_PHASE | _UA_END_OF_STACK);
@ -340,7 +340,7 @@ unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor,
/// Called by __cxa_throw. Only returns if there is a fatal error. /// Called by __cxa_throw. Only returns if there is a fatal error.
_LIBUNWIND_EXPORT _Unwind_Reason_Code _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_RaiseException(_Unwind_Exception *exception_object) { _Unwind_RaiseException(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)",
(void *)exception_object); (void *)exception_object);
unw_context_t uc; unw_context_t uc;
unw_cursor_t cursor; unw_cursor_t cursor;
@ -375,7 +375,7 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
/// in turn calls _Unwind_Resume_or_Rethrow(). /// in turn calls _Unwind_Resume_or_Rethrow().
_LIBUNWIND_EXPORT void _LIBUNWIND_EXPORT void
_Unwind_Resume(_Unwind_Exception *exception_object) { _Unwind_Resume(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)\n", (void *)exception_object); _LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)", (void *)exception_object);
unw_context_t uc; unw_context_t uc;
unw_cursor_t cursor; unw_cursor_t cursor;
unw_getcontext(&uc); unw_getcontext(&uc);
@ -399,7 +399,7 @@ _Unwind_Resume(_Unwind_Exception *exception_object) {
_LIBUNWIND_EXPORT _Unwind_Reason_Code _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_ForcedUnwind(_Unwind_Exception *exception_object, _Unwind_ForcedUnwind(_Unwind_Exception *exception_object,
_Unwind_Stop_Fn stop, void *stop_parameter) { _Unwind_Stop_Fn stop, void *stop_parameter) {
_LIBUNWIND_TRACE_API("_Unwind_ForcedUnwind(ex_obj=%p, stop=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_ForcedUnwind(ex_obj=%p, stop=%p)",
(void *)exception_object, (void *)(uintptr_t)stop); (void *)exception_object, (void *)(uintptr_t)stop);
unw_context_t uc; unw_context_t uc;
unw_cursor_t cursor; unw_cursor_t cursor;
@ -424,11 +424,11 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS) if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
result = (uintptr_t)frameInfo.lsda; result = (uintptr_t)frameInfo.lsda;
_LIBUNWIND_TRACE_API( _LIBUNWIND_TRACE_API(
"_Unwind_GetLanguageSpecificData(context=%p) => 0x%" PRIxPTR "\n", "_Unwind_GetLanguageSpecificData(context=%p) => 0x%" PRIxPTR,
(void *)context, result); (void *)context, result);
if (result != 0) { if (result != 0) {
if (*((uint8_t *)result) != 0xFF) if (*((uint8_t *)result) != 0xFF)
_LIBUNWIND_DEBUG_LOG("lsda at 0x%" PRIxPTR " does not start with 0xFF\n", _LIBUNWIND_DEBUG_LOG("lsda at 0x%" PRIxPTR " does not start with 0xFF",
result); result);
} }
return result; return result;
@ -444,7 +444,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
uintptr_t result = 0; 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; result = (uintptr_t)frameInfo.start_ip;
_LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR "\n", _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR,
(void *)context, result); (void *)context, result);
return result; return result;
} }
@ -454,7 +454,7 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context) {
// is caught. // is caught.
_LIBUNWIND_EXPORT void _LIBUNWIND_EXPORT void
_Unwind_DeleteException(_Unwind_Exception *exception_object) { _Unwind_DeleteException(_Unwind_Exception *exception_object) {
_LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n", _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)",
(void *)exception_object); (void *)exception_object);
if (exception_object->exception_cleanup != NULL) if (exception_object->exception_cleanup != NULL)
(*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT, (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,
@ -467,7 +467,7 @@ _Unwind_GetGR(struct _Unwind_Context *context, int index) {
unw_cursor_t *cursor = (unw_cursor_t *)context; unw_cursor_t *cursor = (unw_cursor_t *)context;
unw_word_t result; 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%" PRIx64 "\n", _LIBUNWIND_TRACE_API("_Unwind_GetGR(context=%p, reg=%d) => 0x%" PRIx64,
(void *)context, index, (uint64_t)result); (void *)context, index, (uint64_t)result);
return (uintptr_t)result; return (uintptr_t)result;
} }
@ -476,7 +476,7 @@ _Unwind_GetGR(struct _Unwind_Context *context, int index) {
_LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index, _LIBUNWIND_EXPORT void _Unwind_SetGR(struct _Unwind_Context *context, int index,
uintptr_t value) { uintptr_t value) {
_LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0" PRIx64 _LIBUNWIND_TRACE_API("_Unwind_SetGR(context=%p, reg=%d, value=0x%0" PRIx64
")\n", ")",
(void *)context, index, (uint64_t)value); (void *)context, index, (uint64_t)value);
unw_cursor_t *cursor = (unw_cursor_t *)context; unw_cursor_t *cursor = (unw_cursor_t *)context;
unw_set_reg(cursor, index, value); unw_set_reg(cursor, index, value);
@ -487,7 +487,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
unw_cursor_t *cursor = (unw_cursor_t *)context; unw_cursor_t *cursor = (unw_cursor_t *)context;
unw_word_t result; 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%" PRIx64 "\n", _LIBUNWIND_TRACE_API("_Unwind_GetIP(context=%p) => 0x%" PRIx64,
(void *)context, (uint64_t)result); (void *)context, (uint64_t)result);
return (uintptr_t)result; return (uintptr_t)result;
} }
@ -497,7 +497,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
/// start executing in the landing pad. /// start executing in the landing pad.
_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context, _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
uintptr_t value) { uintptr_t value) {
_LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0" PRIx64 ")\n", _LIBUNWIND_TRACE_API("_Unwind_SetIP(context=%p, value=0x%0" PRIx64 ")",
(void *)context, (uint64_t)value); (void *)context, (uint64_t)value);
unw_cursor_t *cursor = (unw_cursor_t *)context; unw_cursor_t *cursor = (unw_cursor_t *)context;
unw_set_reg(cursor, UNW_REG_IP, value); unw_set_reg(cursor, UNW_REG_IP, value);

View File

@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
// //
// Defines macros used within libuwind project. // Defines macros used within libunwind project.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -84,7 +84,7 @@
fflush(stderr); \ fflush(stderr); \
abort(); \ abort(); \
} while (0) } while (0)
#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__) #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
// Macros that define away in non-Debug builds // Macros that define away in non-Debug builds
#ifdef NDEBUG #ifdef NDEBUG

View File

@ -1,4 +1,4 @@
//===--------------------------- libuwind.cpp -----------------------------===// //===--------------------------- libunwind.cpp ----------------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -42,7 +42,7 @@ extern int unw_getcontext(unw_context_t *);
/// unw_getcontext(). /// unw_getcontext().
_LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor, _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
unw_context_t *context) { unw_context_t *context) {
_LIBUNWIND_TRACE_API("unw_init_local(cursor=%p, context=%p)\n", _LIBUNWIND_TRACE_API("unw_init_local(cursor=%p, context=%p)",
static_cast<void *>(cursor), static_cast<void *>(cursor),
static_cast<void *>(context)); static_cast<void *>(context));
#if defined(__i386__) #if defined(__i386__)
@ -159,7 +159,7 @@ _LIBUNWIND_EXPORT void unw_destroy_addr_space(unw_addr_space_t asp) {
/// Get value of specified register at cursor position in stack frame. /// 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, _LIBUNWIND_EXPORT int unw_get_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
unw_word_t *value) { unw_word_t *value) {
_LIBUNWIND_TRACE_API("unw_get_reg(cursor=%p, regNum=%d, &value=%p)\n", _LIBUNWIND_TRACE_API("unw_get_reg(cursor=%p, regNum=%d, &value=%p)",
static_cast<void *>(cursor), regNum, static_cast<void *>(cursor), regNum,
static_cast<void *>(value)); static_cast<void *>(value));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
@ -174,7 +174,7 @@ _LIBUNWIND_EXPORT int unw_get_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
/// Set value of specified register at cursor position in stack frame. /// 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, _LIBUNWIND_EXPORT int unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
unw_word_t value) { unw_word_t value) {
_LIBUNWIND_TRACE_API("unw_set_reg(cursor=%p, regNum=%d, value=0x%llX)\n", _LIBUNWIND_TRACE_API("unw_set_reg(cursor=%p, regNum=%d, value=0x%llX)",
static_cast<void *>(cursor), regNum, (long long)value); static_cast<void *>(cursor), regNum, (long long)value);
typedef LocalAddressSpace::pint_t pint_t; typedef LocalAddressSpace::pint_t pint_t;
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
@ -193,7 +193,7 @@ _LIBUNWIND_EXPORT int unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
/// Get value of specified float register at cursor position in stack frame. /// 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, _LIBUNWIND_EXPORT int unw_get_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
unw_fpreg_t *value) { unw_fpreg_t *value) {
_LIBUNWIND_TRACE_API("unw_get_fpreg(cursor=%p, regNum=%d, &value=%p)\n", _LIBUNWIND_TRACE_API("unw_get_fpreg(cursor=%p, regNum=%d, &value=%p)",
static_cast<void *>(cursor), regNum, static_cast<void *>(cursor), regNum,
static_cast<void *>(value)); static_cast<void *>(value));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
@ -209,10 +209,10 @@ _LIBUNWIND_EXPORT int unw_get_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
_LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum, _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
unw_fpreg_t value) { unw_fpreg_t value) {
#if _LIBUNWIND_ARM_EHABI #if _LIBUNWIND_ARM_EHABI
_LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)\n", _LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)",
static_cast<void *>(cursor), regNum, value); static_cast<void *>(cursor), regNum, value);
#else #else
_LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%g)\n", _LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%g)",
static_cast<void *>(cursor), regNum, value); static_cast<void *>(cursor), regNum, value);
#endif #endif
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
@ -226,7 +226,7 @@ _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum,
/// Move cursor to next frame. /// Move cursor to next frame.
_LIBUNWIND_EXPORT int unw_step(unw_cursor_t *cursor) { _LIBUNWIND_EXPORT int unw_step(unw_cursor_t *cursor) {
_LIBUNWIND_TRACE_API("unw_step(cursor=%p)\n", static_cast<void *>(cursor)); _LIBUNWIND_TRACE_API("unw_step(cursor=%p)", static_cast<void *>(cursor));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
return co->step(); return co->step();
} }
@ -235,7 +235,7 @@ _LIBUNWIND_EXPORT int unw_step(unw_cursor_t *cursor) {
/// Get unwind info at cursor position in stack frame. /// Get unwind info at cursor position in stack frame.
_LIBUNWIND_EXPORT int unw_get_proc_info(unw_cursor_t *cursor, _LIBUNWIND_EXPORT int unw_get_proc_info(unw_cursor_t *cursor,
unw_proc_info_t *info) { unw_proc_info_t *info) {
_LIBUNWIND_TRACE_API("unw_get_proc_info(cursor=%p, &info=%p)\n", _LIBUNWIND_TRACE_API("unw_get_proc_info(cursor=%p, &info=%p)",
static_cast<void *>(cursor), static_cast<void *>(info)); static_cast<void *>(cursor), static_cast<void *>(info));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
co->getInfo(info); co->getInfo(info);
@ -248,7 +248,7 @@ _LIBUNWIND_EXPORT int unw_get_proc_info(unw_cursor_t *cursor,
/// Resume execution at cursor position (aka longjump). /// Resume execution at cursor position (aka longjump).
_LIBUNWIND_EXPORT int unw_resume(unw_cursor_t *cursor) { _LIBUNWIND_EXPORT int unw_resume(unw_cursor_t *cursor) {
_LIBUNWIND_TRACE_API("unw_resume(cursor=%p)\n", static_cast<void *>(cursor)); _LIBUNWIND_TRACE_API("unw_resume(cursor=%p)", static_cast<void *>(cursor));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
co->jumpto(); co->jumpto();
return UNW_EUNSPEC; return UNW_EUNSPEC;
@ -258,7 +258,7 @@ _LIBUNWIND_EXPORT int unw_resume(unw_cursor_t *cursor) {
/// Get name of function at cursor position in stack frame. /// Get name of function at cursor position in stack frame.
_LIBUNWIND_EXPORT int unw_get_proc_name(unw_cursor_t *cursor, char *buf, _LIBUNWIND_EXPORT int unw_get_proc_name(unw_cursor_t *cursor, char *buf,
size_t bufLen, unw_word_t *offset) { size_t bufLen, unw_word_t *offset) {
_LIBUNWIND_TRACE_API("unw_get_proc_name(cursor=%p, &buf=%p, bufLen=%lu)\n", _LIBUNWIND_TRACE_API("unw_get_proc_name(cursor=%p, &buf=%p, bufLen=%lu)",
static_cast<void *>(cursor), static_cast<void *>(buf), static_cast<void *>(cursor), static_cast<void *>(buf),
static_cast<unsigned long>(bufLen)); static_cast<unsigned long>(bufLen));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
@ -271,7 +271,7 @@ _LIBUNWIND_EXPORT int unw_get_proc_name(unw_cursor_t *cursor, char *buf,
/// Checks if a register is a floating-point register. /// Checks if a register is a floating-point register.
_LIBUNWIND_EXPORT int unw_is_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum) { _LIBUNWIND_EXPORT int unw_is_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum) {
_LIBUNWIND_TRACE_API("unw_is_fpreg(cursor=%p, regNum=%d)\n", _LIBUNWIND_TRACE_API("unw_is_fpreg(cursor=%p, regNum=%d)",
static_cast<void *>(cursor), regNum); static_cast<void *>(cursor), regNum);
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
return co->validFloatReg(regNum); return co->validFloatReg(regNum);
@ -281,7 +281,7 @@ _LIBUNWIND_EXPORT int unw_is_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum) {
/// Checks if a register is a floating-point register. /// Checks if a register is a floating-point register.
_LIBUNWIND_EXPORT const char *unw_regname(unw_cursor_t *cursor, _LIBUNWIND_EXPORT const char *unw_regname(unw_cursor_t *cursor,
unw_regnum_t regNum) { unw_regnum_t regNum) {
_LIBUNWIND_TRACE_API("unw_regname(cursor=%p, regNum=%d)\n", _LIBUNWIND_TRACE_API("unw_regname(cursor=%p, regNum=%d)",
static_cast<void *>(cursor), regNum); static_cast<void *>(cursor), regNum);
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
return co->getRegisterName(regNum); return co->getRegisterName(regNum);
@ -290,7 +290,7 @@ _LIBUNWIND_EXPORT const char *unw_regname(unw_cursor_t *cursor,
/// Checks if current frame is signal trampoline. /// Checks if current frame is signal trampoline.
_LIBUNWIND_EXPORT int unw_is_signal_frame(unw_cursor_t *cursor) { _LIBUNWIND_EXPORT int unw_is_signal_frame(unw_cursor_t *cursor) {
_LIBUNWIND_TRACE_API("unw_is_signal_frame(cursor=%p)\n", _LIBUNWIND_TRACE_API("unw_is_signal_frame(cursor=%p)",
static_cast<void *>(cursor)); static_cast<void *>(cursor));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
return co->isSignalFrame(); return co->isSignalFrame();
@ -299,7 +299,7 @@ _LIBUNWIND_EXPORT int unw_is_signal_frame(unw_cursor_t *cursor) {
#ifdef __arm__ #ifdef __arm__
// Save VFP registers d0-d15 using FSTMIADX instead of FSTMIADD // Save VFP registers d0-d15 using FSTMIADX instead of FSTMIADD
_LIBUNWIND_EXPORT void unw_save_vfp_as_X(unw_cursor_t *cursor) { _LIBUNWIND_EXPORT void unw_save_vfp_as_X(unw_cursor_t *cursor) {
_LIBUNWIND_TRACE_API("unw_fpreg_save_vfp_as_X(cursor=%p)\n", _LIBUNWIND_TRACE_API("unw_fpreg_save_vfp_as_X(cursor=%p)",
static_cast<void *>(cursor)); static_cast<void *>(cursor));
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
return co->saveVFPAsX(); return co->saveVFPAsX();
@ -311,7 +311,7 @@ _LIBUNWIND_EXPORT void unw_save_vfp_as_X(unw_cursor_t *cursor) {
/// SPI: walks cached dwarf entries /// SPI: walks cached dwarf entries
_LIBUNWIND_EXPORT void unw_iterate_dwarf_unwind_cache(void (*func)( _LIBUNWIND_EXPORT 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)) { 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)\n", _LIBUNWIND_TRACE_API("unw_iterate_dwarf_unwind_cache(func=%p)",
reinterpret_cast<void *>(func)); reinterpret_cast<void *>(func));
DwarfFDECache<LocalAddressSpace>::iterateCacheEntries(func); DwarfFDECache<LocalAddressSpace>::iterateCacheEntries(func);
} }