[debugger][android] Fixing single step inside Exception on Android (mono/mono#16596)
authorThays Grazia <thaystg@gmail.com>
Tue, 3 Sep 2019 20:28:37 +0000 (17:28 -0300)
committerSteve Pfister <steveisok@users.noreply.github.com>
Tue, 3 Sep 2019 20:28:37 +0000 (16:28 -0400)
* Fixing single step inside Exception on Android...
The method is null because on ss_create_init_args the IL is -1 when calling method Mono_UnhandledException_internal what I think it's expected, because of that I ignore the single step on android if there is no method. (debugger-engine.c)
After that the sequence point cannot be found because it's calling a method of class DynamicMethodNameCounter what I think it's expected, because of that I remove the assert on android. (debugger-agent.c)
Fixes mono/mono#14772

* Changing comment to make it clear...

Commit migrated from https://github.com/mono/mono/commit/1046dd746f3f99e97f034a2c2b51bdb4e19128ae

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

index 9f597e4..6585328 100644 (file)
@@ -4967,8 +4967,12 @@ ss_create_init_args (SingleStepReq *ss_req, SingleStepArgs *args)
                                found_sp = mono_find_prev_seq_point_for_native_offset (frame->de.domain, frame->de.method, frame->de.native_offset, &info, &args->sp);
                                if (!found_sp)
                                        no_seq_points_found (frame->de.method, frame->de.native_offset);
-                               g_assert (found_sp);
-                               method = frame->de.method;
+#if !defined(HOST_ANDROID) && !defined(TARGET_ANDROID)                                 
+                               g_assert (found_sp);                            
+#else
+                               if (found_sp) //it will not find the sp if it is a method of class Android.Runtime.DynamicMethodNameCounter
+#endif                         
+                                       method = frame->de.method;
                        }
                }
        }
index 4b50dbf..41bc23c 100644 (file)
@@ -1277,6 +1277,12 @@ 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) */
+       if (!method)
+               return;
+#endif         
+
        /*
         * Implement single stepping using breakpoints if possible.
         */