diff options
Diffstat (limited to 'libunwind/src/Unwind-seh.cpp')
-rw-r--r-- | libunwind/src/Unwind-seh.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/libunwind/src/Unwind-seh.cpp b/libunwind/src/Unwind-seh.cpp index 8b4b7d596b3..7647f2e0db0 100644 --- a/libunwind/src/Unwind-seh.cpp +++ b/libunwind/src/Unwind-seh.cpp @@ -58,9 +58,10 @@ static void seh_exc_cleanup(_Unwind_Reason_Code urc, _Unwind_Exception *exc) { free(exc); } -static int _unw_init_seh(unw_cursor_t *cursor, CONTEXT *ctx); -static DISPATCHER_CONTEXT *_unw_seh_get_disp_ctx(unw_cursor_t *cursor); -static void _unw_seh_set_disp_ctx(unw_cursor_t *cursor, DISPATCHER_CONTEXT *disp); +static int __unw_init_seh(unw_cursor_t *cursor, CONTEXT *ctx); +static DISPATCHER_CONTEXT *__unw_seh_get_disp_ctx(unw_cursor_t *cursor); +static void __unw_seh_set_disp_ctx(unw_cursor_t *cursor, + DISPATCHER_CONTEXT *disp); /// Common implementation of SEH-style handler functions used by Itanium- /// style frames. Depending on how and why it was called, it may do one of: @@ -113,9 +114,9 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx, memset(exc->private_, 0, sizeof(exc->private_)); } if (!ctx) { - _unw_init_seh(&cursor, disp->ContextRecord); - _unw_seh_set_disp_ctx(&cursor, disp); - unw_set_reg(&cursor, UNW_REG_IP, disp->ControlPc-1); + __unw_init_seh(&cursor, disp->ContextRecord); + __unw_seh_set_disp_ctx(&cursor, disp); + __unw_set_reg(&cursor, UNW_REG_IP, disp->ControlPc - 1); ctx = (struct _Unwind_Context *)&cursor; if (!IS_UNWINDING(ms_exc->ExceptionFlags)) { @@ -172,18 +173,18 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx, _LIBUNWIND_ABORT("Personality installed context during phase 1!"); #ifdef __x86_64__ exc->private_[2] = disp->TargetIp; - unw_get_reg(&cursor, UNW_X86_64_RAX, &retval); - unw_get_reg(&cursor, UNW_X86_64_RDX, &exc->private_[3]); + __unw_get_reg(&cursor, UNW_X86_64_RAX, &retval); + __unw_get_reg(&cursor, UNW_X86_64_RDX, &exc->private_[3]); #elif defined(__arm__) exc->private_[2] = disp->TargetPc; - unw_get_reg(&cursor, UNW_ARM_R0, &retval); - unw_get_reg(&cursor, UNW_ARM_R1, &exc->private_[3]); + __unw_get_reg(&cursor, UNW_ARM_R0, &retval); + __unw_get_reg(&cursor, UNW_ARM_R1, &exc->private_[3]); #elif defined(__aarch64__) exc->private_[2] = disp->TargetPc; - unw_get_reg(&cursor, UNW_ARM64_X0, &retval); - unw_get_reg(&cursor, UNW_ARM64_X1, &exc->private_[3]); + __unw_get_reg(&cursor, UNW_ARM64_X0, &retval); + __unw_get_reg(&cursor, UNW_ARM64_X1, &exc->private_[3]); #endif - unw_get_reg(&cursor, UNW_REG_IP, &target); + __unw_get_reg(&cursor, UNW_REG_IP, &target); ms_exc->ExceptionCode = STATUS_GCC_UNWIND; #ifdef __x86_64__ ms_exc->ExceptionInformation[2] = disp->TargetIp; @@ -203,7 +204,7 @@ _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx, } } -/// Personality function returned by \c unw_get_proc_info() in SEH contexts. +/// Personality function returned by \c __unw_get_proc_info() in SEH contexts. /// This is a wrapper that calls the real SEH handler function, which in /// turn (at least, for Itanium-style frames) calls the real Itanium /// personality function (see \c _GCC_specific_handler()). @@ -221,7 +222,8 @@ __libunwind_seh_personality(int version, _Unwind_Action state, ms_exc.ExceptionInformation[0] = (ULONG_PTR)exc; ms_exc.ExceptionInformation[1] = (ULONG_PTR)context; ms_exc.ExceptionInformation[2] = state; - DISPATCHER_CONTEXT *disp_ctx = _unw_seh_get_disp_ctx((unw_cursor_t *)context); + DISPATCHER_CONTEXT *disp_ctx = + __unw_seh_get_disp_ctx((unw_cursor_t *)context); EXCEPTION_DISPOSITION ms_act = disp_ctx->LanguageHandler(&ms_exc, (PVOID)disp_ctx->EstablisherFrame, disp_ctx->ContextRecord, @@ -240,15 +242,15 @@ unwind_phase2_forced(unw_context_t *uc, _Unwind_Exception *exception_object, _Unwind_Stop_Fn stop, void *stop_parameter) { unw_cursor_t cursor2; - unw_init_local(&cursor2, uc); + __unw_init_local(&cursor2, uc); // Walk each frame until we reach where search phase said to stop - while (unw_step(&cursor2) > 0) { + while (__unw_step(&cursor2) > 0) { // Update info about this frame. unw_proc_info_t frameInfo; - if (unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): unw_step " + if (__unw_get_proc_info(&cursor2, &frameInfo) != UNW_ESUCCESS) { + _LIBUNWIND_TRACE_UNWINDING("unwind_phase2_forced(ex_ojb=%p): __unw_step " "failed => _URC_END_OF_STACK", (void *)exception_object); return _URC_FATAL_PHASE2_ERROR; @@ -259,8 +261,8 @@ unwind_phase2_forced(unw_context_t *uc, char functionBuf[512]; const char *functionName = functionBuf; unw_word_t offset; - if ((unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf), - &offset) != UNW_ESUCCESS) || + if ((__unw_get_proc_name(&cursor2, functionBuf, sizeof(functionBuf), + &offset) != UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip)) functionName = ".anonymous."; _LIBUNWIND_TRACE_UNWINDING( @@ -310,7 +312,7 @@ unwind_phase2_forced(unw_context_t *uc, "_URC_INSTALL_CONTEXT", (void *)exception_object); // We may get control back if landing pad calls _Unwind_Resume(). - unw_resume(&cursor2); + __unw_resume(&cursor2); break; default: // Personality routine returned an unknown result code. @@ -375,7 +377,7 @@ _Unwind_Resume(_Unwind_Exception *exception_object) { if (exception_object->private_[0] != 0) { unw_context_t uc; - unw_getcontext(&uc); + __unw_getcontext(&uc); unwind_phase2_forced(&uc, exception_object, (_Unwind_Stop_Fn) exception_object->private_[0], (void *)exception_object->private_[4]); @@ -413,7 +415,7 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object, _LIBUNWIND_TRACE_API("_Unwind_ForcedUnwind(ex_obj=%p, stop=%p)", (void *)exception_object, (void *)(uintptr_t)stop); unw_context_t uc; - unw_getcontext(&uc); + __unw_getcontext(&uc); // Mark that this is a forced unwind, so _Unwind_Resume() can do // the right thing. @@ -427,7 +429,8 @@ _Unwind_ForcedUnwind(_Unwind_Exception *exception_object, /// Called by personality handler during phase 2 to get LSDA for current frame. _LIBUNWIND_EXPORT uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) { - uintptr_t result = (uintptr_t)_unw_seh_get_disp_ctx((unw_cursor_t *)context)->HandlerData; + uintptr_t result = + (uintptr_t)__unw_seh_get_disp_ctx((unw_cursor_t *)context)->HandlerData; _LIBUNWIND_TRACE_API( "_Unwind_GetLanguageSpecificData(context=%p) => 0x%" PRIxPTR, (void *)context, result); @@ -438,15 +441,14 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) { /// function. _LIBUNWIND_EXPORT uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context) { - DISPATCHER_CONTEXT *disp = _unw_seh_get_disp_ctx((unw_cursor_t *)context); + DISPATCHER_CONTEXT *disp = __unw_seh_get_disp_ctx((unw_cursor_t *)context); uintptr_t result = (uintptr_t)disp->FunctionEntry->BeginAddress + disp->ImageBase; _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%" PRIxPTR, (void *)context, result); return result; } -static int -_unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) { +static int __unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) { #ifdef _LIBUNWIND_TARGET_X86_64 new (reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor)) UnwindCursor<LocalAddressSpace, Registers_x86_64>( @@ -473,8 +475,7 @@ _unw_init_seh(unw_cursor_t *cursor, CONTEXT *context) { #endif } -static DISPATCHER_CONTEXT * -_unw_seh_get_disp_ctx(unw_cursor_t *cursor) { +static DISPATCHER_CONTEXT *__unw_seh_get_disp_ctx(unw_cursor_t *cursor) { #ifdef _LIBUNWIND_TARGET_X86_64 return reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor)->getDispatcherContext(); #elif defined(_LIBUNWIND_TARGET_ARM) @@ -486,8 +487,8 @@ _unw_seh_get_disp_ctx(unw_cursor_t *cursor) { #endif } -static void -_unw_seh_set_disp_ctx(unw_cursor_t *cursor, DISPATCHER_CONTEXT *disp) { +static void __unw_seh_set_disp_ctx(unw_cursor_t *cursor, + DISPATCHER_CONTEXT *disp) { #ifdef _LIBUNWIND_TARGET_X86_64 reinterpret_cast<UnwindCursor<LocalAddressSpace, Registers_x86_64> *>(cursor)->setDispatcherContext(disp); #elif defined(_LIBUNWIND_TARGET_ARM) |