Provide _Unwind_Find_FDE for libgcc_s compatibility.

This commit is contained in:
joerg 2015-02-17 21:02:33 +00:00
parent 84a0efdf85
commit 72523275ec
2 changed files with 31 additions and 0 deletions

View File

@ -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;

View File

@ -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