Skip to content

Commit ae0eb0f

Browse files
committed
Trying to continue all threads if eval Abort() and RudeAbort() failed for many times. Maybe this may help to avoid hanging evaluations. (Moved from MD repo)
1 parent e1f7852 commit ae0eb0f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Mono.Debugging.Win32/CorMethodCall.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,22 @@ protected override Task<OperationResult<CorValue>> InvokeAsyncImpl ()
101101
protected override void AbortImpl (int abortCallTimes)
102102
{
103103
if (abortCallTimes < 10) {
104-
DebuggerLoggingService.LogMessage ("Calling Abort()");
104+
DebuggerLoggingService.LogMessage ("Calling Abort() for {0} time", abortCallTimes);
105105
eval.Abort ();
106106
}
107107
else {
108-
DebuggerLoggingService.LogMessage ("Calling RudeAbort()");
108+
if (abortCallTimes == 20) {
109+
// if Abort() and RudeAbort() didn't bring any result let's try to resume all the threads to free possible deadlocks in target process
110+
// maybe this can help to abort hanging evaluations
111+
DebuggerLoggingService.LogMessage ("RudeAbort() didn't stop eval after {0} times", abortCallTimes - 1);
112+
DebuggerLoggingService.LogMessage ("Calling Stop()");
113+
context.Session.Process.Stop (0);
114+
DebuggerLoggingService.LogMessage ("Calling SetAllThreadsDebugState(THREAD_RUN)");
115+
context.Session.Process.SetAllThreadsDebugState (CorDebugThreadState.THREAD_RUN, null);
116+
DebuggerLoggingService.LogMessage ("Calling Continue()");
117+
context.Session.Process.Continue (false);
118+
}
119+
DebuggerLoggingService.LogMessage ("Calling RudeAbort() for {0} time", abortCallTimes);
109120
eval.RudeAbort();
110121
}
111122
}

0 commit comments

Comments
 (0)