summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2015-02-17 21:02:33 +0000
committerjoerg <joerg@NetBSD.org>2015-02-17 21:02:33 +0000
commitb1e25d2d1d79a78a76d4073301f8bf2f252ae4e7 (patch)
tree3d2c3a9fd0f8aad49f941b11f104a1563e90e2b6 /sys/lib
parent16b31207541b4defe2c5783c8c1fba6d76cfece7 (diff)
Provide _Unwind_Find_FDE for libgcc_s compatibility.
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libunwind/libunwind.cxx19
-rw-r--r--sys/lib/libunwind/unwind.h12
2 files changed, 31 insertions, 0 deletions
diff --git a/sys/lib/libunwind/libunwind.cxx b/sys/lib/libunwind/libunwind.cxx
index 8cdb86371b5..e1897848917 100644
--- a/sys/lib/libunwind/libunwind.cxx
+++ b/sys/lib/libunwind/libunwind.cxx
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#define _UNWIND_GCC_EXTENSIONS
+
#include <unwind.h>
#include "UnwindCursor.hpp"
@@ -329,6 +331,23 @@ void *_Unwind_FindEnclosingFunction(void *pc) {
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 --git a/sys/lib/libunwind/unwind.h b/sys/lib/libunwind/unwind.h
index 498bb75830c..7a697ef5160 100644
--- a/sys/lib/libunwind/unwind.h
+++ b/sys/lib/libunwind/unwind.h
@@ -56,6 +56,14 @@ typedef _Unwind_Reason_Code (*__personality_routine)(int, _Unwind_Action,
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 __register_frame_info(const void *, void *);
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