[io-layer] Extract error (#4279)
[mono.git] / mono / mini / debugger-agent.c
index 7402923f8ba1a05d9aae11f4b8e6e6c0bf620424..dd0e7353bd5ed0a6b6ef34835370eed6b5f37409 100644 (file)
 #include <mono/metadata/environment.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/threadpool.h>
-#include <mono/metadata/socket-io.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/runtime.h>
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/reflection-internals.h>
+#include <mono/metadata/w32socket.h>
 #include <mono/utils/mono-coop-mutex.h>
 #include <mono/utils/mono-coop-semaphore.h>
 #include <mono/utils/mono-error-internals.h>
@@ -75,7 +75,7 @@
 #include "debugger-agent.h"
 #include "mini.h"
 #include "seq-points.h"
-#include <mono/io-layer/io-layer.h>
+#include <mono/utils/w32api.h>
 
 /*
  * On iOS we can't use System.Environment.Exit () as it will do the wrong
@@ -5236,6 +5236,21 @@ ss_start (SingleStepReq *ss_req, MonoMethod *method, SeqPoint* sp, MonoSeqPointI
                        nframes = tls->frame_count;
                }
 
+               /* Need to stop in catch clauses as well */
+               for (i = ss_req->depth == STEP_DEPTH_OUT ? 1 : 0; i < nframes; ++i) {
+                       StackFrame *frame = frames [i];
+
+                       if (frame->ji) {
+                               MonoJitInfo *jinfo = frame->ji;
+                               for (j = 0; j < jinfo->num_clauses; ++j) {
+                                       MonoJitExceptionInfo *ei = &jinfo->clauses [j];
+
+                                       if (mono_find_next_seq_point_for_native_offset (frame->domain, frame->method, (char*)ei->handler_start - (char*)jinfo->code_start, NULL, &local_sp))
+                                               ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, frame->method, local_sp.il_offset);
+                               }
+                       }
+               }
+
                /*
                 * Find the first sequence point in the current or in a previous frame which
                 * is not the last in its method.
@@ -5322,26 +5337,6 @@ ss_start (SingleStepReq *ss_req, MonoMethod *method, SeqPoint* sp, MonoSeqPointI
                        ss_req->depth = STEP_DEPTH_INTO;
                }
 
-               if (ss_req->depth == STEP_DEPTH_OVER) {
-                       /* Need to stop in catch clauses as well */
-                       for (i = 0; i < nframes; ++i) {
-                               StackFrame *frame = frames [i];
-
-                               if (frame->ji) {
-                                       MonoJitInfo *jinfo = frame->ji;
-                                       for (j = 0; j < jinfo->num_clauses; ++j) {
-                                               MonoJitExceptionInfo *ei = &jinfo->clauses [j];
-
-                                               found_sp = mono_find_next_seq_point_for_native_offset (frame->domain, frame->method, (char*)ei->handler_start - (char*)jinfo->code_start, NULL, &local_sp);
-                                               sp = (found_sp)? &local_sp : NULL;
-
-                                               if (found_sp)
-                                                       ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, frame->method, sp->il_offset);
-                                       }
-                               }
-                       }
-               }
-
                if (ss_req->depth == STEP_DEPTH_INTO) {
                        /* Enable global stepping so we stop at method entry too */
                        enable_global = TRUE;