diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs
index 9538c79137..b80f9cce7e 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs
@@ -119,9 +119,9 @@ namespace Debugger
appDomain.Process.ActiveEvals.Add(this);
if (appDomain.Process.Options.SuspendOtherThreads) {
- appDomain.Process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] { thread });
+ appDomain.Process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] { thread }, CorDebugThreadState.THREAD_SUSPEND);
} else {
- appDomain.Process.AsyncContinue(DebuggeeStateAction.Keep, this.Process.UnsuspendedThreads);
+ appDomain.Process.AsyncContinue(DebuggeeStateAction.Keep, this.Process.UnsuspendedThreads, CorDebugThreadState.THREAD_RUN);
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs
index 5ee77b107b..d95a5bc82a 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs
@@ -53,7 +53,7 @@ namespace Debugger
if (process.IsPaused && process.PauseSession.PausedReason == PausedReason.ForcedBreak) {
process.TraceMessage("Processing post-break callback");
// This compensates for the break call and we are in normal callback handling mode
- process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] {});
+ process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] {}, null);
// Start of call back - create new pause session (as usual)
process.NotifyPaused(pausedReason);
// Make sure we stay pause after the callback is handled
@@ -88,17 +88,17 @@ namespace Debugger
if (hasQueuedCallbacks) {
// Exception has Exception2 queued after it
- process.AsyncContinue(DebuggeeStateAction.Keep, null);
+ process.AsyncContinue(DebuggeeStateAction.Keep, null, null);
} else if (process.Evaluating) {
// Ignore events during property evaluation
- process.AsyncContinue(DebuggeeStateAction.Keep, null);
+ process.AsyncContinue(DebuggeeStateAction.Keep, null, null);
} else if (pauseOnNextExit) {
if (process.Options.Verbose)
process.TraceMessage("Callback exit: Paused");
pauseOnNextExit = false;
Pause();
} else {
- process.AsyncContinue(DebuggeeStateAction.Keep, null);
+ process.AsyncContinue(DebuggeeStateAction.Keep, null, null);
}
isInCallback = false;
@@ -374,7 +374,10 @@ namespace Debugger
// and we continue from this callback anyway
EnterCallback(PausedReason.Other, "CreateThread " + pThread.GetID(), pAppDomain);
- process.Threads.Add(new Thread(process, pThread));
+ Thread thread = new Thread(process, pThread);
+ process.Threads.Add(thread);
+
+ thread.CorThread.SetDebugState(process.NewThreadState);
ExitCallback();
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Options.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Options.cs
index 28855bd793..97e4765d19 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Options.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Options.cs
@@ -17,6 +17,6 @@ namespace Debugger
public bool StepOverFieldAccessProperties = true;
public bool Verbose = false;
public string[] SymbolsSearchPaths = new string[0];
- public bool SuspendOtherThreads = false;
+ public bool SuspendOtherThreads = true;
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Process.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Process.cs
index 0ea378c4ea..985b7774cd 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Process.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Process.cs
@@ -416,10 +416,12 @@ namespace Debugger
///
public void AsyncContinue()
{
- AsyncContinue(DebuggeeStateAction.Clear, this.UnsuspendedThreads);
+ AsyncContinue(DebuggeeStateAction.Clear, this.UnsuspendedThreads, CorDebugThreadState.THREAD_RUN);
}
- internal void AsyncContinue(DebuggeeStateAction action, Thread[] threadsToRun)
+ internal CorDebugThreadState NewThreadState = CorDebugThreadState.THREAD_RUN;
+
+ internal void AsyncContinue(DebuggeeStateAction action, Thread[] threadsToRun, CorDebugThreadState? newThreadState)
{
AssertPaused();
@@ -447,6 +449,10 @@ namespace Debugger
}
}
+ if (newThreadState != null) {
+ this.NewThreadState = newThreadState.Value;
+ }
+
NotifyResumed(action);
corProcess.Continue(0);
if (this.Options.Verbose) {
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/StackFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/StackFrame.cs
index db349d8a2e..339ed81014 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/StackFrame.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/StackFrame.cs
@@ -219,9 +219,9 @@ namespace Debugger
void AsyncContinue()
{
if (process.Options.SuspendOtherThreads) {
- process.AsyncContinue(DebuggeeStateAction.Clear, new Thread[] { this.Thread });
+ process.AsyncContinue(DebuggeeStateAction.Clear, new Thread[] { this.Thread }, CorDebugThreadState.THREAD_SUSPEND);
} else {
- process.AsyncContinue(DebuggeeStateAction.Clear, this.Process.UnsuspendedThreads);
+ process.AsyncContinue(DebuggeeStateAction.Clear, this.Process.UnsuspendedThreads, CorDebugThreadState.THREAD_RUN);
}
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs
index 613c3f4639..db4ea38c65 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs
@@ -227,7 +227,7 @@ namespace Debugger
// May happen in release code with does not have any symbols
return false;
}
- process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] { this /* needed */ });
+ process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] { this /* needed */ }, null);
process.WaitForPause();
return true;
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Tests/ExpressionEvaluator_Tests.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Tests/ExpressionEvaluator_Tests.cs
index e15b2fd01f..3c9063ac7e 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Tests/Tests/ExpressionEvaluator_Tests.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Tests/ExpressionEvaluator_Tests.cs
@@ -145,6 +145,7 @@ namespace Debugger.Tests
System.Diagnostics.Debugger.Break();
bgWork.Start();
System.Threading.Thread.Sleep(100);
+ System.Diagnostics.Debugger.Break();
}
}
}
@@ -259,7 +260,7 @@ namespace Debugger.Tests {
ObjectDump("TypesEqual", locType == valType);
ObjectDump("WorkerThreadMoved", process.SelectedStackFrame.GetThisValue().GetMemberValue("WorkerThreadMoved").AsString);
- process.SelectedStackFrame.StepOver();
+ process.Continue();
ObjectDump("WorkerThreadMoved", process.SelectedStackFrame.GetThisValue().GetMemberValue("WorkerThreadMoved").AsString);
EndTest();
@@ -437,19 +438,9 @@ namespace Debugger.Tests {
typeof(Debugger.Tests.ExpressionEvaluator_Tests.A<System.Int32>.B.C<System.Char>[][,]) = Debugger.Tests.ExpressionEvaluator_Tests+A`1+B+C`1[System.Int32,System.Char][,][] (ok)
True
True
-
-
-
- StepComplete ExpressionEvaluator_Tests.cs:148,3-148,4
-
-
-
+ False
+ Break ExpressionEvaluator_Tests.cs:148,4-148,40
+ True