From 0ef31e511796913cabd73bff74d937c6d5d5812a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Sun, 18 Aug 2013 14:34:59 +0100 Subject: [PATCH] Freeze all other threads during evaluation. --- src/AddIns/Debugger/Debugger.Core/Eval.cs | 2 +- src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs | 1 + src/AddIns/Debugger/Debugger.Core/Process.cs | 12 +++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.Core/Eval.cs b/src/AddIns/Debugger/Debugger.Core/Eval.cs index c429adf549..828f153e3f 100644 --- a/src/AddIns/Debugger/Debugger.Core/Eval.cs +++ b/src/AddIns/Debugger/Debugger.Core/Eval.cs @@ -134,7 +134,7 @@ namespace Debugger appDomain.Process.activeEvals.Add(this); - appDomain.Process.AsyncContinue(DebuggeeStateAction.Keep); + appDomain.Process.AsyncContinue(DebuggeeStateAction.Keep, evalThread); } /// Evaluation can not be stopped diff --git a/src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs b/src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs index 0151f5e46f..b29d07e2b5 100644 --- a/src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs +++ b/src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs @@ -98,6 +98,7 @@ namespace Debugger process.AsyncContinue(DebuggeeStateAction.Keep); } else if (process.Evaluating) { // Ignore events during property evaluation + pausedEventArgs = null; process.AsyncContinue(DebuggeeStateAction.Keep); } else if (pauseOnNextExit) { // process.TraceMessage("Callback exit: Paused"); diff --git a/src/AddIns/Debugger/Debugger.Core/Process.cs b/src/AddIns/Debugger/Debugger.Core/Process.cs index cab1ad89a0..ba27dccff5 100644 --- a/src/AddIns/Debugger/Debugger.Core/Process.cs +++ b/src/AddIns/Debugger/Debugger.Core/Process.cs @@ -459,12 +459,18 @@ namespace Debugger AsyncContinue(DebuggeeStateAction.Clear); } - /// Null to keep current setting - /// What happens to created threads. Null to keep current setting - internal void AsyncContinue(DebuggeeStateAction action) + /// Run this thread and freeze all other threads + internal void AsyncContinue(DebuggeeStateAction action, Thread threadToRun = null) { AssertPaused(); + if (threadToRun != null) { + corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_SUSPEND, null); + threadToRun.CorThread.SetDebugState(CorDebugThreadState.THREAD_RUN); + } else { + corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_RUN, null); + } + NotifyResumed(action); corProcess.Continue(0); // this.TraceMessage("Continue");