diff --git a/GleeBug/Debugger.Loop.cpp b/GleeBug/Debugger.Loop.cpp index f9e3c67..3ff251b 100644 --- a/GleeBug/Debugger.Loop.cpp +++ b/GleeBug/Debugger.Loop.cpp @@ -113,7 +113,7 @@ namespace GleeBug break; } - //clear trap flag when set by GleeBug (to prevent an EXCEPTION_SINGLE_STEP after detach + //clear trap flag when set by GleeBug (to prevent an EXCEPTION_SINGLE_STEP after detach) if (mDetach && mThread) { if (mThread->isInternalStepping || mThread->isSingleStepping) diff --git a/GleeBug/Debugger.Thread.cpp b/GleeBug/Debugger.Thread.cpp index 970bea9..88d355f 100644 --- a/GleeBug/Debugger.Thread.cpp +++ b/GleeBug/Debugger.Thread.cpp @@ -42,17 +42,14 @@ namespace GleeBug bool Thread::RegReadContext() { - SuspendThread(this->hThread); memset(&this->mOldContext, 0, sizeof(CONTEXT)); - this->mOldContext.ContextFlags = CONTEXT_ALL; - bool bReturn = false; + this->mOldContext.ContextFlags = CONTEXT_ALL; //TODO: granular control over what's required if (GetThreadContext(this->hThread, &this->mOldContext)) { this->registers.SetContext(this->mOldContext); - bReturn = true; + return true; } - ResumeThread(this->hThread); - return bReturn; + return false; } bool Thread::RegWriteContext() const @@ -61,10 +58,7 @@ namespace GleeBug if (memcmp(&this->mOldContext, this->registers.GetContext(), sizeof(CONTEXT)) == 0) return true; //update the context - SuspendThread(this->hThread); - bool bReturn = !!SetThreadContext(this->hThread, this->registers.GetContext()); - ResumeThread(this->hThread); - return bReturn; + return !!SetThreadContext(this->hThread, this->registers.GetContext()); } void Thread::StepInto()