parent
42163fa5cd
commit
ac35b0d3ad
|
|
@ -397,6 +397,22 @@ static bool getConditionValue(const char* expression)
|
|||
return true;
|
||||
}
|
||||
|
||||
void cbPauseBreakpoint()
|
||||
{
|
||||
hActiveThread = ThreadGetHandle(((DEBUG_EVENT*)GetDebugData())->dwThreadId);
|
||||
auto CIP = GetContextDataEx(hActiveThread, UE_CIP);
|
||||
DeleteBPX(CIP);
|
||||
GuiSetDebugState(paused);
|
||||
DebugUpdateGui(CIP, true);
|
||||
//lock
|
||||
lock(WAITID_RUN);
|
||||
SetForegroundWindow(GuiGetWindowHandle());
|
||||
PLUG_CB_PAUSEDEBUG pauseInfo;
|
||||
pauseInfo.reserved = nullptr;
|
||||
plugincbcall(CB_PAUSEDEBUG, &pauseInfo);
|
||||
wait(WAITID_RUN);
|
||||
}
|
||||
|
||||
static void cbGenericBreakpoint(BP_TYPE bptype, void* ExceptionAddress = nullptr)
|
||||
{
|
||||
hActiveThread = ThreadGetHandle(((DEBUG_EVENT*)GetDebugData())->dwThreadId);
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ duint dbggetdebuggedbase();
|
|||
|
||||
void cbStep();
|
||||
void cbRtrStep();
|
||||
void cbPauseBreakpoint();
|
||||
void cbSystemBreakpoint(void* ExceptionData);
|
||||
void cbMemoryBreakpoint(void* ExceptionAddress);
|
||||
void cbHardwareBreakpoint(void* ExceptionAddress);
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ CMDRESULT cbDebugRun(int argc, char* argv[])
|
|||
if(dbgisrunning())
|
||||
return STATUS_ERROR;
|
||||
|
||||
dbgsetispausedbyuser(false);
|
||||
GuiSetDebugState(running);
|
||||
unlock(WAITID_RUN);
|
||||
PLUG_CB_RESUMEDEBUG callbackInfo;
|
||||
|
|
@ -1358,23 +1359,28 @@ CMDRESULT cbDebugPause(int argc, char* argv[])
|
|||
dputs("Program is not running");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
duint debugBreakAddr;
|
||||
if(!valfromstring("DebugBreak", &debugBreakAddr))
|
||||
if(SuspendThread(hActiveThread) == -1)
|
||||
{
|
||||
dputs("Could not find DebugBreak!");
|
||||
dputs("Error suspending thread");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
DWORD dwThreadId = 0;
|
||||
HANDLE hThread = CreateRemoteThread(fdProcessInfo->hProcess, 0, 0, (LPTHREAD_START_ROUTINE)debugBreakAddr, 0, CREATE_SUSPENDED, &dwThreadId);
|
||||
if(!hThread)
|
||||
duint CIP = GetContextDataEx(hActiveThread, UE_CIP);
|
||||
if(!SetBPX(CIP, UE_BREAKPOINT, (void*)cbPauseBreakpoint))
|
||||
{
|
||||
dputs("Failed to create thread in debuggee");
|
||||
dprintf("Error setting breakpoint at " fhex "! (SetBPX)\n", CIP);
|
||||
if(ResumeThread(hActiveThread) == -1)
|
||||
{
|
||||
dputs("Error resuming thread");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
dprintf("Created thread with ThreadId %X\n", dwThreadId);
|
||||
dbgsetispausedbyuser(true);
|
||||
ResumeThread(hThread);
|
||||
CloseHandle(hThread);
|
||||
if(ResumeThread(hActiveThread) == -1)
|
||||
{
|
||||
dputs("Error resuming thread");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue