ReactOS 0.4.16-dev-2104-gb84fa49
except.c File Reference
#include <float.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "msvcrt.h"
#include "excpt.h"
#include "wincon.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "cppexcept.h"
Include dependency graph for except.c:

Go to the source code of this file.

Classes

struct  cxx_catch_ctx
 
struct  se_translator_ctx
 
struct  __std_exception_data
 

Macros

#define WIN32_NO_STATUS
 

Typedefs

typedef void(CDECLfloat_handler) (int, int)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (seh)
 
void dump_function_descr (const cxx_function_descr *descr, uintptr_t base)
 
voidfind_catch_handler (void *object, uintptr_t frame, uintptr_t exc_base, const tryblock_info *tryblock, cxx_exception_type *exc_type, uintptr_t image_base)
 
static int ip_to_state (const cxx_function_descr *descr, uintptr_t ip, uintptr_t base)
 
static void cxx_local_unwind (ULONG_PTR frame, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr, int last_level)
 
static LONG CALLBACK cxx_rethrow_filter (PEXCEPTION_POINTERS eptrs, void *c)
 
static void CALLBACK cxx_catch_cleanup (BOOL normal, void *c)
 
static void *WINAPI call_catch_block (EXCEPTION_RECORD *rec)
 
static BOOL cxx_is_consolidate (const EXCEPTION_RECORD *rec)
 
static void find_catch_block (EXCEPTION_RECORD *rec, CONTEXT *context, EXCEPTION_RECORD *untrans_rec, ULONG_PTR frame, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr, cxx_exception_type *info, ULONG_PTR orig_frame)
 
static LONG CALLBACK se_translation_filter (EXCEPTION_POINTERS *ep, void *c)
 
static void check_noexcept (PEXCEPTION_RECORD rec, const cxx_function_descr *descr, BOOL nested)
 
static DWORD cxx_frame_handler (EXCEPTION_RECORD *rec, ULONG_PTR frame, CONTEXT *context, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr)
 
EXCEPTION_DISPOSITION CDECL __CxxFrameHandler (EXCEPTION_RECORD *rec, ULONG_PTR frame, CONTEXT *context, DISPATCHER_CONTEXT *dispatch)
 
static BOOL WINAPI msvcrt_console_handler (DWORD ctrlType)
 
void **CDECL __pxcptinfoptrs (void)
 
static LONG msvcrt_exception_filter (struct _EXCEPTION_POINTERS *except)
 
void msvcrt_init_signals (void)
 
void msvcrt_free_signals (void)
 
__sighandler_t CDECL signal (int sig, __sighandler_t func)
 
int CDECL raise (int sig)
 
int CDECL _XcptFilter (NTSTATUS ex, PEXCEPTION_POINTERS ptr)
 
int CDECL __CppXcptFilter (NTSTATUS ex, PEXCEPTION_POINTERS ptr)
 
BOOL CDECL __CxxDetectRethrow (PEXCEPTION_POINTERS ptrs)
 
int CDECL __CxxExceptionFilter (EXCEPTION_POINTERS *ptrs, const type_info *ti, UINT flags, void **copy)
 
unsigned int CDECL __CxxQueryExceptionSize (void)
 
int CDECL __intrinsic_abnormal_termination (void)
 
BOOL CDECL __uncaught_exception (void)
 
int __cdecl _fpieee_flt (__msvcrt_ulong code, EXCEPTION_POINTERS *ep, int(__cdecl *handler)(_FPIEEE_RECORD *))
 
frame_info *CDECL _CreateFrameInfo (frame_info *fi, void *obj)
 
void CDECL _FindAndUnlinkFrame (frame_info *fi)
 
BOOL __cdecl _IsExceptionObjectToBeDestroyed (const void *obj)
 
void CDECL __DestructExceptionObject (EXCEPTION_RECORD *rec)
 
BOOL CDECL __CxxRegisterExceptionObject (EXCEPTION_POINTERS *ep, cxx_frame_info *frame_info)
 
void CDECL __CxxUnregisterExceptionObject (cxx_frame_info *frame_info, BOOL in_use)
 

Variables

static __sighandler_t sighandlers [NSIG] = { SIG_DFL }
 
struct {
   NTSTATUS   status
 
