parent
8c1981361a
commit
69580f1cc2
|
|
@ -372,30 +372,16 @@ void _dbg_dbgtraceexecute(duint CIP)
|
|||
{
|
||||
if(TraceRecord.getTraceRecordType(CIP) != TraceRecordManager::TraceRecordType::TraceRecordNone)
|
||||
{
|
||||
unsigned char buffer[16];
|
||||
duint size;
|
||||
if(MemRead(CIP, buffer, 16))
|
||||
unsigned char buffer[MAX_DISASM_BUFFER];
|
||||
if(MemRead(CIP, buffer, MAX_DISASM_BUFFER))
|
||||
{
|
||||
BASIC_INSTRUCTION_INFO basicInfo;
|
||||
TraceRecord.increaseInstructionCounter();
|
||||
DbgDisasmFastAt(CIP, &basicInfo);
|
||||
TraceRecord.TraceExecute(CIP, basicInfo.size);
|
||||
Capstone instruction;
|
||||
instruction.Disassemble(CIP, buffer, MAX_DISASM_BUFFER);
|
||||
TraceRecord.TraceExecute(CIP, instruction.Size());
|
||||
}
|
||||
else
|
||||
{
|
||||
duint base = MemFindBaseAddr(CIP, &size);
|
||||
if(CIP - base + 16 > size) // Corner case where CIP is near the end of the page
|
||||
{
|
||||
size = base + size - CIP;
|
||||
if(MemRead(CIP, buffer, size))
|
||||
{
|
||||
BASIC_INSTRUCTION_INFO basicInfo;
|
||||
TraceRecord.increaseInstructionCounter();
|
||||
DbgDisasmFastAt(CIP, &basicInfo);
|
||||
TraceRecord.TraceExecute(CIP, basicInfo.size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if we reaches here, then the executable had executed an invalid address. Don't trace it.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ static DWORD WINAPI dumpRefreshThread(void* ptr)
|
|||
}
|
||||
if(bStopDumpRefreshThread)
|
||||
break;
|
||||
timeWastedDebugging++;
|
||||
GuiUpdateDumpView();
|
||||
Sleep(200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "threading.h"
|
||||
#include "debugger.h"
|
||||
#include "symbolinfo.h"
|
||||
#include "taskthread.h"
|
||||
#include <Windows.h>
|
||||
|
||||
std::map<unsigned int, WatchExpr*> watchexpr;
|
||||
|
|
@ -97,6 +98,14 @@ void WatchExpr::modifyName(const char* newName)
|
|||
strcpy_s(WatchName, newName);
|
||||
}
|
||||
|
||||
// Update GUI
|
||||
|
||||
void GuiUpdateWatchViewAsync()
|
||||
{
|
||||
auto task = MakeTaskThread(GuiUpdateWatchView);
|
||||
task.WakeUp();
|
||||
}
|
||||
|
||||
// Global functions
|
||||
// Clear all watch
|
||||
void WatchClear()
|
||||
|
|
@ -156,7 +165,7 @@ void WatchModifyName(unsigned int id, const char* newName)
|
|||
EXCLUSIVE_ACQUIRE(LockWatch);
|
||||
WatchModifyNameUnlocked(id, newName);
|
||||
EXCLUSIVE_RELEASE();
|
||||
GuiUpdateWatchView();
|
||||
GuiUpdateWatchViewAsync();
|
||||
}
|
||||
|
||||
void WatchDelete(unsigned int id)
|
||||
|
|
@ -168,7 +177,7 @@ void WatchDelete(unsigned int id)
|
|||
delete x->second;
|
||||
watchexpr.erase(x);
|
||||
EXCLUSIVE_RELEASE();
|
||||
GuiUpdateWatchView();
|
||||
GuiUpdateWatchViewAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +193,7 @@ void WatchSetWatchdogMode(unsigned int id, WATCHDOGMODE mode)
|
|||
EXCLUSIVE_ACQUIRE(LockWatch);
|
||||
WatchSetWatchdogModeUnlocked(id, mode);
|
||||
EXCLUSIVE_RELEASE();
|
||||
GuiUpdateWatchView();
|
||||
GuiUpdateWatchViewAsync();
|
||||
}
|
||||
|
||||
WATCHDOGMODE WatchGetWatchdogEnabled(unsigned int id)
|
||||
|
|
@ -244,7 +253,7 @@ void WatchSetWindow(unsigned int id, unsigned int window)
|
|||
if(obj != watchexpr.end())
|
||||
obj->second->watchWindow = window;
|
||||
EXCLUSIVE_RELEASE();
|
||||
GuiUpdateWatchView();
|
||||
GuiUpdateWatchViewAsync();
|
||||
}
|
||||
|
||||
std::vector<WATCHINFO> WatchGetList()
|
||||
|
|
@ -402,10 +411,8 @@ CMDRESULT cbWatchdog(int argc, char* argv[])
|
|||
}
|
||||
EXCLUSIVE_RELEASE();
|
||||
if(watchdogTriggered)
|
||||
GuiUpdateWatchView();
|
||||
GuiUpdateWatchViewAsync();
|
||||
varset("$result", watchdogTriggered ? 1 : 0, false);
|
||||
if(watchdogTriggered)
|
||||
varset("$breakcondition", 1, false);
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
|
|||
if(memsize == sizeof(dsint))
|
||||
addrText = getSymbolicName(arg.memvalue);
|
||||
else
|
||||
addrText = QString("%1").arg(arg.memvalue, memsize * 2, 16, QChar('0')).toUpper();
|
||||
addrText = ToPtrString(arg.memvalue);
|
||||
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + addrText);
|
||||
}
|
||||
j++;
|
||||
|
|
|
|||
|
|
@ -81,11 +81,44 @@ int CPUMultiDump::getMaxCPUTabs()
|
|||
return mMaxCPUDumpTabs;
|
||||
}
|
||||
|
||||
int CPUMultiDump::GetDumpWindowIndex(int dump)
|
||||
{
|
||||
QString dumpNativeName = QString("Dump ") + QString::number(dump);
|
||||
for(int i = 0; i < count(); i++)
|
||||
{
|
||||
if(getNativeName(i) == dumpNativeName)
|
||||
return i;
|
||||
}
|
||||
return 2147483647;
|
||||
}
|
||||
|
||||
int CPUMultiDump::GetWatchWindowIndex()
|
||||
{
|
||||
QString watchNativeName = QString("Watch 1");
|
||||
for(int i = 0; i < count(); i++)
|
||||
{
|
||||
if(getNativeName(i) == watchNativeName)
|
||||
return i;
|
||||
}
|
||||
return 2147483647;
|
||||
}
|
||||
|
||||
void CPUMultiDump::SwitchToDumpWindow()
|
||||
{
|
||||
if(!mCurrentCPUDump)
|
||||
setCurrentIndex(GetDumpWindowIndex(1));
|
||||
}
|
||||
|
||||
void CPUMultiDump::SwitchToWatchWindow()
|
||||
{
|
||||
if(mCurrentCPUDump)
|
||||
setCurrentIndex(GetWatchWindowIndex());
|
||||
}
|
||||
|
||||
void CPUMultiDump::updateCurrentTabSlot(int tabIndex)
|
||||
{
|
||||
CPUDump* t = dynamic_cast<CPUDump*>(widget(tabIndex));
|
||||
if(t)
|
||||
mCurrentCPUDump = t;
|
||||
CPUDump* t = qobject_cast<CPUDump*>(widget(tabIndex));
|
||||
mCurrentCPUDump = t;
|
||||
}
|
||||
|
||||
void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
||||
|
|
@ -97,7 +130,7 @@ void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
|||
{
|
||||
if(!getNativeName(i).startsWith("Dump "))
|
||||
continue;
|
||||
cpuDump = (CPUDump*)widget(i);
|
||||
cpuDump = qobject_cast<CPUDump*>(widget(i));
|
||||
cpuDump->historyClear();
|
||||
cpuDump->addVaToHistory(parVa);
|
||||
cpuDump->printDumpAt(parVa);
|
||||
|
|
@ -107,6 +140,7 @@ void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
|||
}
|
||||
else
|
||||
{
|
||||
SwitchToDumpWindow();
|
||||
mCurrentCPUDump->printDumpAt(parVa);
|
||||
mCurrentCPUDump->addVaToHistory(parVa);
|
||||
mCurrentCPUDump->setFocus();
|
||||
|
|
@ -115,40 +149,33 @@ void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
|||
|
||||
void CPUMultiDump::printDumpAtNSlot(duint parVa, int index)
|
||||
{
|
||||
setCurrentIndex(index);
|
||||
CPUDump* current = dynamic_cast<CPUDump*>(widget(index));
|
||||
if(current)
|
||||
{
|
||||
current->printDumpAt(parVa);
|
||||
current->addVaToHistory(parVa);
|
||||
}
|
||||
else if(index > 0 && unsigned int(index) < mMaxCPUDumpTabs)
|
||||
{
|
||||
current = dynamic_cast<CPUDump*>(widget(index + 1));
|
||||
if(current)
|
||||
{
|
||||
current->printDumpAt(parVa);
|
||||
current->addVaToHistory(parVa);
|
||||
}
|
||||
}
|
||||
int tabindex = GetDumpWindowIndex(index);
|
||||
if(tabindex == 2147483647)
|
||||
return;
|
||||
CPUDump* current = qobject_cast<CPUDump*>(widget(tabindex));
|
||||
if(!current)
|
||||
return;
|
||||
setCurrentIndex(tabindex);
|
||||
current->printDumpAt(parVa);
|
||||
current->addVaToHistory(parVa);
|
||||
}
|
||||
|
||||
void CPUMultiDump::selectionGetSlot(SELECTIONDATA* selectionData)
|
||||
{
|
||||
SwitchToDumpWindow();
|
||||
mCurrentCPUDump->selectionGet(selectionData);
|
||||
}
|
||||
|
||||
void CPUMultiDump::selectionSetSlot(const SELECTIONDATA* selectionData)
|
||||
{
|
||||
SwitchToDumpWindow();
|
||||
mCurrentCPUDump->selectionSet(selectionData);
|
||||
}
|
||||
|
||||
void CPUMultiDump::dbgStateChangedSlot(DBGSTATE dbgState)
|
||||
{
|
||||
if(dbgState == initialized)
|
||||
{
|
||||
mInitAllDumpTabs = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CPUMultiDump::openChangeTabTitleDialogSlot(int tabIndex)
|
||||
|
|
@ -171,5 +198,6 @@ void CPUMultiDump::displayReferencesWidgetSlot()
|
|||
|
||||
void CPUMultiDump::focusCurrentDumpSlot()
|
||||
{
|
||||
SwitchToDumpWindow();
|
||||
mCurrentCPUDump->setFocus();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ private:
|
|||
uint mMaxCPUDumpTabs;
|
||||
|
||||
WatchView* mWatch;
|
||||
|
||||
int GetDumpWindowIndex(int dump);
|
||||
int GetWatchWindowIndex();
|
||||
void SwitchToDumpWindow();
|
||||
void SwitchToWatchWindow();
|
||||
};
|
||||
|
||||
#endif // CPUMULTIDUMP_H
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuFavourites">
|
||||
<property name="title">
|
||||
<string>&Favourites</string>
|
||||
<string>Fa&vourites</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue