[debugger] Crash when debugging iOS application that throws (mono/mono#16958)
authorThays Grazia <thaystg@gmail.com>
Sun, 22 Sep 2019 19:12:10 +0000 (16:12 -0300)
committerGitHub <noreply@github.com>
Sun, 22 Sep 2019 19:12:10 +0000 (16:12 -0300)
* Doing the same fix from Android to IOS.
* On mini-exceptions.c check if there is no ji we can continue and generate the exception without checking wrapper_type.

Fixes mono/mono#16824

Commit migrated from https://github.com/mono/mono/commit/1a277c31a095a1b5b8212ed6c0425fad7bb4a42b

src/mono/mono/mini/debugger-engine.c
src/mono/mono/mini/mini-exceptions.c

index 41bc23c..fc5624c 100644 (file)
@@ -1277,11 +1277,9 @@ mono_de_ss_start (SingleStepReq *ss_req, SingleStepArgs *ss_args)
        int nframes = ss_args->nframes;
        SeqPoint *sp = &ss_args->sp;
 
-#if defined(HOST_ANDROID) || defined(TARGET_ANDROID)
-       /* this can happen on a single step in a exception on android (Mono_UnhandledException_internal) */
+       /* this can happen on a single step in a exception on android (Mono_UnhandledException_internal) and on IOS */
        if (!method)
                return;
-#endif         
 
        /*
         * Implement single stepping using breakpoints if possible.
index 1166cc2..512c039 100644 (file)
@@ -2688,7 +2688,7 @@ 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 (jinfo_get_method (ji)->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE) {
+                       else if (!ji || (jinfo_get_method (ji)->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE)) {
                                mini_get_dbg_callbacks ()->handle_exception ((MonoException *)obj, ctx, NULL, NULL);
                                mini_get_dbg_callbacks ()->handle_exception ((MonoException *)obj, ctx, &ctx_cp, &catch_frame);
                        }