   int   signal
 
float_exception_map []
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 30 of file except.c.

Typedef Documentation

◆ float_handler

typedef void(CDECL * float_handler) (int, int)

Definition at line 533 of file except.c.

Function Documentation

◆ __CppXcptFilter()

int CDECL __CppXcptFilter ( NTSTATUS  ex,
PEXCEPTION_POINTERS  ptr 
)

Definition at line 741 of file except.c.

742{
743 /* only filter c++ exceptions */
745 return _XcptFilter(ex, ptr);
746}
#define CXX_EXCEPTION
Definition: cppexcept.h:34
int CDECL _XcptFilter(NTSTATUS ex, PEXCEPTION_POINTERS ptr)
Definition: except.c:731
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:91
static PVOID ptr
Definition: dispmode.c:27
Definition: comerr.c:44

◆ __CxxDetectRethrow()

BOOL CDECL __CxxDetectRethrow ( PEXCEPTION_POINTERS  ptrs)

Definition at line 751 of file except.c.

752{
754
755 if (!ptrs)
756 return FALSE;
757
758 rec = ptrs->ExceptionRecord;
759 if (is_cxx_exception( rec ) && rec->ExceptionInformation[2])
760 {
761 ptrs->ExceptionRecord = msvcrt_get_thread_data()->exc_record;
762 return TRUE;
763 }
764 return (msvcrt_get_thread_data()->exc_record == rec);
765}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL is_cxx_exception(EXCEPTION_RECORD *rec)
Definition: cppexcept.h:146
thread_data_t *CDECL msvcrt_get_thread_data(void)
Definition: thread.c:45
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213

◆ __CxxExceptionFilter()

int CDECL __CxxExceptionFilter ( EXCEPTION_POINTERS ptrs,
const type_info ti,
UINT  flags,
void **  copy 
)

Definition at line 770 of file except.c.

771{
772 const cxx_type_info *type;
773 EXCEPTION_RECORD *rec;
774 uintptr_t exc_base;
775
776 TRACE( "%p %p %x %p\n", ptrs, ti, flags, copy );
777
778 if (!ptrs) return EXCEPTION_CONTINUE_SEARCH;
779
780 /* handle catch(...) */
781 if (!ti) return EXCEPTION_EXECUTE_HANDLER;
782
783 rec = ptrs->ExceptionRecord;
785
786 if (rec->ExceptionInformation[1] == 0 && rec->ExceptionInformation[2] == 0)
787 {
788 rec = msvcrt_get_thread_data()->exc_record;
789 if (!rec) return EXCEPTION_CONTINUE_SEARCH;
790 }
791
792 exc_base = rec->ExceptionInformation[3];
794 if (!type) return EXCEPTION_CONTINUE_SEARCH;
795
796 if (copy) copy_exception( (void *)rec->ExceptionInformation[1], copy, flags, type, exc_base );
797
799}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
static const cxx_type_info * find_caught_type(cxx_exception_type *exc_type, uintptr_t base, const type_info *catch_ti, UINT catch_flags)
Definition: cppexcept.h:214
static void copy_exception(void *object, void **dest, UINT catch_flags, const cxx_type_info *type, uintptr_t base)
Definition: cppexcept.h:241
unsigned int uintptr_t
Definition: corecrt.h:185
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLbitfield flags
Definition: glext.h:7161
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define TRACE(s)
Definition: solgame.cpp:4

◆ __CxxFrameHandler()

EXCEPTION_DISPOSITION CDECL __CxxFrameHandler ( EXCEPTION_RECORD rec,
ULONG_PTR  frame,
CONTEXT context,
DISPATCHER_CONTEXT dispatch 
)

Definition at line 497 of file except.c.

499{
500 TRACE( "%p %Ix %p %p\n", rec, frame, context, dispatch );
501 return cxx_frame_handler( rec, frame, context, dispatch,
502 rtti_rva(*(UINT *)dispatch->HandlerData, dispatch->ImageBase) );
503}
void dispatch(HANDLE hStopEvent)
Definition: dispatch.c:70
static void * rtti_rva(unsigned int rva, uintptr_t base)
Definition: cxx.h:469
static DWORD cxx_frame_handler(EXCEPTION_RECORD *rec, ULONG_PTR frame, CONTEXT *context, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr)
Definition: except.c:371
unsigned int UINT
Definition: ndis.h:50
Definition: http.c:7252

◆ __CxxQueryExceptionSize()

unsigned int CDECL __CxxQueryExceptionSize ( void  )

Definition at line 804 of file except.c.

805{
806 return sizeof(cxx_exception_type);
807}

◆ __CxxRegisterExceptionObject()

BOOL CDECL __CxxRegisterExceptionObject ( EXCEPTION_POINTERS ep,
cxx_frame_info frame_info 
)

Definition at line 968 of file except.c.

969{
971
972 TRACE("(%p, %p)\n", ep, frame_info);
973
974 if (!ep || !ep->ExceptionRecord)
975 {
976 frame_info->rec = (void*)-1;
977 frame_info->context = (void*)-1;
978 return TRUE;
979 }
980
981 frame_info->rec = data->exc_record;
982 frame_info->context = data->ctx_record;
983 data->exc_record = ep->ExceptionRecord;
984 data->ctx_record = ep->ContextRecord;
986 return TRUE;
987}
frame_info *CDECL _CreateFrameInfo(frame_info *fi, void *obj)
Definition: except.c:889
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
PCONTEXT ContextRecord
Definition: rtltypes.h:201

Referenced by call_catch_block().

◆ __CxxUnregisterExceptionObject()

void CDECL __CxxUnregisterExceptionObject ( cxx_frame_info frame_info,
BOOL  in_use 
)

Definition at line 992 of file except.c.

993{
995
996 TRACE("(%p)\n", frame_info);
997
998 if(frame_info->rec == (void*)-1)
999 return;
1000
1001 _FindAndUnlinkFrame(&frame_info->frame_info);
1002 if(data->exc_record->ExceptionCode == CXX_EXCEPTION && !in_use
1003 && _IsExceptionObjectToBeDestroyed((void*)data->exc_record->ExceptionInformation[1]))
1004 __DestructExceptionObject(data->exc_record);
1005 data->exc_record = frame_info->rec;
1006 data->ctx_record = frame_info->context;
1007}
void CDECL __DestructExceptionObject(EXCEPTION_RECORD *rec)
Definition: except.c:950
void CDECL _FindAndUnlinkFrame(frame_info *fi)
Definition: except.c:904
BOOL __cdecl _IsExceptionObjectToBeDestroyed(const void *obj)
Definition: except.c:932

Referenced by cxx_catch_cleanup().

◆ __DestructExceptionObject()

void CDECL __DestructExceptionObject ( EXCEPTION_RECORD rec)

Definition at line 950 of file except.c.

951{
953 void *object = (void*)rec->ExceptionInformation[1];
954
955 TRACE("(%p)\n", rec);
956
957 if (!is_cxx_exception( rec )) return;
958
959 if (!info || !info->destructor)
960 return;
961
962 call_dtor( rtti_rva( info->destructor, rec->ExceptionInformation[3] ), object );
963}
static void call_dtor(void *func, void *this)
Definition: cppexcept.h:207

Referenced by __CxxUnregisterExceptionObject(), call_catch_block(), and se_translation_filter().

◆ __intrinsic_abnormal_termination()

int CDECL __intrinsic_abnormal_termination ( void  )

Definition at line 812 of file except.c.

813{
814 FIXME("(void)stub\n");
815 return 0;
816}
#define FIXME(fmt,...)
Definition: precomp.h:53

◆ __pxcptinfoptrs()

void **CDECL __pxcptinfoptrs ( void  )

Definition at line 528 of file except.c.

529{
530 return (void**)&msvcrt_get_thread_data()->xcptinfo;
531}

Referenced by msvcrt_exception_filter(), raise(), sighandler(), and test___pxcptinfoptrs().

◆ __uncaught_exception()

BOOL CDECL __uncaught_exception ( void  )

Definition at line 821 of file except.c.

822{
823 return msvcrt_get_thread_data()->processing_throw != 0;
824}

◆ _CreateFrameInfo()

frame_info *CDECL _CreateFrameInfo ( frame_info fi,
void obj 
)

Definition at line 889 of file except.c.

890{
892
893 TRACE("(%p, %p)\n", fi, obj);
894
895 fi->next = data->frame_info_head;
896 data->frame_info_head = fi;
897 fi->object = obj;
898 return fi;
899}

Referenced by __CxxRegisterExceptionObject().

◆ _FindAndUnlinkFrame()

void CDECL _FindAndUnlinkFrame ( frame_info fi)

Definition at line 904 of file except.c.

905{
907 frame_info *cur = data->frame_info_head;
908
909 TRACE("(%p)\n", fi);
910
911 if (cur == fi)
912 {
913 data->frame_info_head = cur->next;
914 return;
915 }
916
917 for (; cur->next; cur = cur->next)
918 {
919 if (cur->next == fi)
920 {
921 cur->next = fi->next;
922 return;
923 }
924 }
925
926 ERR("frame not found, native crashes in this case\n");
927}
#define ERR(fmt,...)
Definition: precomp.h:57
FxCollectionEntry * cur

Referenced by __CxxUnregisterExceptionObject().

◆ _fpieee_flt()

int __cdecl _fpieee_flt ( __msvcrt_ulong  code,
EXCEPTION_POINTERS ep,
int(__cdecl *handler)(_FPIEEE_RECORD *)   
)

Definition at line 829 of file except.c.

831{
832 switch (code)
833 {
839 return handle_fpieee_flt( code, ep, handler );
840 default:
842 }
843}
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
int handle_fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep, int(__cdecl *handler)(_FPIEEE_RECORD *))
#define STATUS_FLOAT_UNDERFLOW
Definition: ntstatus.h:477
#define STATUS_FLOAT_OVERFLOW
Definition: ntstatus.h:475
#define STATUS_FLOAT_DIVIDE_BY_ZERO
Definition: ntstatus.h:472
#define STATUS_FLOAT_INVALID_OPERATION
Definition: ntstatus.h:474
#define STATUS_FLOAT_INEXACT_RESULT
Definition: ntstatus.h:473
Definition: inflate.c:139

