Execute the attach breakpoint after the create process breakpoint

This commit is contained in:
Duncan Ogilvie 2020-11-12 03:21:29 +01:00
parent 7790cc9e12
commit 3c02faea83
4 changed files with 11 additions and 6 deletions

View File

@ -9,7 +9,7 @@ namespace GleeBug
auto foundInfo = mProcess->breakpoints.find({ BreakpointType::Software, ptr(exceptionRecord.ExceptionAddress) });
if(foundInfo == mProcess->breakpoints.end())
{
if(!mProcess->systemBreakpoint) //handle system breakpoint
if(!this->mAttachedToProcess && !mProcess->systemBreakpoint) //handle system breakpoint
{
//set internal state
mProcess->systemBreakpoint = true;

View File

@ -5,13 +5,14 @@ namespace GleeBug
void Debugger::createProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess)
{
//initial attach housekeeping
bool attachBreakpoint = false;
if(mAttachedToProcess && !mMainProcess.dwProcessId)
{
mMainProcess.hProcess = createProcess.hProcess;
mMainProcess.hThread = createProcess.hThread;
mMainProcess.dwProcessId = mDebugEvent.dwProcessId;
mMainProcess.dwThreadId = mDebugEvent.dwThreadId;
cbAttachBreakpoint();
attachBreakpoint = true;
}
//process housekeeping
@ -36,6 +37,10 @@ namespace GleeBug
//close the file handle
if(createProcess.hFile)
CloseHandle(createProcess.hFile);
//call attach breakpoint after process creation
if (attachBreakpoint)
cbAttachBreakpoint();
}
void Debugger::exitProcessEvent(const EXIT_PROCESS_DEBUG_INFO & exitProcess)

View File

@ -529,7 +529,7 @@ public:
);
if (offset == INVALID_VALUE)
return 0
return 0;
else
return ReturnType ? FileMapVA + offset : offset;
}
@ -586,7 +586,7 @@ public:
);
if (offset == INVALID_VALUE)
return 0
return 0;
else
return ReturnType ? FileMapVA + offset : offset;
}

View File

@ -593,7 +593,7 @@ public:
);
if (offset == INVALID_VALUE)
return 0
return 0;
else
return ReturnType ? FileMapVA + offset : offset;
}
@ -650,7 +650,7 @@ public:
);
if (offset == INVALID_VALUE)
return 0
return 0;
else
return ReturnType ? FileMapVA + offset : offset;
}