Module: wine Branch: master Commit: 9177a75acc36b6d593917262fb62f42098a1fcf2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=9177a75acc36b6d593917262f...
Author: Alexandre Julliard julliard@winehq.org Date: Tue May 14 13:14:35 2019 +0200
winecrt0: Store the appropriate longjmp() function in the exception frame.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winecrt0/exception.c | 2 +- include/wine/exception.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/winecrt0/exception.c b/dlls/winecrt0/exception.c index 8a7f2a5..98132fa 100644 --- a/dlls/winecrt0/exception.c +++ b/dlls/winecrt0/exception.c @@ -59,7 +59,7 @@ static void DECLSPEC_NORETURN unwind_target(void) { __WINE_FRAME *wine_frame = (__WINE_FRAME *)__wine_get_frame(); __wine_pop_frame( &wine_frame->frame ); - siglongjmp( wine_frame->jmp, 1 ); + for (;;) wine_frame->longjmp( wine_frame->jmp, 1 ); }
static void DECLSPEC_NORETURN unwind_frame( EXCEPTION_RECORD *record, diff --git a/include/wine/exception.h b/include/wine/exception.h index e93968f..f30807e 100644 --- a/include/wine/exception.h +++ b/include/wine/exception.h @@ -94,8 +94,8 @@ extern "C" {
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE_SETJMP_H) #define sigjmp_buf jmp_buf -#define sigsetjmp(buf,sigs) setjmp(buf) -#define siglongjmp(buf,val) longjmp(buf,val) +static inline int sigsetjmp( sigjmp_buf buf, int sigs ) { return setjmp( buf ); } +static inline void siglongjmp( sigjmp_buf buf, int val ) { longjmp( buf, val ); } #endif
extern void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record, @@ -139,6 +139,7 @@ extern DWORD __wine_finally_ctx_handler( EXCEPTION_RECORD *record, } else { \ __f.frame.Handler = __wine_exception_handler; \ __f.u.filter = (func); \ + __f.longjmp = siglongjmp; \ if (sigsetjmp( __f.jmp, 0 )) { \ const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \ do { @@ -151,6 +152,7 @@ extern DWORD __wine_finally_ctx_handler( EXCEPTION_RECORD *record, __f.frame.Handler = __wine_exception_ctx_handler; \ __f.u.filter_ctx = (func); \ __f.ctx = context; \ + __f.longjmp = siglongjmp; \ if (sigsetjmp( __f.jmp, 0 )) { \ const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \ do { @@ -162,6 +164,7 @@ extern DWORD __wine_finally_ctx_handler( EXCEPTION_RECORD *record, break; \ } else { \ __f.frame.Handler = __wine_exception_handler_page_fault; \ + __f.longjmp = siglongjmp; \ if (sigsetjmp( __f.jmp, 0 )) { \ const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \ do { @@ -173,6 +176,7 @@ extern DWORD __wine_finally_ctx_handler( EXCEPTION_RECORD *record, break; \ } else { \ __f.frame.Handler = __wine_exception_handler_all; \ + __f.longjmp = siglongjmp; \ if (sigsetjmp( __f.jmp, 0 )) { \ const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \ do { @@ -237,6 +241,7 @@ typedef struct __tagWINE_FRAME } u; void *ctx; sigjmp_buf jmp; + void (*longjmp)(sigjmp_buf,int); /* hack to make GetExceptionCode() work in handler */ DWORD ExceptionCode; const struct __tagWINE_FRAME *ExceptionRecord;