GUI: do not automatically update dump if the memory and view didn't change
This commit is contained in:
parent
362b2d7260
commit
14201568cf
|
|
@ -36,6 +36,10 @@ HexDump::HexDump(QWidget* parent)
|
|||
mNonprintReplace = QChar('.'); //QChar(0x25CA);
|
||||
mNullReplace = QChar('.'); //QChar(0x2022);
|
||||
|
||||
const auto updateCacheDataSize = 0x1000;
|
||||
mUpdateCacheData.resize(updateCacheDataSize);
|
||||
mUpdateCacheTemp.resize(updateCacheDataSize);
|
||||
|
||||
// Slots
|
||||
connect(Bridge::getBridge(), SIGNAL(updateDump()), this, SLOT(updateDumpSlot()));
|
||||
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(debugStateChanged(DBGSTATE)));
|
||||
|
|
@ -110,6 +114,31 @@ void HexDump::updateDumpSlot()
|
|||
printDumpAt(syncAddr, false, false, true);
|
||||
}
|
||||
}
|
||||
UpdateCache cur;
|
||||
cur.memBase = mMemPage->getBase();
|
||||
cur.memSize = mMemPage->getSize();
|
||||
if(cur.memBase)
|
||||
{
|
||||
cur.rva = getTableOffsetRva();
|
||||
cur.size = getBytePerRowCount() * getViewableRowsCount();
|
||||
if(cur.size < mUpdateCacheData.size())
|
||||
{
|
||||
if(mMemPage->read(mUpdateCacheTemp.data(), cur.rva, cur.size))
|
||||
{
|
||||
if(mUpdateCache == cur && memcmp(mUpdateCacheData.data(), mUpdateCacheTemp.data(), cur.size) == 0)
|
||||
{
|
||||
// same view and same data, do not reload
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
mUpdateCache = cur;
|
||||
mUpdateCacheData.swap(mUpdateCacheTemp);
|
||||
OutputDebugStringA(QString("[x64dbg] %1[%2] %3[%4]").arg(ToPtrString(mUpdateCache.memBase)).arg(ToHexString(mUpdateCache.memSize)).arg(ToPtrString(mUpdateCache.rva)).arg(ToHexString(mUpdateCache.size)).toUtf8().constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
reloadData();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,21 @@ private:
|
|||
QColor mUnknownCodePointerHighlightColor;
|
||||
QColor mUnknownDataPointerHighlightColor;
|
||||
|
||||
struct UpdateCache
|
||||
{
|
||||
duint memBase = 0;
|
||||
duint memSize = 0;
|
||||
duint rva = 0;
|
||||
duint size = 0;
|
||||
|
||||
bool operator==(const UpdateCache & o) const
|
||||
{
|
||||
return std::tie(memBase, memSize, rva, size) == std::tie(o.memBase, o.memSize, o.rva, o.size);
|
||||
}
|
||||
} mUpdateCache;
|
||||
std::vector<uint8_t> mUpdateCacheData;
|
||||
std::vector<uint8_t> mUpdateCacheTemp;
|
||||
|
||||
protected:
|
||||
MemoryPage* mMemPage;
|
||||
int mByteOffset;
|
||||
|
|
|
|||
Loading…
Reference in New Issue