Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libunwind Provide _Unwind_Find_FDE for libgcc_s comp...



details:   https://anonhg.NetBSD.org/src/rev/bd1beb394008
branches:  trunk
changeset: 806352:bd1beb394008
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Feb 17 21:02:33 2015 +0000

description:
Provide _Unwind_Find_FDE for libgcc_s compatibility.

diffstat:

 sys/lib/libunwind/libunwind.cxx |  19 +++++++++++++++++++
 sys/lib/libunwind/unwind.h      |  12 ++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diffs (65 lines):

diff -r 0f3d259bd3d8 -r bd1beb394008 sys/lib/libunwind/libunwind.cxx
--- a/sys/lib/libunwind/libunwind.cxx   Tue Feb 17 20:44:42 2015 +0000
+++ b/sys/lib/libunwind/libunwind.cxx   Tue Feb 17 21:02:33 2015 +0000
@@ -11,6 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#define _UNWIND_GCC_EXTENSIONS
+
 #include <unwind.h>
 
 #include "UnwindCursor.hpp"
@@ -329,6 +331,23 @@
   return info.end_ip ? (void *)info.start_ip : NULL;
 }
 
+void *_Unwind_Find_FDE(void *pc, struct dwarf_eh_bases *bases) {
+  NativeUnwindRegisters registers;
+  ThisUnwindCursor cursor(registers, sThisAddressSpace);
+
+  unw_proc_info_t info;
+  cursor.setIP((uintptr_t)pc);
+  cursor.setInfoBasedOnIPRegister();
+
+  cursor.getInfo(&info);
+  if (info.end_ip == 0)
+    return NULL;
+  bases->tbase = 0; /* Not supported */
+  bases->dbase = (void *)info.data_base;
+  bases->func = (void *)info.start_ip;
+  return (void *)info.unwind_info;
+}
+
 uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *context) {
   ThisUnwindCursor *cursor = (ThisUnwindCursor *)context;
   unw_proc_info_t frameInfo;
diff -r 0f3d259bd3d8 -r bd1beb394008 sys/lib/libunwind/unwind.h
--- a/sys/lib/libunwind/unwind.h        Tue Feb 17 20:44:42 2015 +0000
+++ b/sys/lib/libunwind/unwind.h        Tue Feb 17 21:02:33 2015 +0000
@@ -56,6 +56,14 @@
                                                      struct _Unwind_Exception *,
                                                      struct _Unwind_Context *);
 
+#ifdef _UNWIND_GCC_EXTENSIONS
+struct dwarf_eh_bases {
+  void *tbase;
+  void *dbase;
+  void *func;
+};
+#endif
+
 __BEGIN_DECLS
 
 _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *);
@@ -85,6 +93,10 @@
 void __deregister_frame(const void *);
 void *__deregister_frame_info(const void *);
 
+#ifdef _UNWIND_GCC_EXTENSIONS
+void *_Unwind_Find_FDE(void *, struct dwarf_eh_bases *);
+#endif
+
 __END_DECLS
 
 #endif // _UNWIND_H



Home | Main Index | Thread Index | Old Index