Skip to content

Commit

Permalink
Revert "[DebuggerSession] Avoid using a dispatch queue for stepping"
Browse files Browse the repository at this point in the history
This reverts commit 8d2ae31.
  • Loading branch information
jstedfast committed Jan 22, 2020
1 parent 4ee9c84 commit 9e257ce
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 42 deletions.
1 change: 1 addition & 0 deletions Mono.Debugging.Soft/SoftDebuggerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ protected override void OnNextLine ()

void Step (StepDepth depth, StepSize size)
{

ThreadPool.QueueUserWorkItem (delegate {
try {
Adaptor.CancelAsyncOperations (); // This call can block, so it has to run in background thread to avoid keeping the main session lock
Expand Down
94 changes: 52 additions & 42 deletions Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,16 @@ public void NextLine ()
{
lock (slock) {
OnRunning ();
StartStepTimer (StepOverStats);
try {
OnNextLine ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
Dispatch (delegate {
StartStepTimer (StepOverStats);
try {
OnNextLine ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
});
}
}

Expand All @@ -518,14 +520,16 @@ public void StepLine ()
{
lock (slock) {
OnRunning ();
StartStepTimer (StepInStats);
try {
OnStepLine ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
Dispatch (delegate {
StartStepTimer (StepInStats);
try {
OnStepLine ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
});
}
}

Expand All @@ -536,14 +540,16 @@ public void NextInstruction ()
{
lock (slock) {
OnRunning ();
StartStepTimer (NextInstructionStats);
try {
OnNextInstruction ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
Dispatch (delegate {
StartStepTimer (NextInstructionStats);
try {
OnNextInstruction ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
});
}
}

Expand All @@ -554,14 +560,16 @@ public void StepInstruction ()
{
lock (slock) {
OnRunning ();
StartStepTimer (StepInstructionStats);
try {
OnStepInstruction ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
Dispatch (delegate {
StartStepTimer (StepInstructionStats);
try {
OnStepInstruction ();
} catch (Exception ex) {
ForceStop ();
if (!HandleException (ex))
throw;
}
});
}
}

Expand All @@ -572,16 +580,18 @@ public void Finish ()
{
lock (slock) {
OnRunning ();
StartStepTimer (StepOutStats);
try {
OnFinish ();
} catch (Exception ex) {
// should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state
var exceptionHandled = HandleException (ex);
ForceExit ();
if (!exceptionHandled)
throw;
}
Dispatch (delegate {
StartStepTimer (StepOutStats);
try {
OnFinish ();
} catch (Exception ex) {
// should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state
var exceptionHandled = HandleException (ex);
ForceExit ();
if (!exceptionHandled)
throw;
}
});
}
}

Expand Down

0 comments on commit 9e257ce

Please sign in to comment.