mstorsjo created this revision.
Herald added subscribers: kristof.beyls, aprantl, aemerson.
The previous definition of _LIBUNWIND_HIGHEST_DWARF_REGISTER seems to be a copy
of the ARM64 value (introduced in SVN r276128); since the code actually hasn't
compiled properly for arm in dwarf mode before, this hasn't actually been used.
Set it to the correct value based on the UNW_ARM_* enum values.
Use the same size for data types unw_word_t as for _LIBUNWIND_ARM_EHABI, to
have the struct sizes match.
This requires adding casts in a log line, where the data types (unw_word_t)
implicitly were assumed be uint64_t. Normally mismatched
printf formats aren't fatal (and might go unnoticed), unless a later parameter
is interpreted as a string, when it becomes fatal.
https://reviews.llvm.org/D39251
Files:
include/__libunwind_config.h
include/libunwind.h
src/Registers.hpp
src/UnwindCursor.hpp
src/UnwindLevel1.c
src/libunwind.cpp
Index: src/libunwind.cpp
===================================================================
--- src/libunwind.cpp
+++ src/libunwind.cpp
@@ -55,7 +55,7 @@
# define REGISTER_KIND Registers_ppc
#elif defined(__aarch64__)
# define REGISTER_KIND Registers_arm64
-#elif defined(_LIBUNWIND_ARM_EHABI)
+#elif defined(__arm__)
# define REGISTER_KIND Registers_arm
#elif defined(__or1k__)
# define REGISTER_KIND Registers_or1k
Index: src/UnwindLevel1.c
===================================================================
--- src/UnwindLevel1.c
+++ src/UnwindLevel1.c
@@ -78,8 +78,8 @@
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "",
- (void *)exception_object, pc, frameInfo.start_ip, functionName,
- frameInfo.lsda, frameInfo.handler);
+ (void *)exception_object, (uint64_t)pc, (uint64_t)frameInfo.start_ip, functionName,
+ (uint64_t)frameInfo.lsda, (uint64_t)frameInfo.handler);
}
// If there is a personality routine, ask it if it will want to stop at
Index: src/UnwindCursor.hpp
===================================================================
--- src/UnwindCursor.hpp
+++ src/UnwindCursor.hpp
@@ -583,6 +583,12 @@
}
#endif
+#if defined(_LIBUNWIND_TARGET_ARM)
+ compact_unwind_encoding_t dwarfEncoding(Registers_arm &) const {
+ return 0;
+ }
+#endif
+
#if defined (_LIBUNWIND_TARGET_OR1K)
compact_unwind_encoding_t dwarfEncoding(Registers_or1k &) const {
return 0;
Index: src/Registers.hpp
===================================================================
--- src/Registers.hpp
+++ src/Registers.hpp
@@ -1326,7 +1326,7 @@
Registers_arm(const void *registers);
bool validRegister(int num) const;
- uint32_t getRegister(int num);
+ uint32_t getRegister(int num) const;
void setRegister(int num, uint32_t value);
bool validFloatRegister(int num) const;
unw_fpreg_t getFloatRegister(int num);
@@ -1339,6 +1339,7 @@
restoreSavedFloatRegisters();
restoreCoreAndJumpTo();
}
+ static int lastDwarfRegNum() { return 287; }
uint32_t getSP() const { return _registers.__sp; }
void setSP(uint32_t value) { _registers.__sp = value; }
@@ -1473,7 +1474,7 @@
return false;
}
-inline uint32_t Registers_arm::getRegister(int regNum) {
+inline uint32_t Registers_arm::getRegister(int regNum) const {
if (regNum == UNW_REG_SP || regNum == UNW_ARM_SP)
return _registers.__sp;
Index: include/libunwind.h
===================================================================
--- include/libunwind.h
+++ include/libunwind.h
@@ -72,7 +72,7 @@
typedef struct unw_addr_space *unw_addr_space_t;
typedef int unw_regnum_t;
-#if defined(_LIBUNWIND_ARM_EHABI)
+#if defined(_LIBUNWIND_ARM_EHABI) || defined(__ARM_DWARF_EH__)
typedef uint32_t unw_word_t;
typedef uint64_t unw_fpreg_t;
#else
Index: include/__libunwind_config.h
===================================================================
--- include/__libunwind_config.h
+++ include/__libunwind_config.h
@@ -45,7 +45,7 @@
# define _LIBUNWIND_CONTEXT_SIZE 42
# define _LIBUNWIND_CURSOR_SIZE 49
# endif
-# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 96
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 288
# elif defined(__or1k__)
# define _LIBUNWIND_TARGET_OR1K 1
# define _LIBUNWIND_CONTEXT_SIZE 16
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits