This is not really a MONO_DEBUG option, but easier to implement it this way.
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);
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)
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)) {
*/
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,