◆ _IsExceptionObjectToBeDestroyed()

BOOL __cdecl _IsExceptionObjectToBeDestroyed ( const void obj)

Definition at line 932 of file except.c.

933{
935
936 TRACE( "%p\n", obj );
937
938 for (cur = msvcrt_get_thread_data()->frame_info_head; cur; cur = cur->next)
939 {
940 if (cur->object == obj)
941 return FALSE;
942 }
943
944 return TRUE;
945}

Referenced by __CxxUnregisterExceptionObject().

◆ _XcptFilter()

int CDECL _XcptFilter ( NTSTATUS  ex,
PEXCEPTION_POINTERS  ptr 
)

Definition at line 731 of file except.c.

732{
733 TRACE("(%08lx,%p)\n", ex, ptr);
734 /* I assume ptr->ExceptionRecord->ExceptionCode is the same as ex */
736}
static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
Definition: except.c:550

Referenced by __CppXcptFilter().

◆ call_catch_block()

static void *WINAPI call_catch_block ( EXCEPTION_RECORD rec)
static

Definition at line 210 of file except.c.

211{
212 ULONG_PTR frame = rec->ExceptionInformation[1];
213 const cxx_function_descr *descr = (void*)rec->ExceptionInformation[2];
214 EXCEPTION_RECORD *untrans_rec = (void*)rec->ExceptionInformation[4];
215 EXCEPTION_RECORD *prev_rec = (void*)rec->ExceptionInformation[6];
216 CONTEXT *context = (void*)rec->ExceptionInformation[7];
217 int *unwind_help = (int *)(frame + descr->unwind_help);
218 EXCEPTION_POINTERS ep = { prev_rec, context };
220 void *ret_addr = NULL;
221
222 ctx.rethrow = FALSE;
223 ctx.prev_rec = prev_rec;
224 __CxxRegisterExceptionObject(&ep, &ctx.frame_info);
225 msvcrt_get_thread_data()->processing_throw--;
226 __TRY
227 {
228 __TRY
229 {
230 ret_addr = call_catch_handler( rec );
231 }
233 {
234 TRACE("detect rethrow: exception code: %lx\n", prev_rec->ExceptionCode);
235 ctx.rethrow = TRUE;
236
237 if (untrans_rec)
238 {
240 RaiseException(untrans_rec->ExceptionCode, untrans_rec->ExceptionFlags,
241 untrans_rec->NumberParameters, untrans_rec->ExceptionInformation);
242 }
243 else
244 {
245 RaiseException(prev_rec->ExceptionCode, prev_rec->ExceptionFlags,
246 prev_rec->NumberParameters, prev_rec->ExceptionInformation);
247 }
248 }
250 }
252
253 unwind_help[0] = -2;
254 unwind_help[1] = -1;
255 return ret_addr;
256}
#define NULL
Definition: types.h:112
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
void * call_catch_handler(EXCEPTION_RECORD *rec)
static void CALLBACK cxx_catch_cleanup(BOOL normal, void *c)
Definition: except.c:204
BOOL CDECL __CxxRegisterExceptionObject(EXCEPTION_POINTERS *ep, cxx_frame_info *frame_info)
Definition: except.c:968
static LONG CALLBACK cxx_rethrow_filter(PEXCEPTION_POINTERS eptrs, void *c)
Definition: except.c:190
const char * descr
Definition: boot.c:45
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
DWORD ExceptionFlags
Definition: compat.h:209
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define __EXCEPT_CTX(func, ctx)
Definition: exception.h:63
#define __FINALLY_CTX(func, ctx)
Definition: exception.h:68

