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; 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 (mDetach && mThread)
{ {
if (mThread->isInternalStepping || mThread->isSingleStepping) if (mThread->isInternalStepping || mThread->isSingleStepping)

View File

@ -42,17 +42,14 @@ namespace GleeBug
bool Thread::RegReadContext() bool Thread::RegReadContext()
{ {
SuspendThread(this->hThread);
memset(&this->mOldContext, 0, sizeof(CONTEXT)); memset(&this->mOldContext, 0, sizeof(CONTEXT));
this->mOldContext.ContextFlags = CONTEXT_ALL; this->mOldContext.ContextFlags = CONTEXT_ALL; //TODO: granular control over what's required
bool bReturn = false;
if (GetThreadContext(this->hThread, &this->mOldContext)) if (GetThreadContext(this->hThread, &this->mOldContext))
{ {
this->registers.SetContext(this->mOldContext); this->registers.SetContext(this->mOldContext);
bReturn = true; return true;
} }
ResumeThread(this->hThread); return false;
return bReturn;
} }
bool Thread::RegWriteContext() const bool Thread::RegWriteContext() const
@ -61,10 +58,7 @@ namespace GleeBug
if (memcmp(&this->mOldContext, this->registers.GetContext(), sizeof(CONTEXT)) == 0) if (memcmp(&this->mOldContext, this->registers.GetContext(), sizeof(CONTEXT)) == 0)
return true; return true;
//update the context //update the context
SuspendThread(this->hThread); return !!SetThreadContext(this->hThread, this->registers.GetContext());
bool bReturn = !!SetThreadContext(this->hThread, this->registers.GetContext());
ResumeThread(this->hThread);
return bReturn;
} }
void Thread::StepInto() void Thread::StepInto()