From 72523275ec1cf6931fa2de8d9b75ab9a4128666f Mon Sep 17 00:00:00 2001 From: joerg Date: Tue, 17 Feb 2015 21:02:33 +0000 Subject: [PATCH] Provide _Unwind_Find_FDE for libgcc_s compatibility. --- sys/lib/libunwind/libunwind.cxx | 19 +++++++++++++++++++ sys/lib/libunwind/unwind.h | 12 ++++++++++++ 2 files changed, 31 insertions(+) diff --git a/sys/lib/libunwind/libunwind.cxx b/sys/lib/libunwind/libunwind.cxx index 8cdb86371b58..e1897848917b 100644 --- a/sys/lib/libunwind/libunwind.cxx +++ b/sys/lib/libunwind/libunwind.cxx @@ -11,6 +11,8 @@ // //===----------------------------------------------------------------------===// +#define _UNWIND_GCC_EXTENSIONS + #include #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 498bb75830c9..7a697ef5160d 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