Referenced by cxx_is_consolidate(), and find_catch_block().

◆ check_noexcept()

static void check_noexcept ( PEXCEPTION_RECORD  rec,
const cxx_function_descr descr,
BOOL  nested 
)
static

Definition at line 359 of file except.c.

361{
362 if (!nested && rec->ExceptionCode == CXX_EXCEPTION &&
363 descr->magic >= CXX_FRAME_MAGIC_VC8 &&
364 (descr->flags & FUNC_DESCR_NOEXCEPT))
365 {
366 ERR("noexcept function propagating exception\n");
367 terminate();
368 }
369}
void CDECL terminate(void)
Definition: cpp.c:698
#define CXX_FRAME_MAGIC_VC8
Definition: cppexcept.h:33
#define FUNC_DESCR_NOEXCEPT
Definition: cppexcept.h:135
UINT WINAPI nested(MSIHANDLE hinst)
Definition: custom.c:565

Referenced by cxx_frame_handler().

◆ cxx_catch_cleanup()

static void CALLBACK cxx_catch_cleanup ( BOOL  normal,
void c 
)
static

Definition at line 204 of file except.c.

205{
207 __CxxUnregisterExceptionObject(&ctx->frame_info, ctx->rethrow);
208}
void CDECL __CxxUnregisterExceptionObject(cxx_frame_info *frame_info, BOOL in_use)
Definition: except.c:992
#define c
Definition: ke_i.h:80

Referenced by call_catch_block().

◆ cxx_frame_handler()

static DWORD cxx_frame_handler ( EXCEPTION_RECORD rec,
ULONG_PTR  frame,
CONTEXT context,
DISPATCHER_CONTEXT dispatch,
const cxx_function_descr descr 
)
static

Definition at line 371 of file except.c.

