performance improvements for tracing

This commit is contained in:
mrexodia 2016-10-28 02:39:38 +02:00
parent 367b37d773
commit e7f709fcda
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 5 additions and 11 deletions

View File

@ -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)

View File

@ -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()