mstorsjo created this revision.
Herald added subscribers: kristof.beyls, aprantl, aemerson.
This reduces the differences between the EHABI and DWARF cases.
This allows getting rid of some casts in _LIBUNWIND_TRACE_API log lines, making
them match what's in UnwindLevel1.c for DWARF.
The only non-obvious detail is in _Unwind_VRS_Get_Internal (called via
_Unwind_VRS_Get), where a void pointer is assumed to be uint32_t or uintptr_t
(depending on the caller); this can no longer use unw_word_t directly as before.
https://reviews.llvm.org/D39280
Files:
include/__libunwind_config.h
include/libunwind.h
src/Unwind-EHABI.cpp
Index: src/Unwind-EHABI.cpp
===
--- src/Unwind-EHABI.cpp
+++ src/Unwind-EHABI.cpp
@@ -14,6 +14,7 @@
#if defined(_LIBUNWIND_ARM_EHABI)
+#include
#include
#include
#include
@@ -468,11 +469,11 @@
unw_word_t pc;
unw_get_reg(cursor, UNW_REG_IP, );
_LIBUNWIND_TRACE_UNWINDING(
- "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
- "lsda=0x%llX, personality=0x%llX",
- static_cast(exception_object), (long long)pc,
- (long long)frameInfo.start_ip, functionName,
- (long long)frameInfo.lsda, (long long)frameInfo.handler);
+ "unwind_phase1(ex_ojb=%p): pc=0x%" PRIX64 ", start_ip=0x%" PRIX64 " func=%s, "
+ "lsda=0x" PRIX64 ", personality=0x" PRIX64 "",
+ static_cast(exception_object), pc,
+ frameInfo.start_ip, functionName,
+ frameInfo.lsda, frameInfo.handler);
}
// If there is a personality routine, ask it if it will want to stop at
@@ -584,11 +585,11 @@
(frameInfo.start_ip + offset > frameInfo.end_ip))
functionName = ".anonymous.";
_LIBUNWIND_TRACE_UNWINDING(
- "unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, "
- "lsda=0x%llX, personality=0x%llX",
- static_cast(exception_object), (long long)frameInfo.start_ip,
- functionName, (long long)sp, (long long)frameInfo.lsda,
- (long long)frameInfo.handler);
+ "unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIX64 " func=%s, sp=0x%" PRIX64 ", "
+ "lsda=0x%" PRIX64 ", personality=0x%" PRIX64 "",
+ static_cast(exception_object), frameInfo.start_ip,
+ functionName, sp, frameInfo.lsda,
+ frameInfo.handler);
}
// If there is a personality routine, tell it we are unwinding.
@@ -627,9 +628,9 @@
unw_get_reg(cursor, UNW_REG_IP, );
unw_get_reg(cursor, UNW_REG_SP, );
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
- "user code with ip=0x%llX, sp=0x%llX",
+ "user code with ip=0x%" PRIX64 ", sp=0x%" PRIX64 "",
static_cast(exception_object),
- (long long)pc, (long long)sp);
+ pc, sp);
}
{
@@ -727,8 +728,8 @@
if (unw_get_proc_info(cursor, ) == UNW_ESUCCESS)
result = (uintptr_t)frameInfo.lsda;
_LIBUNWIND_TRACE_API(
- "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx",
- static_cast(context), (long long)result);
+ "_Unwind_GetLanguageSpecificData(context=%p) => 0x%" PRIx64 "",
+ static_cast(context), result);
return result;
}
@@ -765,7 +766,7 @@
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
+ *(uintptr_t *)valuep) == UNW_ESUCCESS
? _UVRSR_OK
: _UVRSR_FAILED;
case _UVRSC_VFP:
@@ -789,7 +790,7 @@
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
+ *(uintptr_t *)valuep) == UNW_ESUCCESS
? _UVRSR_OK
: _UVRSR_FAILED;
case _UVRSC_WMMXD:
@@ -814,14 +815,18 @@
_Unwind_VRS_DataRepresentation representation,
void *valuep) {
unw_cursor_t *cursor = (unw_cursor_t *)context;
+ unw_word_t word;
+ _Unwind_VRS_Result ret;
switch (regclass) {
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
+ ret = unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
+ ) == UNW_ESUCCESS
? _UVRSR_OK
: _UVRSR_FAILED;
+ *(uintptr_t *)valuep = word;
+ return ret;