374{
375 int trylevel = ip_to_state( descr, get_exception_pc(dispatch), dispatch->ImageBase );
376 cxx_exception_type *exc_type;
377 ULONG_PTR orig_frame = frame;
378 ULONG_PTR throw_base;
379 DWORD throw_func_off;
380 void *throw_func;
381 UINT i, j;
382 int unwindlevel = -1;
383
385 {
386 FIXME("unhandled frame magic %x\n", descr->magic);
388 }
389
390 if (descr->magic >= CXX_FRAME_MAGIC_VC8 &&
391 (descr->flags & FUNC_DESCR_SYNCHRONOUS) &&
392 (rec->ExceptionCode != CXX_EXCEPTION &&
393 !cxx_is_consolidate(rec) &&
395 return ExceptionContinueSearch; /* handle only c++ exceptions */
396
397 /* update orig_frame if it's a nested exception */
398 throw_func_off = RtlLookupFunctionEntry(dispatch->ControlPc, &throw_base, NULL)->BeginAddress;
399 throw_func = rtti_rva(throw_func_off, throw_base);
400 TRACE("reconstructed handler pointer: %p\n", throw_func);
401 for (i=descr->tryblock_count; i>0; i--)
402 {
403 const tryblock_info *tryblock = rtti_rva(descr->tryblock, dispatch->ImageBase);
404 tryblock = &tryblock[i-1];
405
406 if (trylevel>tryblock->end_level && trylevel<=tryblock->catch_level)
407 {
408 for (j=0; j<tryblock->catchblock_count; j++)
409 {
410 const catchblock_info *catchblock = rtti_rva(tryblock->catchblock, dispatch->ImageBase);
411 catchblock = &catchblock[j];
412
413 if (rtti_rva(catchblock->handler, dispatch->ImageBase) == throw_func)
414 {
415 unwindlevel = tryblock->end_level;
416#ifdef _WIN64
417 orig_frame = *(ULONG_PTR *)(frame + catchblock->frame);
418#else
419 orig_frame = *(ULONG_PTR *)frame;
420#endif
421 TRACE("nested exception detected, setting orig_frame to %Ix\n", orig_frame);
422 }
423 }
424 }
425 }
426
428 {
430 cxx_local_unwind(orig_frame, dispatch, descr,
431 cxx_is_consolidate(rec) ? rec->ExceptionInformation[3] : trylevel);
432 else
433 cxx_local_unwind(orig_frame, dispatch, descr, unwindlevel);
435 }
436 if (!descr->tryblock_count)
437 {
438 check_noexcept(rec, descr, orig_frame != frame);
440 }
441
442 if (rec->ExceptionCode == CXX_EXCEPTION &&
443 (!rec->ExceptionInformation[1] && !rec->ExceptionInformation[2]))
444 {
445 TRACE("rethrow detected.\n");
446 *rec = *msvcrt_get_thread_data()->exc_record;
447 }
448 if (rec->ExceptionCode == CXX_EXCEPTION)
449 {
450 exc_type = (cxx_exception_type *)rec->ExceptionInformation[2];
451
452 if (TRACE_ON(seh))
453 {
454 TRACE("handling C++ exception rec %p frame %Ix descr %p\n", rec, frame, descr);
457 }
458 }
459 else
460 {
462
463 exc_type = NULL;
464 TRACE("handling C exception code %lx rec %p frame %Ix descr %p\n",
465 rec->ExceptionCode, rec, frame, descr);
466
467 if (data->se_translator) {
468 EXCEPTION_POINTERS except_ptrs;
470
471 ctx.dest_frame = frame;
472 ctx.orig_frame = orig_frame;
473 ctx.seh_rec = rec;
474 ctx.dispatch = dispatch;
475 ctx.descr = descr;
476 __TRY
477 {
478 except_ptrs.ExceptionRecord = rec;
479 except_ptrs.ContextRecord = context;
480 data->se_translator(rec->ExceptionCode, &except_ptrs);
481 }
483 {
484 }
486 }
487 }
488
489 find_catch_block(rec, context, NULL, frame, dispatch, descr, exc_type, orig_frame);
490 check_noexcept(rec, descr, orig_frame != frame);
492}
@ ExceptionContinueSearch
Definition: compat.h:91
#define TRACE_ON(x)
Definition: compat.h:75
#define CXX_FRAME_MAGIC_VC6
Definition: cppexcept.h:31
#define TRACE_EXCEPTION_TYPE(type, base)
Definition: cppexcept.h:265
#define FUNC_DESCR_SYNCHRONOUS
Definition: cppexcept.h:134
ULONG_PTR get_exception_pc(DISPATCHER_CONTEXT *dispatch)
static int ip_to_state(const cxx_function_descr *descr, uintptr_t ip, uintptr_t base)
Definition: except.c:151
static void check_noexcept(PEXCEPTION_RECORD rec, const cxx_function_descr *descr, BOOL nested)
Definition: except.c:359
static void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context, EXCEPTION_RECORD *untrans_rec, ULONG_PTR frame, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr, cxx_exception_type *info, ULONG_PTR orig_frame)
Definition: except.c:265
static void cxx_local_unwind(ULONG_PTR frame, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr, int last_level)
Definition: except.c:163
static BOOL cxx_is_consolidate(const EXCEPTION_RECORD *rec)
Definition: except.c:258
static LONG CALLBACK se_translation_filter(EXCEPTION_POINTERS *ep, void *c)
Definition: except.c:339
void dump_function_descr(const cxx_function_descr *descr, uintptr_t base)
Definition: except.c:50
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
if(dx< 0)
Definition: linetemp.h:194
#define STATUS_LONGJUMP
Definition: ntstatus.h:297
NTSYSAPI PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(ULONG_PTR, ULONG_PTR *, UNWIND_HISTORY_TABLE *)
UINT catchblock_count
Definition: cppexcept.h:107
UINT catchblock
Definition: cppexcept.h:108
#define EXCEPTION_EXIT_UNWIND
Definition: rtltypes.h:156
#define EXCEPTION_UNWINDING
Definition: rtltypes.h:155
#define EXCEPTION_TARGET_UNWIND
Definition: rtltypes.h:159

Referenced by __CxxFrameHandler().

◆ cxx_is_consolidate()

static BOOL cxx_is_consolidate ( const EXCEPTION_RECORD rec)
inlinestatic

Definition at line 258 of file except.c.

259{
261 rec->NumberParameters > 10 &&
263}
static void *WINAPI call_catch_block(EXCEPTION_RECORD *rec)
Definition: except.c:210
#define STATUS_UNWIND_CONSOLIDATE
Definition: ntstatus.h:300

Referenced by cxx_frame_handler().

◆ cxx_local_unwind()

static void cxx_local_unwind ( ULONG_PTR  frame,
DISPATCHER_CONTEXT dispatch,
const cxx_function_descr descr,
int  last_level 
)
static

Definition at line 163 of file except.c.

165{
166 const unwind_info *unwind_table = rtti_rva(descr->unwind_table, dispatch->ImageBase);
167 int *unwind_help = (int *)(frame + descr->unwind_help);
168 int trylevel = unwind_help[0];
169
170 if (trylevel == -2) trylevel = ip_to_state( descr, get_exception_pc(dispatch), dispatch->ImageBase );
171
172 TRACE("current level: %d, last level: %d\n", trylevel, last_level);
173 while (trylevel > last_level)
174 {
175 if (trylevel<0 || trylevel>=descr->unwind_count)
176 {
177 ERR("invalid trylevel %d\n", trylevel);
178 terminate();
179 }
180 if (unwind_table[trylevel].handler)
181 {
182 void *handler = rtti_rva( unwind_table[trylevel].handler, dispatch->ImageBase );
184 }
185 trylevel = unwind_table[trylevel].prev;
186 }
187 unwind_help[0] = trylevel;
188}
void * call_unwind_handler(void *func, uintptr_t frame, DISPATCHER_CONTEXT *dispatch)

Referenced by cxx_frame_handler().

◆ cxx_rethrow_filter()

static LONG CALLBACK cxx_rethrow_filter ( PEXCEPTION_POINTERS  eptrs,
void c 
)
static

Definition at line 190 of file except.c.

191{
192 EXCEPTION_RECORD *rec = eptrs->ExceptionRecord;
194
195 if (rec->ExceptionCode != CXX_EXCEPTION)
197 if (!rec->ExceptionInformation[1] && !rec->ExceptionInformation[2])
199 if (rec->ExceptionInformation[1] == ctx->prev_rec->ExceptionInformation[1])
200 ctx->rethrow = TRUE;
202}

Referenced by call_catch_block().

◆ dump_function_descr()

void dump_function_descr ( const cxx_function_descr descr,
uintptr_t  base 
)

Definition at line 50 of file except.c.

51{
52 unwind_info *unwind_table = rtti_rva( descr->unwind_table, base );
53 tryblock_info *tryblock = rtti_rva( descr->tryblock, base );
54 ipmap_info *ipmap = rtti_rva( descr->ipmap, base );
55 UINT i, j;
56
57 TRACE( "magic %x\n", descr->magic );
58 TRACE( "unwind table: %p %d\n", unwind_table, descr->unwind_count );
59 for (i = 0; i < descr->unwind_count; i++)
60 {
61 TRACE(" %d: prev %d func %p\n", i, unwind_table[i].prev,
62 unwind_table[i].handler ? rtti_rva( unwind_table[i].handler, base ) : NULL );
63 }
64 TRACE( "try table: %p %d\n", tryblock, descr->tryblock_count );
65 for (i = 0; i < descr->tryblock_count; i++)
66 {
67 catchblock_info *catchblock = rtti_rva( tryblock[i].catchblock, base );
68
69 TRACE( " %d: start %d end %d catchlevel %d catch %p %d\n", i,
70 tryblock[i].start_level, tryblock[i].end_level,
71 tryblock[i].catch_level, catchblock, tryblock[i].catchblock_count);
72 for (j = 0; j < tryblock[i].catchblock_count; j++)
73 {
74 type_info *type_info = catchblock[j].type_info ? rtti_rva( catchblock[j].type_info, base ) : NULL;
75 TRACE( " %d: flags %x offset %d handler %p",
76 j, catchblock[j].flags, catchblock[j].offset,
77 catchblock[j].handler ? rtti_rva(catchblock[j].handler, base) : NULL );
78#ifdef _WIN64
79 TRACE( " frame %x", catchblock[j].frame );
80#endif
81 TRACE( " type %p %s\n", type_info, dbgstr_type_info(type_info) );
82 }
83 }
84 TRACE( "ipmap: %p %d\n", ipmap, descr->ipmap_count );
85 for (i = 0; i < descr->ipmap_count; i++)
86 TRACE( " %d: ip %x state %d\n", i, ipmap[i].ip, ipmap[i].state );
87#ifdef RTTI_USE_RVA
88 TRACE( "unwind_help %+d\n", descr->unwind_help );
89#endif
90 if (descr->magic <= CXX_FRAME_MAGIC_VC6) return;
91 TRACE( "expect list: %p\n", rtti_rva( descr->expect_list, base ) );
92 if (descr->magic <= CXX_FRAME_MAGIC_VC7) return;
93 TRACE( "flags: %08x\n", descr->flags );
94}
static int state
Definition: maze.c:121
static const char * dbgstr_type_info(const type_info *info)
Definition: cppexcept.h:169
#define CXX_FRAME_MAGIC_VC7
Definition: cppexcept.h:32
GLintptr offset
Definition: glext.h:5920
Definition: dhcpd.h:62

Referenced by cxx_frame_handler().

◆ find_catch_block()

static void find_catch_block ( EXCEPTION_RECORD rec,
CONTEXT context,
EXCEPTION_RECORD untrans_rec,
ULONG_PTR  frame,
DISPATCHER_CONTEXT dispatch,
const cxx_function_descr descr,
cxx_exception_type info,
ULONG_PTR  orig_frame 
)
inlinestatic

Definition at line 265 of file except.c.

270{
271 ULONG_PTR exc_base = (rec->NumberParameters == 4 ? rec->ExceptionInformation[3] : 0);
272 void *handler, *object = (void *)rec->ExceptionInformation[1];
273 int trylevel = ip_to_state( descr, get_exception_pc(dispatch), dispatch->ImageBase );
275 const tryblock_info *in_catch;
276 EXCEPTION_RECORD catch_record;
277 CONTEXT ctx;
278 UINT i;
279 INT *unwind_help;
280
281 data->processing_throw++;
282 for (i=descr->tryblock_count; i>0; i--)
283 {
284 in_catch = rtti_rva(descr->tryblock, dispatch->ImageBase);
285 in_catch = &in_catch[i-1];
286
287 if (trylevel>in_catch->end_level && trylevel<=in_catch->catch_level)
288 break;
289 }
290 if (!i)
291 in_catch = NULL;
292
293 unwind_help = (int *)(orig_frame + descr->unwind_help);
294 if (trylevel > unwind_help[1])
295 unwind_help[0] = unwind_help[1] = trylevel;
296 else
297 trylevel = unwind_help[1];
298 TRACE("current trylevel: %d\n", trylevel);
299
300 for (i=0; i<descr->tryblock_count; i++)
301 {
302 const tryblock_info *tryblock = rtti_rva(descr->tryblock, dispatch->ImageBase);
303 tryblock = &tryblock[i];
304
305 if (trylevel < tryblock->start_level) continue;
306 if (trylevel > tryblock->end_level) continue;
307
308 if (in_catch)
309 {
310 if(tryblock->start_level <= in_catch->end_level) continue;
311 if(tryblock->end_level > in_catch->catch_level) continue;
312 }
313
314 handler = find_catch_handler( object, orig_frame, exc_base, tryblock, info, dispatch->ImageBase );
315 if (!handler) continue;
316
317 /* unwind stack and call catch */
318 memset(&catch_record, 0, sizeof(catch_record));
321 catch_record.NumberParameters = 11;
323 catch_record.ExceptionInformation[1] = orig_frame;
324 catch_record.ExceptionInformation[2] = (ULONG_PTR)descr;
325 catch_record.ExceptionInformation[3] = tryblock->start_level;
326 catch_record.ExceptionInformation[4] = (ULONG_PTR)untrans_rec;
327 catch_record.ExceptionInformation[5] = (ULONG_PTR)handler;
328 /* tyFlow expects ExceptionInformation[6] to contain exception record */
329 catch_record.ExceptionInformation[6] = (ULONG_PTR)rec;
330 catch_record.ExceptionInformation[7] = (ULONG_PTR)context;
331 catch_record.ExceptionInformation[10] = -1;
332 RtlUnwindEx((void*)frame, (void*)dispatch->ControlPc, &catch_record, NULL, &ctx, NULL);
333 }
334
335 TRACE("no matching catch block found\n");
336 data->processing_throw--;
337}
void * find_catch_handler(void *object, uintptr_t frame, uintptr_t exc_base, const tryblock_info *tryblock, cxx_exception_type *exc_type, uintptr_t image_base)
Definition: except.c:96
#define ULONG_PTR
Definition: config.h:101
NTSYSAPI void WINAPI RtlUnwindEx(void *, void *, EXCEPTION_RECORD *, void *, CONTEXT *, UNWIND_HISTORY_TABLE *)
#define memset(x, y, z)
Definition: compat.h:39
#define EXCEPTION_NONCONTINUABLE
Definition: stubs.h:23
int32_t INT
Definition: typedefs.h:58

Referenced by cxx_frame_handler(), and se_translation_filter().

◆ find_catch_handler()

void * find_catch_handler ( void object,
uintptr_t  frame,
uintptr_t  exc_base,
const tryblock_info tryblock,
cxx_exception_type exc_type,
uintptr_t  image_base 
)

Definition at line 96 of file except.c.

99{
100 unsigned int i;
101 const catchblock_info *catchblock = rtti_rva( tryblock->catchblock, image_base );
102 const cxx_type_info *type;
103 const type_info *catch_ti;
104
105 for (i = 0; i < tryblock->catchblock_count; i++)
106 {
107 if (exc_type)
108 {
109 catch_ti = catchblock[i].type_info ? rtti_rva( catchblock[i].type_info, image_base ) : NULL;
110 type = find_caught_type( exc_type, exc_base, catch_ti, catchblock[i].flags );
111 if (!type) continue;
112
113 TRACE( "matched type %p in catchblock %d\n", type, i );
114
115 if (catch_ti && catch_ti->mangled[0] && catchblock[i].offset)
116 {
117 /* copy the exception to its destination on the stack */
118 void **dest = (void **)(frame + catchblock[i].offset);
119 copy_exception( object, dest, catchblock[i].flags, type, exc_base );
120 }
121 }
122 else
123 {
124 /* no CXX_EXCEPTION only proceed with a catch(...) block*/
125 if (catchblock[i].type_info) continue;
126 TRACE( "found catch(...) block\n" );
127 }
128 return rtti_rva( catchblock[i].handler, image_base );
129 }
130 return NULL;
131}
static void * image_base(void)
Definition: dll_register.c:28
static char * dest
Definition: rtl.c:135
char mangled[128]
Definition: cxx.h:335

Referenced by find_catch_block().

◆ ip_to_state()

static int ip_to_state ( const cxx_function_descr descr,
uintptr_t  ip,
uintptr_t  base 
)
inlinestatic

Definition at line 151 of file except.c.

152{
153 const ipmap_info *ipmap = rtti_rva( descr->ipmap, base );
154 unsigned int i;
155 int ret;
156
157 for (i = 0; i < descr->ipmap_count; i++) if (base + ipmap[i].ip > ip) break;
158 ret = i ? ipmap[i - 1].state : -1;
159 TRACE( "%Ix -> %d\n", ip, ret );
160 return ret;
161}
return ret
Definition: mutex.c:146
int state
Definition: cppexcept.h:39

Referenced by cxx_frame_handler(), cxx_local_unwind(), and find_catch_block().

◆ msvcrt_console_handler()

static BOOL WINAPI msvcrt_console_handler ( DWORD  ctrlType)
static

Definition at line 507 of file except.c.

508{
509 BOOL ret = FALSE;
510
511 switch (ctrlType)
512 {
513 case CTRL_C_EVENT:
514 if (sighandlers[SIGINT])
515 {
516 if (sighandlers[SIGINT] != SIG_IGN)
518 ret = TRUE;
519 }
520 break;
521 }
522 return ret;
523}
static __sighandler_t sighandlers[NSIG]
Definition: except.c:48
#define SIGINT
Definition: signal.h:25
#define SIG_IGN
Definition: signal.h:42
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CTRL_C_EVENT
Definition: wincon.h:96

Referenced by msvcrt_free_signals(), and msvcrt_init_signals().

◆ msvcrt_exception_filter()

static LONG msvcrt_exception_filter ( struct _EXCEPTION_POINTERS except)
static

Definition at line 550 of file except.c.

551{
554
555 if (!except || !except->ExceptionRecord)
557
558 switch (except->ExceptionRecord->ExceptionCode)
559 {
562 {
563 if (handler != SIG_IGN)
564 {
566
567 old_ep = *ep;
568 *ep = except;
571 *ep = old_ep;
572 }
574 }
575 break;
576 /* According to msdn,
577 * the FPE signal handler takes as a second argument the type of
578 * floating point exception.
579 */
587 if ((handler = sighandlers[SIGFPE]) != SIG_DFL)
588 {
589 if (handler != SIG_IGN)
590 {
592 unsigned int i;
593 int float_signal = _FPE_INVALID;
594
596 for (i = 0; i < ARRAY_SIZE(float_exception_map); i++)
597 {
599 except->ExceptionRecord->ExceptionCode)
600 {
601 float_signal = float_exception_map[i].signal;
602 break;
603 }
604 }
605
606 old_ep = *ep;
607 *ep = except;
608 ((float_handler)handler)(SIGFPE, float_signal);
609 *ep = old_ep;
610 }
612 }
613 break;
616 if ((handler = sighandlers[SIGILL]) != SIG_DFL)
617 {
618 if (handler != SIG_IGN)
619 {
621
622 old_ep = *ep;
623 *ep = except;
626 *ep = old_ep;
627 }
629 }
630 break;
631 }
632 return ret;
633}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define except(x)
Definition: btrfs_drv.h:136
static const struct @575 float_exception_map[]
void **CDECL __pxcptinfoptrs(void)
Definition: except.c:528
void(CDECL * float_handler)(int, int)
Definition: except.c:533
#define _FPE_INVALID
Definition: float.h:119
#define SIG_DFL
Definition: signal.h:41
#define SIGILL
Definition: signal.h:26
void(__cdecl * __sighandler_t)(int)
Definition: signal.h:39
#define SIGFPE
Definition: signal.h:27
#define SIGSEGV
Definition: signal.h:28
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:92
#define EXCEPTION_FLT_STACK_CHECK
Definition: minwinbase.h:54
#define EXCEPTION_FLT_UNDERFLOW
Definition: minwinbase.h:55
#define EXCEPTION_FLT_OVERFLOW
Definition: minwinbase.h:53
#define EXCEPTION_FLT_DENORMAL_OPERAND
Definition: minwinbase.h:49
#define EXCEPTION_FLT_INEXACT_RESULT
Definition: minwinbase.h:51
#define EXCEPTION_ILLEGAL_INSTRUCTION
Definition: minwinbase.h:60
#define EXCEPTION_ACCESS_VIOLATION
Definition: minwinbase.h:44
#define EXCEPTION_FLT_INVALID_OPERATION
Definition: minwinbase.h:52
#define EXCEPTION_PRIV_INSTRUCTION
Definition: minwinbase.h:58
#define EXCEPTION_FLT_DIVIDE_BY_ZERO
Definition: minwinbase.h:50
long LONG
Definition: pedump.c:60
Definition: ps.c:97

Referenced by _XcptFilter().

◆ msvcrt_free_signals()

void msvcrt_free_signals ( void  )

Definition at line 640 of file except.c.

641{
643}
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
Definition: console.c:2111
static BOOL WINAPI msvcrt_console_handler(DWORD ctrlType)
Definition: except.c:507

Referenced by DllMain().

◆ msvcrt_init_signals()

void msvcrt_init_signals ( void  )

Definition at line 635 of file except.c.

Referenced by DllMain().

◆ raise()

int CDECL raise ( int  sig)

Definition at line 682 of file except.c.

683{
685
686 TRACE("(%d)\n", sig);
687
688 switch (sig)
689 {
690 case SIGFPE:
691 case SIGILL:
692 case SIGSEGV:
693 handler = sighandlers[sig];
694 if (handler == SIG_DFL) _exit(3);
695 if (handler != SIG_IGN)
696 {
698
699 sighandlers[sig] = SIG_DFL;
700
701 old_ep = *ep;
702 *ep = NULL;
703 if (sig == SIGFPE)
705 else
706 handler(sig);
707 *ep = old_ep;
708 }
709 break;
710 case SIGABRT:
711 case SIGINT:
712 case SIGTERM:
713 case SIGBREAK:
714 handler = sighandlers[sig];
715 if (handler == SIG_DFL) _exit(3);
716 if (handler != SIG_IGN)
717 {
718 sighandlers[sig] = SIG_DFL;
719 handler(sig);
720 }
721 break;
722 default:
723 return -1;
724 }
725 return 0;
726}
void CDECL _exit(int exitcode)
Definition: exit.c:187
#define _FPE_EXPLICITGEN
Definition: float.h:129
#define SIGTERM
Definition: signal.h:29
#define SIGABRT
Definition: signal.h:31
#define SIGBREAK
Definition: signal.h:30

Referenced by _CrtHandleDbgReport(), _wassert(), abort(), common_assert_to_message_box(), common_message_window(), getline(), test___pxcptinfoptrs(), and test_signal().

◆ se_translation_filter()

static LONG CALLBACK se_translation_filter ( EXCEPTION_POINTERS ep,
void c 
)
static

Definition at line 339 of file except.c.

340{
343 cxx_exception_type *exc_type;
344
345 if (rec->ExceptionCode != CXX_EXCEPTION)
346 {
347 TRACE("non-c++ exception thrown in SEH handler: %lx\n", rec->ExceptionCode);
348 terminate();
349 }
350
351 exc_type = (cxx_exception_type *)rec->ExceptionInformation[2];
352 find_catch_block(rec, ep->ContextRecord, ctx->seh_rec, ctx->dest_frame, ctx->dispatch,
353 ctx->descr, exc_type, ctx->orig_frame);
354
357}
const GLubyte * c
Definition: glext.h:8905

Referenced by cxx_frame_handler().

◆ signal()

__sighandler_t CDECL signal ( int  sig,
__sighandler_t  func 
)

Definition at line 650 of file except.c.

651{
653
654 TRACE("(%d, %p)\n", sig, func);
655
656 if (func == SIG_ERR) return SIG_ERR;
657
658 switch (sig)
659 {
660 /* Cases handled internally. Note SIGTERM is never generated by Windows,
661 * so we effectively mask it.
662 */
663 case SIGABRT:
664 case SIGFPE:
665 case SIGILL:
666 case SIGSEGV:
667 case SIGINT:
668 case SIGTERM:
669 case SIGBREAK:
670 ret = sighandlers[sig];
671 sighandlers[sig] = func;
672 break;
673 default:
674 ret = SIG_ERR;
675 }
676 return ret;
677}
#define SIG_ERR
Definition: signal.h:43
GLenum func
Definition: glext.h:6028

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( seh  )

Variable Documentation

◆ 

const struct { ... } float_exception_map[]

◆ sighandlers

__sighandler_t sighandlers[NSIG] = { SIG_DFL }
static

Definition at line 48 of file except.c.

Referenced by msvcrt_console_handler(), msvcrt_exception_filter(), raise(), and signal().

◆ signal

◆ status

Definition at line 538 of file except.c.