Commit bdb44555 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Raise an exception if any Wine or Winelib code does an assert.

parent 629f02b3
......@@ -1040,6 +1040,26 @@ static HANDLER_DEF(int_handler)
}
}
/**********************************************************************
* abrt_handler
*
* Handler for SIGABRT.
*/
static HANDLER_DEF(abrt_handler)
{
EXCEPTION_RECORD rec;
CONTEXT context;
save_context( &context, HANDLER_CONTEXT );
rec.ExceptionCode = EXCEPTION_WINE_ASSERTION;
rec.ExceptionFlags = EH_NONCONTINUABLE;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = (LPVOID)context.Eip;
rec.NumberParameters = 0;
EXC_RtlRaiseException( &rec, &context ); /* Should never return.. */
restore_context( &context, HANDLER_CONTEXT );
}
/***********************************************************************
* set_handler
......@@ -1124,6 +1144,7 @@ BOOL SIGNAL_Init(void)
if (set_handler( SIGFPE, have_sigaltstack, (void (*)())fpe_handler ) == -1) goto error;
if (set_handler( SIGSEGV, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;
if (set_handler( SIGILL, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;
if (set_handler( SIGABRT, have_sigaltstack, (void (*)())abrt_handler ) == -1) goto error;
#ifdef SIGBUS
if (set_handler( SIGBUS, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;
#endif
......
......@@ -381,6 +381,26 @@ static HANDLER_DEF(int_handler)
}
}
/**********************************************************************
* abrt_handler
*
* Handler for SIGABRT.
*/
static HANDLER_DEF(abrt_handler)
{
EXCEPTION_RECORD rec;
CONTEXT context;
save_context( &context, HANDLER_CONTEXT );
rec.ExceptionCode = EXCEPTION_WINE_ASSERTION;
rec.ExceptionFlags = EH_NONCONTINUABLE;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = (LPVOID)context.Eip;
rec.NumberParameters = 0;
EXC_RtlRaiseException( &rec, &context ); /* Should never return.. */
restore_context( &context, HANDLER_CONTEXT );
}
/***********************************************************************
* set_handler
......@@ -440,6 +460,7 @@ BOOL SIGNAL_Init(void)
if (set_handler( SIGFPE, have_sigaltstack, (void (*)())fpe_handler ) == -1) goto error;
if (set_handler( SIGSEGV, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;
if (set_handler( SIGILL, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;
if (set_handler( SIGABRT, have_sigaltstack, (void (*)())abrt_handler ) == -1) goto error;
#ifdef SIGBUS
if (set_handler( SIGBUS, have_sigaltstack, (void (*)())segv_handler ) == -1) goto error;
#endif
......
......@@ -343,6 +343,25 @@ static void int_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
}
}
/**********************************************************************
* abrt_handler
*
* Handler for SIGABRT.
*/
static HANDLER_DEF(abrt_handler)
{
EXCEPTION_RECORD rec;
CONTEXT context;
save_context( &context, HANDLER_CONTEXT );
rec.ExceptionCode = EXCEPTION_WINE_ASSERTION;
rec.ExceptionFlags = EH_NONCONTINUABLE;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = (LPVOID)context.Eip;
rec.NumberParameters = 0;
EXC_RtlRaiseException( &rec, &context ); /* Should never return.. */
restore_context( &context, HANDLER_CONTEXT );
}
/***********************************************************************
* set_handler
......@@ -398,7 +417,8 @@ BOOL SIGNAL_Init(void)
if (set_handler( SIGILL, (void (*)())ill_handler ) == -1) goto error;
if (set_handler( SIGBUS, (void (*)())bus_handler ) == -1) goto error;
if (set_handler( SIGTRAP, (void (*)())trap_handler ) == -1) goto error;
return TRUE;
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
return TRUE;
error:
perror("sigaction");
......
......@@ -183,11 +183,12 @@ static inline EXCEPTION_FRAME * WINE_UNUSED __wine_pop_frame( EXCEPTION_FRAME *f
/* Wine-specific exceptions codes */
#define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */
#define EXCEPTION_WINE_ASSERTION 0x80000101 /* assertion failed */
/* unhandled return status from vm86 mode */
#define EXCEPTION_VM86_INTx 0x80000101
#define EXCEPTION_VM86_STI 0x80000102
#define EXCEPTION_VM86_PICRETURN 0x80000103
#define EXCEPTION_VM86_INTx 0x80000110
#define EXCEPTION_VM86_STI 0x80000111
#define EXCEPTION_VM86_PICRETURN 0x80000112
extern void __wine_enter_vm86( CONTEXT *context );
......
......@@ -556,6 +556,9 @@ static BOOL DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_chance, BOOL
DEBUG_Printf(DBG_CHN_MESG, "unimplemented function %s.%s called", dll, name );
}
break;
case EXCEPTION_WINE_ASSERTION:
DEBUG_Printf(DBG_CHN_MESG, "assertion failed");
break;
case EXCEPTION_VM86_INTx:
DEBUG_Printf(DBG_CHN_MESG, "interrupt %02lx in vm86 mode",
rec->ExceptionInformation[0]);
......
......@@ -135,6 +135,9 @@ static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, in
len = snprintf( buffer, size, "Unimplemented function %s.%s called",
(char *)rec->ExceptionInformation[0], (char *)rec->ExceptionInformation[1] );
break;
case EXCEPTION_WINE_ASSERTION:
len = snprintf( buffer, size, "Assertion failed" );
break;
case EXCEPTION_VM86_INTx:
len = snprintf( buffer, size, "Unhandled interrupt %02lx in vm86 mode",
rec->ExceptionInformation[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment