Skip to content

Commit

Permalink
Merge pull request dotnet#2321 from vargaz/top-runtime-invoke-opt
Browse files Browse the repository at this point in the history
[jit] Add a 'top-runtime-invoke-unhandled' option to treat exceptions which reach the top invoke frame as unhandled when embedding.
  • Loading branch information
vargaz authored Jan 30, 2020
2 parents be5645d + ea48050 commit b3fa13f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/mono/mono/mini/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ mono_jit_parse_options (int argc, char * argv[])
for (i = 0; i < argc; ++i) {
if (argv [i] [0] != '-')
break;
if (strncmp (argv [i], "--debugger-agent=", 17) == 0) {
if (strncmp (argv [i], "--debugger-agent=", 17) == 0) {
MonoDebugOptions *opt = mini_get_debug_options ();

sdb_options = g_strdup (argv [i] + 17);
Expand Down
9 changes: 7 additions & 2 deletions src/mono/mono/mini/mini-exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2731,10 +2731,15 @@ mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resu
if (unhandled)
mini_get_dbg_callbacks ()->handle_exception ((MonoException *)obj, ctx, NULL, NULL);
else if (!ji || (jinfo_get_method (ji)->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE)) {
if (last_mono_wrapper_runtime_invoke && !mono_thread_internal_current ()->threadpool_thread)
if (last_mono_wrapper_runtime_invoke && !mono_thread_internal_current ()->threadpool_thread) {
mini_get_dbg_callbacks ()->handle_exception ((MonoException *)obj, ctx, NULL, NULL);
else
if (mini_get_debug_options ()->top_runtime_invoke_unhandled) {
mini_set_abort_threshold (&catch_frame);
mono_unhandled_exception_internal (obj);
}
} else {
mini_get_dbg_callbacks ()->handle_exception ((MonoException *)obj, ctx, &ctx_cp, &catch_frame);
}
}
else if (res != MONO_FIRST_PASS_CALLBACK_TO_NATIVE)
if (!is_caught_unmanaged)
Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -3734,6 +3734,8 @@ mini_parse_debug_option (const char *option)
mini_debug_options.weak_memory_model = FALSE;
else if (!strcmp (option, "weak-memory-model"))
mini_debug_options.weak_memory_model = TRUE;
else if (!strcmp (option, "top-runtime-invoke-unhandled"))
mini_debug_options.top_runtime_invoke_unhandled = TRUE;
else if (!strncmp (option, "thread-dump-dir=", 16))
mono_set_thread_dump_dir(g_strdup(option + 16));
else if (!strncmp (option, "aot-skip=", 9)) {
Expand Down
7 changes: 6 additions & 1 deletion src/mono/mono/mini/mini-runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,13 @@ typedef struct MonoDebugOptions {
*/
gboolean aot_skip_set;
int aot_skip;
} MonoDebugOptions;

/*
* Treat exceptions which reach the topmost runtime invoke as unhandled when
* embedding.
*/
gboolean top_runtime_invoke_unhandled;
} MonoDebugOptions;

/*
* We need to store the image which the token refers to along with the token,
Expand Down

0 comments on commit b3fa13f

Please sign in to comment.