1
0
Fork 0

DBG+GUI: resolved issue #174 (don't draw black CIP when running)

This commit is contained in:
Mr. eXoDia 2014-08-15 21:22:49 +02:00
parent 06042d3a9a
commit c9b7b67fa6
4 changed files with 28 additions and 16 deletions

View File

@ -42,8 +42,8 @@ PLUG_IMPEXP void _plugin_logputs(const char* text)
PLUG_IMPEXP void _plugin_debugpause()
{
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
dbgsetskipexceptions(false);

View File

@ -299,8 +299,8 @@ void cbUserBreakpoint()
bptobridge(&bp, &pluginBp);
bpInfo.breakpoint = &pluginBp;
}
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -374,8 +374,8 @@ void cbHardwareBreakpoint(void* ExceptionAddress)
bptobridge(&bp, &pluginBp);
bpInfo.breakpoint = &pluginBp;
}
DebugUpdateGui(cip, true);
GuiSetDebugState(paused);
DebugUpdateGui(cip, true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -437,8 +437,8 @@ void cbMemoryBreakpoint(void* ExceptionAddress)
}
if(bp.singleshoot)
bpdel(bp.addr, BPMEMORY); //delete from breakpoint list
DebugUpdateGui(cip, true);
GuiSetDebugState(paused);
DebugUpdateGui(cip, true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -596,8 +596,8 @@ void cbStep()
{
hActiveThread = threadgethandle(((DEBUG_EVENT*)GetDebugData())->dwThreadId);
isStepping = false;
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
PLUG_CB_STEPPED stepInfo;
stepInfo.reserved = 0;
//lock
@ -614,8 +614,8 @@ void cbStep()
static void cbRtrFinalStep()
{
hActiveThread = threadgethandle(((DEBUG_EVENT*)GetDebugData())->dwThreadId);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -772,8 +772,8 @@ static void cbCreateThread(CREATE_THREAD_DEBUG_INFO* CreateThread)
dbggetprivateusage(fdProcessInfo->hProcess, true);
memupdatemap(fdProcessInfo->hProcess); //update memory map
//update GUI
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -798,8 +798,8 @@ static void cbExitThread(EXIT_THREAD_DEBUG_INFO* ExitThread)
if(settingboolget("Events", "ThreadEnd"))
{
//update GUI
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -830,8 +830,8 @@ static void cbSystemBreakpoint(void* ExceptionData)
if(bIsAttached ? settingboolget("Events", "AttachBreakpoint") : settingboolget("Events", "SystemBreakpoint"))
{
//update GUI
DebugUpdateGui(cip, true);
GuiSetDebugState(paused);
DebugUpdateGui(cip, true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -902,8 +902,8 @@ static void cbLoadDll(LOAD_DLL_DEBUG_INFO* LoadDll)
{
bBreakOnNextDll = false;
//update GUI
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -933,8 +933,8 @@ static void cbUnloadDll(UNLOAD_DLL_DEBUG_INFO* UnloadDll)
{
bBreakOnNextDll = false;
//update GUI
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -1005,8 +1005,8 @@ static void cbOutputDebugString(OUTPUT_DEBUG_STRING_INFO* DebugString)
if(settingboolget("Events", "DebugStrings"))
{
//update GUI
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -1044,8 +1044,8 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
{
dputs("paused!");
SetNextDbgContinueStatus(DBG_CONTINUE);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());
@ -1141,8 +1141,8 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
SetNextDbgContinueStatus(DBG_CONTINUE);
}
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
GuiSetDebugState(paused);
DebugUpdateGui(GetContextDataEx(hActiveThread, UE_CIP), true);
//lock
lock(WAITID_RUN);
SetForegroundWindow(GuiGetWindowHandle());

View File

@ -15,6 +15,7 @@ Disassembly::Disassembly(QWidget* parent) : AbstractTableView(parent)
mSelection = data;
mCipRva = 0;
mIsRunning = false;
mHighlightToken.text = "";
mHighlightingMode = false;
@ -96,7 +97,7 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
QString addrText = getAddrText(cur_addr, label);
BPXTYPE bpxtype = DbgGetBpxTypeAt(cur_addr);
bool isbookmark = DbgGetBookmarkAt(cur_addr);
if(mInstBuffer.at(rowOffset).rva == mCipRva) //cip
if(mInstBuffer.at(rowOffset).rva == mCipRva && !mIsRunning) //cip + not running
{
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyCipBackgroundColor")));
if(!isbookmark) //no bookmark
@ -1366,9 +1367,19 @@ void Disassembly::disassembleClear()
void Disassembly::debugStateChangedSlot(DBGSTATE state)
{
if(state == stopped)
switch(state)
{
case stopped:
disassembleClear();
break;
case paused:
mIsRunning = false;
break;
case running:
mIsRunning = true;
break;
default:
break;
}
}

View File

@ -121,6 +121,7 @@ private:
SelectionData_t mSelection;
bool mIsLastInstDisplayed;
bool mIsRunning;
GuiState_t mGuiState;