Skip to content

Commit

Permalink
Merge ce9168b into dd91e43
Browse files Browse the repository at this point in the history
  • Loading branch information
torusrxxx committed Sep 15, 2023
2 parents dd91e43 + ce9168b commit 3d0e265
Show file tree
Hide file tree
Showing 20 changed files with 2,364 additions and 225 deletions.
7 changes: 5 additions & 2 deletions src/gui/Src/BasicView/HexDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static int dwordStringMaxLength(HexDump::DwordViewMode mode);
static int qwordStringMaxLength(HexDump::QwordViewMode mode);
static int twordStringMaxLength(HexDump::TwordViewMode mode);

HexDump::HexDump(QWidget* parent)
HexDump::HexDump(QWidget* parent, MemoryPage* memPage)
: AbstractTableView(parent)
{
memset(&mSelection, 0, sizeof(SelectionData));
Expand All @@ -22,7 +22,10 @@ HexDump::HexDump(QWidget* parent)

setRowCount(0);

mMemPage = new MemoryPage(0, 0);
if(!memPage)
mMemPage = new MemoryPage(0, 0, this);
else
mMemPage = memPage;
mForceColumn = -1;

clearDescriptors();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/Src/BasicView/HexDump.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HexDump : public AbstractTableView
std::function<void()> columnSwitch;
};

explicit HexDump(QWidget* parent = 0);
explicit HexDump(QWidget* parent = 0, MemoryPage* memPage = 0);
~HexDump() override;

// Configuration
Expand Down Expand Up @@ -129,7 +129,7 @@ class HexDump : public AbstractTableView
void appendResetDescriptor(int width, QString title, bool clickable, ColumnDescriptor descriptor);
void clearDescriptors();

void printDumpAt(dsint parVA, bool select, bool repaint = true, bool updateTableOffset = true);
virtual void printDumpAt(dsint parVA, bool select, bool repaint = true, bool updateTableOffset = true);
duint rvaToVa(dsint rva) const;

duint getTableOffsetRva() const;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/Src/Gui/CustomizeMenuDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ CustomizeMenuDialog::CustomizeMenuDialog(QWidget* parent) :
viewName = tr("View");
else if(id == "TraceBrowser")
viewName = tr("Trace disassembler");
else if(id == "TraceDump")
viewName = tr("Trace dump");
else
continue;
// Add Parent Node
Expand Down
6 changes: 3 additions & 3 deletions src/gui/Src/Memory/MemoryPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class MemoryPage : public QObject
public:
explicit MemoryPage(duint parBase, duint parSize, QObject* parent = 0);

bool read(void* parDest, dsint parRVA, duint parSize) const;
bool write(const void* parDest, dsint parRVA, duint parSize);
virtual bool read(void* parDest, dsint parRVA, duint parSize) const;
virtual bool write(const void* parDest, dsint parRVA, duint parSize);
duint getSize() const;
duint getBase() const;
duint va(dsint rva) const;
void setAttributes(duint base, duint size);
bool inRange(duint va) const;

private:
protected:
duint mBase;
duint mSize;
};
17 changes: 14 additions & 3 deletions src/gui/Src/Tracer/TraceBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,8 @@ void TraceBrowser::setupRightClickContextMenu()
mRvaDisplayEnabled = false;
for(int i = 0; i < MemoryOperandsCount; i++)
{
menu->addAction(QString("%1: %2 -> %3").arg(getAddrText(MemoryAddress[i], nolabel, false)).arg(ToPtrString(MemoryOldContent[i])).arg(ToPtrString(MemoryNewContent[i])));
auto action = menu->addAction(QString("%1: %2 -> %3").arg(getAddrText(MemoryAddress[i], nolabel, false)).arg(ToPtrString(MemoryOldContent[i])).arg(ToPtrString(MemoryNewContent[i])));
connect(action, SIGNAL(triggered()), this, SLOT(debugdump()));
}
mRvaDisplayEnabled = RvaDisplayEnabled;
return true;
Expand Down Expand Up @@ -1838,8 +1839,10 @@ void TraceBrowser::searchConstantSlot()
constantDlg.setup(tr("Constant"), initialConstant, sizeof(duint));
if(constantDlg.exec() == QDialog::Accepted)
{
TraceFileSearchConstantRange(mTraceFile, constantDlg.getVal(), constantDlg.getVal());
auto ticks = GetTickCount();
int count = TraceFileSearchConstantRange(mTraceFile, constantDlg.getVal(), constantDlg.getVal());
emit displayReferencesWidget();
GuiAddLogMessage(tr("%1 result(s) in %2ms\n").arg(count).arg(GetTickCount() - ticks).toUtf8().constData());
}
}

Expand All @@ -1849,8 +1852,10 @@ void TraceBrowser::searchMemRefSlot()
memRefDlg.setup(tr("References"), 0, sizeof(duint));
if(memRefDlg.exec() == QDialog::Accepted)
{
TraceFileSearchMemReference(mTraceFile, memRefDlg.getVal());
auto ticks = GetTickCount();
int count = TraceFileSearchMemReference(mTraceFile, memRefDlg.getVal());
emit displayReferencesWidget();
GuiAddLogMessage(tr("%1 result(s) in %2ms\n").arg(count).arg(GetTickCount() - ticks).toUtf8().constData());
}
}

Expand Down Expand Up @@ -1880,3 +1885,9 @@ void TraceBrowser::gotoIndexSlot(duint index)
{
disasm(index, false);
}

void TraceBrowser::debugdump()
{
mTraceFile->buildDumpTo(getInitialSelection());
mTraceFile->debugdump(getInitialSelection());
}
3 changes: 3 additions & 0 deletions src/gui/Src/Tracer/TraceBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public slots:
void synchronizeCpuSlot();
void gotoIndexSlot(duint index);

void debugdump();

protected:
void disasm(unsigned long long index, bool history = true);
};

0 comments on commit 3d0e265

Please sign in to comment.