From: Vlad Brezae Date: Wed, 4 Aug 2021 15:29:22 +0000 (+0300) Subject: [interp] Retain trace during exception checkpoint (#56825) X-Git-Tag: accepted/tizen/unified/20220110.054933~658 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e74f18146f70c372b29626eb3ca23c82e9bf265e;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [interp] Retain trace during exception checkpoint (#56825) When an exception needs to cross a native boundary, it can be caught by the runtime invoke wrapper and this exception will end up as a pending exception. With JIT, the initial managed to native wrapper will check for a pending exception and will use a CEE_MONO_RETHROW opcode in order to preserve the stacktrace. With the interp we do the exception checkpoint outside of the native wrapper, and we need to do it in rethrow fashion (without clearing the original trace). --- diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index d43b388..8005a99 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -1024,7 +1024,7 @@ interp_throw (ThreadContext *context, MonoException *ex, InterpFrame *frame, con if (mono_thread_interruption_request_flag && !mono_threads_is_critical_method (frame->imethod->method)) { \ MonoException *exc = mono_thread_interruption_checkpoint (); \ if (exc) \ - THROW_EX (exc, ip); \ + THROW_EX_GENERAL (exc, ip, TRUE); \ } \ } while (0) @@ -1034,7 +1034,7 @@ interp_throw (ThreadContext *context, MonoException *ex, InterpFrame *frame, con if (mono_thread_interruption_request_flag && !mono_threads_is_critical_method (frame->imethod->method) && mono_thread_is_gc_unsafe_mode ()) { \ MonoException *exc = mono_thread_interruption_checkpoint (); \ if (exc) \ - THROW_EX (exc, ip); \ + THROW_EX_GENERAL (exc, ip, TRUE); \ } \ } while (0)