Commit 9999c59c authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ucrtbase: Add __processing_throw implementation.

parent f82af4d2
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
@ stub __intrinsic_abnormal_termination @ stub __intrinsic_abnormal_termination
@ cdecl -arch=i386,x86_64,arm,arm64 -norelay __intrinsic_setjmp(ptr) ucrtbase.__intrinsic_setjmp @ cdecl -arch=i386,x86_64,arm,arm64 -norelay __intrinsic_setjmp(ptr) ucrtbase.__intrinsic_setjmp
@ cdecl -arch=x86_64,arm64 -norelay __intrinsic_setjmpex(ptr ptr) ucrtbase.__intrinsic_setjmpex @ cdecl -arch=x86_64,arm64 -norelay __intrinsic_setjmpex(ptr ptr) ucrtbase.__intrinsic_setjmpex
@ stub __processing_throw @ cdecl __processing_throw() ucrtbase.__processing_throw
@ stub __report_gsfailure @ stub __report_gsfailure
@ cdecl __std_exception_copy(ptr ptr) ucrtbase.__std_exception_copy @ cdecl __std_exception_copy(ptr ptr) ucrtbase.__std_exception_copy
@ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy @ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy
......
...@@ -528,4 +528,13 @@ void** CDECL __current_exception_context(void) ...@@ -528,4 +528,13 @@ void** CDECL __current_exception_context(void)
return (void**)&msvcrt_get_thread_data()->ctx_record; return (void**)&msvcrt_get_thread_data()->ctx_record;
} }
/*********************************************************************
* __processing_throw (UCRTBASE.@)
*/
int* CDECL __processing_throw(void)
{
TRACE("()\n");
return &msvcrt_get_thread_data()->processing_throw;
}
#endif /* _MSVCR_VER>=140 */ #endif /* _MSVCR_VER>=140 */
...@@ -412,8 +412,9 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context, ...@@ -412,8 +412,9 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
struct catch_func_nested_frame nested_frame; struct catch_func_nested_frame nested_frame;
int trylevel = frame->trylevel; int trylevel = frame->trylevel;
DWORD save_esp = ((DWORD*)frame)[-1]; DWORD save_esp = ((DWORD*)frame)[-1];
thread_data_t *data; thread_data_t *data = msvcrt_get_thread_data();
data->processing_throw++;
for (i = 0; i < descr->tryblock_count; i++) for (i = 0; i < descr->tryblock_count; i++)
{ {
const tryblock_info *tryblock = &descr->tryblock[i]; const tryblock_info *tryblock = &descr->tryblock[i];
...@@ -456,11 +457,11 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context, ...@@ -456,11 +457,11 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
cxx_local_unwind( frame, descr, tryblock->start_level ); cxx_local_unwind( frame, descr, tryblock->start_level );
frame->trylevel = tryblock->end_level + 1; frame->trylevel = tryblock->end_level + 1;
data = msvcrt_get_thread_data();
nested_frame.frame_info.rec = data->exc_record; nested_frame.frame_info.rec = data->exc_record;
nested_frame.frame_info.context = data->ctx_record; nested_frame.frame_info.context = data->ctx_record;
data->exc_record = rec; data->exc_record = rec;
data->ctx_record = context; data->ctx_record = context;
data->processing_throw--;
/* call the catch block */ /* call the catch block */
TRACE( "calling catch block %p addr %p ebp %p\n", TRACE( "calling catch block %p addr %p ebp %p\n",
...@@ -483,6 +484,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context, ...@@ -483,6 +484,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
continue_after_catch( frame, addr ); continue_after_catch( frame, addr );
} }
} }
data->processing_throw--;
} }
/********************************************************************* /*********************************************************************
......
...@@ -363,6 +363,7 @@ static void* WINAPI call_catch_block(EXCEPTION_RECORD *rec) ...@@ -363,6 +363,7 @@ static void* WINAPI call_catch_block(EXCEPTION_RECORD *rec)
ctx.rethrow = FALSE; ctx.rethrow = FALSE;
__CxxRegisterExceptionObject(&ep, &ctx.frame_info); __CxxRegisterExceptionObject(&ep, &ctx.frame_info);
msvcrt_get_thread_data()->processing_throw--;
__TRY __TRY
{ {
__TRY __TRY
...@@ -410,12 +411,14 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context, ...@@ -410,12 +411,14 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context,
ULONG64 exc_base = (rec->NumberParameters == 4 ? rec->ExceptionInformation[3] : 0); ULONG64 exc_base = (rec->NumberParameters == 4 ? rec->ExceptionInformation[3] : 0);
int trylevel = ip_to_state(rva_to_ptr(descr->ipmap, dispatch->ImageBase), int trylevel = ip_to_state(rva_to_ptr(descr->ipmap, dispatch->ImageBase),
descr->ipmap_count, dispatch->ControlPc-dispatch->ImageBase); descr->ipmap_count, dispatch->ControlPc-dispatch->ImageBase);
thread_data_t *data = msvcrt_get_thread_data();
const tryblock_info *in_catch; const tryblock_info *in_catch;
EXCEPTION_RECORD catch_record; EXCEPTION_RECORD catch_record;
CONTEXT ctx; CONTEXT ctx;
UINT i, j; UINT i, j;
INT *unwind_help; INT *unwind_help;
data->processing_throw++;
for (i=descr->tryblock_count; i>0; i--) for (i=descr->tryblock_count; i>0; i--)
{ {
in_catch = rva_to_ptr(descr->tryblock, dispatch->ImageBase); in_catch = rva_to_ptr(descr->tryblock, dispatch->ImageBase);
...@@ -494,6 +497,7 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context, ...@@ -494,6 +497,7 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context,
} }
TRACE("no matching catch block found\n"); TRACE("no matching catch block found\n");
data->processing_throw--;
} }
static LONG CALLBACK se_translation_filter(EXCEPTION_POINTERS *ep, void *c) static LONG CALLBACK se_translation_filter(EXCEPTION_POINTERS *ep, void *c)
......
...@@ -260,6 +260,7 @@ struct __thread_data { ...@@ -260,6 +260,7 @@ struct __thread_data {
int unk7; int unk7;
EXCEPTION_RECORD *exc_record; EXCEPTION_RECORD *exc_record;
CONTEXT *ctx_record; CONTEXT *ctx_record;
int processing_throw;
frame_info *frame_info_head; frame_info *frame_info_head;
void *unk8[6]; void *unk8[6];
LCID cached_lcid; LCID cached_lcid;
......
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
@ cdecl __p__wenviron() MSVCRT___p__wenviron @ cdecl __p__wenviron() MSVCRT___p__wenviron
@ cdecl __p__wpgmptr() MSVCRT___p__wpgmptr @ cdecl __p__wpgmptr() MSVCRT___p__wpgmptr
@ cdecl __pctype_func() MSVCRT___pctype_func @ cdecl __pctype_func() MSVCRT___pctype_func
@ stub __processing_throw @ cdecl __processing_throw()
@ stub __pwctype_func @ stub __pwctype_func
@ cdecl __pxcptinfoptrs() MSVCRT___pxcptinfoptrs @ cdecl __pxcptinfoptrs() MSVCRT___pxcptinfoptrs
@ stub __report_gsfailure @ stub __report_gsfailure
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
@ cdecl __current_exception_context() ucrtbase.__current_exception_context @ cdecl __current_exception_context() ucrtbase.__current_exception_context
@ cdecl -arch=i386,x86_64,arm,arm64 -norelay __intrinsic_setjmp(ptr) ucrtbase.__intrinsic_setjmp @ cdecl -arch=i386,x86_64,arm,arm64 -norelay __intrinsic_setjmp(ptr) ucrtbase.__intrinsic_setjmp
@ cdecl -arch=x86_64,arm64 -norelay __intrinsic_setjmpex(ptr ptr) ucrtbase.__intrinsic_setjmpex @ cdecl -arch=x86_64,arm64 -norelay __intrinsic_setjmpex(ptr ptr) ucrtbase.__intrinsic_setjmpex
@ stub __processing_throw @ cdecl __processing_throw() ucrtbase.__processing_throw
@ stub __report_gsfailure @ stub __report_gsfailure
@ cdecl __std_exception_copy(ptr ptr) ucrtbase.__std_exception_copy @ cdecl __std_exception_copy(ptr ptr) ucrtbase.__std_exception_copy
@ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy @ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy
......
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