Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2020-01-30 23:59:31 +0300
committerGitHub <noreply@github.com>2020-01-30 23:59:30 +0300
commit04c01efd4997d1f58ecdc0310932df2f4eb84fe5 (patch)
treeefc9783ab697d1e26c3efdafd1ccfd718b24b45b
parent109a61227cffafee6f51b37d7817b8d7e901123d (diff)
[jit] Add a 'top-runtime-invoke-unhandled' option to treat exceptions which reach the top invoke frame as unhandled when embedding. (#18610)
This is not really a MONO_DEBUG option, but easier to implement it this way. Co-authored-by: Zoltan Varga <vargaz@gmail.com>
-rw-r--r--mono/mini/driver.c2
-rw-r--r--mono/mini/mini-exceptions.c9
-rw-r--r--mono/mini/mini-runtime.c2
-rw-r--r--mono/mini/mini-runtime.h7
4 files changed, 16 insertions, 4 deletions
diff --git a/mono/mini/driver.c b/mono/mini/driver.c
index d351d1f17ff..3971f03ec9f 100644
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -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);
diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c
index 8574bdf5c99..f000d579a45 100644
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -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)
diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c
index ae3d826bb2c..4da03218ad6 100644
--- a/mono/mini/mini-runtime.c
+++ b/mono/mini/mini-runtime.c
@@ -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)) {
diff --git a/mono/mini/mini-runtime.h b/mono/mini/mini-runtime.h
index 5fe776ebc79..91b80ab1e91 100644
--- a/mono/mini/mini-runtime.h
+++ b/mono/mini/mini-runtime.h
@@ -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,