diff --git a/GleeBug/Debugger.Loop.Exception.cpp b/GleeBug/Debugger.Loop.Exception.cpp index 16b8468..86fcad9 100644 --- a/GleeBug/Debugger.Loop.Exception.cpp +++ b/GleeBug/Debugger.Loop.Exception.cpp @@ -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; diff --git a/GleeBug/Debugger.Loop.Process.cpp b/GleeBug/Debugger.Loop.Process.cpp index 0183fcc..13d734d 100644 --- a/GleeBug/Debugger.Loop.Process.cpp +++ b/GleeBug/Debugger.Loop.Process.cpp @@ -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) diff --git a/StaticEngine/Emulator.h b/StaticEngine/Emulator.h index 037db63..eacf715 100644 --- a/StaticEngine/Emulator.h +++ b/StaticEngine/Emulator.h @@ -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; } diff --git a/TitanEngineEmulator/Emulator.h b/TitanEngineEmulator/Emulator.h index d97d0c0..af290d8 100644 --- a/TitanEngineEmulator/Emulator.h +++ b/TitanEngineEmulator/Emulator.h @@ -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; }