[PATCH] D39280: [libunwind] Use uint64_t for unw_word_t in ARM EHABI

2017-10-30 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo abandoned this revision.
mstorsjo added a comment.

This was made obsolete by https://reviews.llvm.org/D39365.


https://reviews.llvm.org/D39280



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39280: [libunwind] Use uint64_t for unw_word_t in ARM EHABI

2017-10-27 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In https://reviews.llvm.org/D39280#908825, @compnerd wrote:

> I dont think that this is correct.  IIRC, the unwind specification expects 
> `unw_word_t` to match `uintptr_t` (that is, it should be 32-bits on 
> https://reviews.llvm.org/P32 environments).


I checked with GNU libunwind, and that seems to be true there. Updating our 
libunwind to match that doesn't seem to be too hard.


https://reviews.llvm.org/D39280



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39280: [libunwind] Use uint64_t for unw_word_t in ARM EHABI

2017-10-26 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In https://reviews.llvm.org/D39280#908825, @compnerd wrote:

> I dont think that this is correct.  IIRC, the unwind specification expects 
> `unw_word_t` to match `uintptr_t` (that is, it should be 32-bits on 
> https://reviews.llvm.org/P32 environments).


Ok, well currently it doesn't, on 32 bit x86 and ppc at least.


https://reviews.llvm.org/D39280



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39280: [libunwind] Use uint64_t for unw_word_t in ARM EHABI

2017-10-26 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added a comment.

I dont think that this is correct.  IIRC, the unwind specification expects 
`unw_word_t` to match `uintptr_t` (that is, it should be 32-bits on 
https://reviews.llvm.org/P32 environments).


https://reviews.llvm.org/D39280



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39280: [libunwind] Use uint64_t for unw_word_t in ARM EHABI

2017-10-25 Thread Martin Storsjö via Phabricator via cfe-commits
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;