Browse Source

Apply thread-suspend rules for threads created during the stepping

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5176 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
36a37b020a
  1. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs
  2. 13
      src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs
  3. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Options.cs
  4. 10
      src/AddIns/Misc/Debugger/Debugger.Core/Process.cs
  5. 4
      src/AddIns/Misc/Debugger/Debugger.Core/StackFrame.cs
  6. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs
  7. 19
      src/AddIns/Misc/Debugger/Debugger.Tests/Tests/ExpressionEvaluator_Tests.cs

4
src/AddIns/Misc/Debugger/Debugger.Core/Eval.cs

@ -119,9 +119,9 @@ namespace Debugger @@ -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);
}
}

13
src/AddIns/Misc/Debugger/Debugger.Core/ManagedCallback.cs

@ -53,7 +53,7 @@ namespace Debugger @@ -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 @@ -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 @@ -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();
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Options.cs

@ -17,6 +17,6 @@ namespace Debugger @@ -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;
}
}

10
src/AddIns/Misc/Debugger/Debugger.Core/Process.cs

@ -416,10 +416,12 @@ namespace Debugger @@ -416,10 +416,12 @@ namespace Debugger
/// </summary>
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 @@ -447,6 +449,10 @@ namespace Debugger
}
}
if (newThreadState != null) {
this.NewThreadState = newThreadState.Value;
}
NotifyResumed(action);
corProcess.Continue(0);
if (this.Options.Verbose) {

4
src/AddIns/Misc/Debugger/Debugger.Core/StackFrame.cs

@ -219,9 +219,9 @@ namespace Debugger @@ -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);
}
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Thread.cs

@ -227,7 +227,7 @@ namespace Debugger @@ -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;
}

19
src/AddIns/Misc/Debugger/Debugger.Tests/Tests/ExpressionEvaluator_Tests.cs

@ -145,6 +145,7 @@ namespace Debugger.Tests @@ -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 { @@ -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 { @@ -437,19 +438,9 @@ namespace Debugger.Tests {
<TypeResulution> typeof(Debugger.Tests.ExpressionEvaluator_Tests.A&lt;System.Int32&gt;.B.C&lt;System.Char&gt;[][,]) = Debugger.Tests.ExpressionEvaluator_Tests+A`1+B+C`1[System.Int32,System.Char][,][] (ok)</TypeResulution>
<TypesIdentitcal>True</TypesIdentitcal>
<TypesEqual>True</TypesEqual>
<WorkerThreadMoved>
<Value
AsString="True"
PrimitiveValue="True"
Type="System.Boolean" />
</WorkerThreadMoved>
<DebuggingPaused>StepComplete ExpressionEvaluator_Tests.cs:148,3-148,4</DebuggingPaused>
<WorkerThreadMoved>
<Value
AsString="True"
PrimitiveValue="True"
Type="System.Boolean" />
</WorkerThreadMoved>
<WorkerThreadMoved>False</WorkerThreadMoved>
<DebuggingPaused>Break ExpressionEvaluator_Tests.cs:148,4-148,40</DebuggingPaused>
<WorkerThreadMoved>True</WorkerThreadMoved>
<ProcessExited />
</Test>
</DebuggerTests>

Loading…
Cancel
Save