Introduce CPURegistersView and TraceWidget
This commit is contained in:
parent
0bc216f84f
commit
aa0863689d
|
@ -5,7 +5,7 @@
|
|||
#include "Bridge.h"
|
||||
#include "QBeaEngine.h"
|
||||
|
||||
CPUInfoBox::CPUInfoBox(StdTable* parent) : StdTable(parent)
|
||||
CPUInfoBox::CPUInfoBox(QWidget* parent) : StdTable(parent)
|
||||
{
|
||||
setWindowTitle("InfoBox");
|
||||
enableMultiSelection(false);
|
||||
|
|
|
@ -11,7 +11,7 @@ class CPUInfoBox : public StdTable
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPUInfoBox(StdTable* parent = 0);
|
||||
explicit CPUInfoBox(QWidget* parent = 0);
|
||||
~CPUInfoBox();
|
||||
int getHeight();
|
||||
void addFollowMenuItem(QMenu* menu, QString name, duint value);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,99 @@
|
|||
#ifndef CPUREGISTERSVIEW_H
|
||||
#define CPUREGISTERSVIEW_H
|
||||
|
||||
#include "RegistersView.h"
|
||||
|
||||
class CPURegistersView : public RegistersView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CPURegistersView(CPUWidget* parent = 0);
|
||||
|
||||
public slots:
|
||||
void setRegister(REGISTER_NAME reg, duint value);
|
||||
void updateRegistersSlot();
|
||||
virtual void debugStateChangedSlot(DBGSTATE state);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
virtual void keyPressEvent(QKeyEvent* event);
|
||||
virtual void refreshShortcutsSlot();
|
||||
virtual void displayCustomContextMenuSlot(QPoint pos);
|
||||
|
||||
protected slots:
|
||||
void onIncrementAction();
|
||||
void onDecrementAction();
|
||||
void onIncrementx87StackAction();
|
||||
void onDecrementx87StackAction();
|
||||
void onZeroAction();
|
||||
void onSetToOneAction();
|
||||
void onModifyAction();
|
||||
void onToggleValueAction();
|
||||
void onUndoAction();
|
||||
void onCopyToClipboardAction();
|
||||
void onCopyFloatingPointToClipboardAction();
|
||||
void onCopySymbolToClipboardAction();
|
||||
void onFollowInDisassembly();
|
||||
void onFollowInDump();
|
||||
void onFollowInDumpN();
|
||||
void onFollowInStack();
|
||||
void onFollowInMemoryMap();
|
||||
void onIncrementPtrSize();
|
||||
void onDecrementPtrSize();
|
||||
void onPushAction();
|
||||
void onPopAction();
|
||||
void onHighlightSlot();
|
||||
// switch SIMD display modes
|
||||
void onSIMDMode();
|
||||
void onFpuMode();
|
||||
void ModifyFields(const QString & title, STRING_VALUE_TABLE_t* table, SIZE_T size);
|
||||
void disasmSelectionChangedSlot(dsint va);
|
||||
|
||||
private:
|
||||
void CreateDumpNMenu(QMenu* dumpMenu);
|
||||
void displayEditDialog();
|
||||
|
||||
CPUWidget* mParent;
|
||||
// context menu actions
|
||||
QMenu* mSwitchSIMDDispMode;
|
||||
QAction* mDisplaySTX;
|
||||
QAction* mDisplayx87rX;
|
||||
QAction* mDisplayMMX;
|
||||
QAction* mFollowInDump;
|
||||
QAction* wCM_Increment;
|
||||
QAction* wCM_Decrement;
|
||||
QAction* wCM_IncrementPtrSize;
|
||||
QAction* wCM_DecrementPtrSize;
|
||||
QAction* wCM_Push;
|
||||
QAction* wCM_Pop;
|
||||
QAction* wCM_Zero;
|
||||
QAction* wCM_SetToOne;
|
||||
QAction* wCM_Modify;
|
||||
QAction* wCM_ToggleValue;
|
||||
QAction* wCM_Undo;
|
||||
QAction* wCM_CopyToClipboard;
|
||||
QAction* wCM_CopyFloatingPointValueToClipboard;
|
||||
QAction* wCM_CopySymbolToClipboard;
|
||||
QAction* wCM_CopyAll;
|
||||
QAction* wCM_FollowInDisassembly;
|
||||
QAction* wCM_FollowInDump;
|
||||
QAction* wCM_FollowInStack;
|
||||
QAction* wCM_FollowInMemoryMap;
|
||||
QAction* wCM_Incrementx87Stack;
|
||||
QAction* wCM_Decrementx87Stack;
|
||||
QAction* wCM_ChangeFPUView;
|
||||
QAction* wCM_Highlight;
|
||||
QAction* SIMDHex;
|
||||
QAction* SIMDFloat;
|
||||
QAction* SIMDDouble;
|
||||
QAction* SIMDSWord;
|
||||
QAction* SIMDUWord;
|
||||
QAction* SIMDHWord;
|
||||
QAction* SIMDSDWord;
|
||||
QAction* SIMDUDWord;
|
||||
QAction* SIMDHDWord;
|
||||
QAction* SIMDSQWord;
|
||||
QAction* SIMDUQWord;
|
||||
QAction* SIMDHQWord;
|
||||
};
|
||||
|
||||
#endif // CPUREGISTERSVIEW_H
|
|
@ -6,7 +6,7 @@
|
|||
#include "CPUDisassembly.h"
|
||||
#include "CPUMultiDump.h"
|
||||
#include "CPUStack.h"
|
||||
#include "RegistersView.h"
|
||||
#include "CPURegistersView.h"
|
||||
#include "CPUInfoBox.h"
|
||||
#include "CPUArgumentWidget.h"
|
||||
#include "Configuration.h"
|
||||
|
@ -16,7 +16,7 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
ui->setupUi(this);
|
||||
setDefaultDisposition();
|
||||
|
||||
setStyleSheet("AbstractTableView:focus, RegistersView:focus, CPUSideBar:focus { border: 1px solid #000000; }");
|
||||
setStyleSheet("AbstractTableView:focus, CPURegistersView:focus, CPUSideBar:focus { border: 1px solid #000000; }");
|
||||
|
||||
mDisas = new CPUDisassembly(this, true);
|
||||
mSideBar = new CPUSideBar(mDisas);
|
||||
|
@ -49,7 +49,7 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
mDump = new CPUMultiDump(mDisas, 5, 0); //dump widget
|
||||
ui->mBotLeftFrameLayout->addWidget(mDump);
|
||||
|
||||
mGeneralRegs = new RegistersView(this);
|
||||
mGeneralRegs = new CPURegistersView(this);
|
||||
mGeneralRegs->setFixedWidth(1000);
|
||||
mGeneralRegs->ShowFPU(true);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class CPUSideBar;
|
|||
class CPUDisassembly;
|
||||
class CPUMultiDump;
|
||||
class CPUStack;
|
||||
class RegistersView;
|
||||
class CPURegistersView;
|
||||
class CPUInfoBox;
|
||||
class CPUArgumentWidget;
|
||||
|
||||
|
@ -44,7 +44,7 @@ protected:
|
|||
CPUDisassembly* mDisas;
|
||||
CPUMultiDump* mDump;
|
||||
CPUStack* mStack;
|
||||
RegistersView* mGeneralRegs;
|
||||
CPURegistersView* mGeneralRegs;
|
||||
CPUInfoBox* mInfo;
|
||||
CPUArgumentWidget* mArgumentWidget;
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "AboutDialog.h"
|
||||
#include "UpdateChecker.h"
|
||||
#include "Tracer/TraceBrowser.h"
|
||||
#include "Tracer/TraceWidget.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
: QMainWindow(parent),
|
||||
|
@ -207,10 +208,10 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
mGraphView->setWindowIcon(DIcon("graph.png"));
|
||||
|
||||
// Trace view
|
||||
mTraceBrowser = new TraceBrowser(this);
|
||||
mTraceBrowser->setWindowTitle(tr("Trace"));
|
||||
mTraceBrowser->setWindowIcon(DIcon("trace.png"));
|
||||
connect(mTraceBrowser, SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
mTraceWidget = new TraceWidget(this);
|
||||
mTraceWidget->setWindowTitle(tr("Trace"));
|
||||
mTraceWidget->setWindowIcon(DIcon("trace.png"));
|
||||
connect(mTraceWidget->getTraceBrowser(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
|
||||
mTabWidget = new MHTabWidget(this, true, true);
|
||||
|
||||
|
@ -229,7 +230,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
mWidgetList.push_back(WidgetInfo(mReferenceManager, "ReferencesTab"));
|
||||
mWidgetList.push_back(WidgetInfo(mThreadView, "ThreadsTab"));
|
||||
mWidgetList.push_back(WidgetInfo(mHandlesView, "HandlesTab"));
|
||||
mWidgetList.push_back(WidgetInfo(mTraceBrowser, "TraceTab"));
|
||||
mWidgetList.push_back(WidgetInfo(mTraceWidget, "TraceTab"));
|
||||
|
||||
// If LoadSaveTabOrder disabled, load tabs in default order
|
||||
if(!ConfigBool("Gui", "LoadSaveTabOrder"))
|
||||
|
@ -1601,7 +1602,7 @@ void MainWindow::displaySEHChain()
|
|||
|
||||
void MainWindow::displayRunTrace()
|
||||
{
|
||||
showQWidgetTab(mTraceBrowser);
|
||||
showQWidgetTab(mTraceWidget);
|
||||
}
|
||||
|
||||
void MainWindow::donate()
|
||||
|
|
|
@ -33,7 +33,7 @@ class DisassemblerGraphView;
|
|||
class SimpleTraceDialog;
|
||||
class MRUList;
|
||||
class UpdateChecker;
|
||||
class TraceBrowser;
|
||||
class TraceWidget;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
HandlesView* mHandlesView;
|
||||
NotesManager* mNotesManager;
|
||||
DisassemblerGraphView* mGraphView;
|
||||
TraceBrowser* mTraceBrowser;
|
||||
TraceWidget* mTraceWidget;
|
||||
SimpleTraceDialog* mSimpleTraceDialog;
|
||||
UpdateChecker* mUpdateChecker;
|
||||
DebugStatusLabel* mStatusLabel;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -127,7 +127,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
explicit RegistersView(CPUWidget* parent);
|
||||
explicit RegistersView(QWidget* parent);
|
||||
~RegistersView();
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
@ -136,12 +136,12 @@ public:
|
|||
static void operator delete(void* p);
|
||||
int getEstimateHeight();
|
||||
|
||||
void setRegisters(REGDUMP* reg); //This is really a protected member, but we need to put REGDUMP into it from TraceWidget
|
||||
|
||||
public slots:
|
||||
void refreshShortcutsSlot();
|
||||
void updateRegistersSlot();
|
||||
void displayCustomContextMenuSlot(QPoint pos);
|
||||
void setRegister(REGISTER_NAME reg, duint value);
|
||||
void debugStateChangedSlot(DBGSTATE state);
|
||||
virtual void refreshShortcutsSlot();
|
||||
virtual void displayCustomContextMenuSlot(QPoint pos);
|
||||
virtual void debugStateChangedSlot(DBGSTATE state);
|
||||
void reload();
|
||||
void ShowFPU(bool set_showfpu);
|
||||
void onChangeFPUViewAction();
|
||||
|
@ -160,44 +160,15 @@ protected:
|
|||
|
||||
// use-in-class-only methods
|
||||
void drawRegister(QPainter* p, REGISTER_NAME reg, char* value);
|
||||
void setRegisters(REGDUMP* reg);
|
||||
char* registerValue(const REGDUMP* regd, const REGISTER_NAME reg);
|
||||
bool identifyRegister(const int y, const int x, REGISTER_NAME* clickedReg);
|
||||
QString helpRegister(REGISTER_NAME reg);
|
||||
void CreateDumpNMenu(QMenu* dumpMenu);
|
||||
|
||||
void displayEditDialog();
|
||||
void ensureRegisterVisible(REGISTER_NAME reg);
|
||||
|
||||
protected slots:
|
||||
void fontsUpdatedSlot();
|
||||
void onIncrementAction();
|
||||
void onDecrementAction();
|
||||
void onIncrementx87StackAction();
|
||||
void onDecrementx87StackAction();
|
||||
void onZeroAction();
|
||||
void onSetToOneAction();
|
||||
void onModifyAction();
|
||||
void onToggleValueAction();
|
||||
void onUndoAction();
|
||||
void onCopyToClipboardAction();
|
||||
void onCopyFloatingPointToClipboardAction();
|
||||
void onCopySymbolToClipboardAction();
|
||||
void onCopyAllAction();
|
||||
void onFollowInDisassembly();
|
||||
void onFollowInDump();
|
||||
void onFollowInDumpN();
|
||||
void onFollowInStack();
|
||||
void onFollowInMemoryMap();
|
||||
void onIncrementPtrSize();
|
||||
void onDecrementPtrSize();
|
||||
void onPushAction();
|
||||
void onPopAction();
|
||||
void onHighlightSlot();
|
||||
void InitMappings();
|
||||
// switch SIMD display modes
|
||||
void onSIMDMode();
|
||||
void onFpuMode();
|
||||
void fontsUpdatedSlot();
|
||||
QString getRegisterLabel(REGISTER_NAME);
|
||||
int CompareRegisters(const REGISTER_NAME reg_name, REGDUMP* regdump1, REGDUMP* regdump2);
|
||||
SIZE_T GetSizeRegister(const REGISTER_NAME reg_name);
|
||||
|
@ -210,14 +181,13 @@ protected slots:
|
|||
//unsigned int GetControlWordRCValueFromString(const char* string);
|
||||
QString GetMxCsrRCStateString(unsigned short);
|
||||
//unsigned int GetMxCsrRCValueFromString(const char* string);
|
||||
void ModifyFields(const QString & title, STRING_VALUE_TABLE_t* table, SIZE_T size);
|
||||
//unsigned int GetStatusWordTOPValueFromString(const char* string);
|
||||
QString GetStatusWordTOPStateString(unsigned short state);
|
||||
void appendRegister(QString & text, REGISTER_NAME reg, const char* name64, const char* name32);
|
||||
void disasmSelectionChangedSlot(dsint va);
|
||||
private:
|
||||
|
||||
void onCopyAllAction();
|
||||
protected:
|
||||
QPushButton* mChangeViewButton;
|
||||
CPUWidget* mParent;
|
||||
bool mShowFpu;
|
||||
int mVScrollOffset;
|
||||
int mRowsNeeded;
|
||||
|
@ -267,47 +237,6 @@ private:
|
|||
unsigned int mRowHeight, mCharWidth;
|
||||
// SIMD registers display mode
|
||||
char mFpuMode; //0 = order by ST(X), 1 = order by x87rX, 2 = MMX registers
|
||||
// context menu actions
|
||||
QMenu* mSwitchSIMDDispMode;
|
||||
QAction* mDisplaySTX;
|
||||
QAction* mDisplayx87rX;
|
||||
QAction* mDisplayMMX;
|
||||
QAction* mFollowInDump;
|
||||
QAction* wCM_Increment;
|
||||
QAction* wCM_Decrement;
|
||||
QAction* wCM_IncrementPtrSize;
|
||||
QAction* wCM_DecrementPtrSize;
|
||||
QAction* wCM_Push;
|
||||
QAction* wCM_Pop;
|
||||
QAction* wCM_Zero;
|
||||
QAction* wCM_SetToOne;
|
||||
QAction* wCM_Modify;
|
||||
QAction* wCM_ToggleValue;
|
||||
QAction* wCM_Undo;
|
||||
QAction* wCM_CopyToClipboard;
|
||||
QAction* wCM_CopyFloatingPointValueToClipboard;
|
||||
QAction* wCM_CopySymbolToClipboard;
|
||||
QAction* wCM_CopyAll;
|
||||
QAction* wCM_FollowInDisassembly;
|
||||
QAction* wCM_FollowInDump;
|
||||
QAction* wCM_FollowInStack;
|
||||
QAction* wCM_FollowInMemoryMap;
|
||||
QAction* wCM_Incrementx87Stack;
|
||||
QAction* wCM_Decrementx87Stack;
|
||||
QAction* wCM_ChangeFPUView;
|
||||
QAction* wCM_Highlight;
|
||||
QAction* SIMDHex;
|
||||
QAction* SIMDFloat;
|
||||
QAction* SIMDDouble;
|
||||
QAction* SIMDSWord;
|
||||
QAction* SIMDUWord;
|
||||
QAction* SIMDHWord;
|
||||
QAction* SIMDSDWord;
|
||||
QAction* SIMDUDWord;
|
||||
QAction* SIMDHDWord;
|
||||
QAction* SIMDSQWord;
|
||||
QAction* SIMDUQWord;
|
||||
QAction* SIMDHQWord;
|
||||
dsint mCip;
|
||||
std::vector<std::pair<const char*, uint8_t>> mHighlightRegs;
|
||||
};
|
||||
|
|
|
@ -182,7 +182,7 @@ QString TraceBrowser::paintContent(QPainter* painter, dsint rowBase, int rowOffs
|
|||
{
|
||||
case Index:
|
||||
{
|
||||
return getIndexText(index);
|
||||
return mTraceFile->getIndexText(index);
|
||||
}
|
||||
|
||||
case Address:
|
||||
|
@ -634,29 +634,6 @@ void TraceBrowser::setupRightClickContextMenu()
|
|||
mRvaDisplayEnabled = RvaDisplayEnabled;
|
||||
menu->addSeparator();
|
||||
}
|
||||
#define addReg(str, reg) if(index + 1 < mTraceFile->Length()){menu->addAction(QString(str ":%1 -> %2").arg(ToPtrString(mTraceFile->Registers(index).regcontext.##reg)) \
|
||||
.arg(ToPtrString(mTraceFile->Registers(index + 1).regcontext.##reg))); }else{ menu->addAction(QString(str ":%1").arg(ToPtrString(mTraceFile->Registers(index).regcontext.##reg))); }
|
||||
addReg(ArchValue("EAX", "RAX"), cax)
|
||||
addReg(ArchValue("EBX", "RBX"), cbx)
|
||||
addReg(ArchValue("ECX", "RCX"), ccx)
|
||||
addReg(ArchValue("EDX", "RDX"), cdx)
|
||||
addReg(ArchValue("ESP", "RSP"), csp)
|
||||
addReg(ArchValue("EBP", "RBP"), cbp)
|
||||
addReg(ArchValue("ESI", "RSI"), csi)
|
||||
addReg(ArchValue("EDI", "RDI"), cdi)
|
||||
#ifdef _WIN64
|
||||
addReg("R8", r8)
|
||||
addReg("R9", r9)
|
||||
addReg("R10", r10)
|
||||
addReg("R11", r11)
|
||||
addReg("R12", r12)
|
||||
addReg("R13", r13)
|
||||
addReg("R14", r14)
|
||||
addReg("R15", r15)
|
||||
#endif //_WIN64
|
||||
addReg(ArchValue("EIP", "RIP"), cip)
|
||||
addReg(ArchValue("EFLAGS", "RFLAGS"), eflags)
|
||||
menu->addSeparator();
|
||||
menu->addAction(QString("ThreadID: %1").arg(mTraceFile->ThreadId(index)));
|
||||
if(index + 1 < mTraceFile->Length())
|
||||
{
|
||||
|
@ -763,6 +740,9 @@ void TraceBrowser::mousePressEvent(QMouseEvent* event)
|
|||
if(mAutoDisassemblyFollowSelection)
|
||||
followDisassemblySlot();
|
||||
|
||||
REGDUMP temp;
|
||||
temp = mTraceFile->Registers(getInitialSelection());
|
||||
emit updateTraceRegistersView(&temp);
|
||||
return;
|
||||
|
||||
break;
|
||||
|
@ -958,23 +938,6 @@ void TraceBrowser::makeVisible(duint index)
|
|||
setTableOffset(index - getViewableRowsCount() + 2);
|
||||
}
|
||||
|
||||
QString TraceBrowser::getIndexText(duint index) const
|
||||
{
|
||||
QString indexString;
|
||||
indexString = QString::number(index, 16).toUpper();
|
||||
if(mTraceFile->Length() < 16)
|
||||
return indexString;
|
||||
int digits;
|
||||
digits = floor(log2(mTraceFile->Length() - 1) / 4) + 1;
|
||||
digits -= indexString.size();
|
||||
while(digits > 0)
|
||||
{
|
||||
indexString = '0' + indexString;
|
||||
digits = digits - 1;
|
||||
}
|
||||
return indexString;
|
||||
}
|
||||
|
||||
void TraceBrowser::updateColors()
|
||||
{
|
||||
AbstractTableView::updateColors();
|
||||
|
@ -1165,7 +1128,7 @@ void TraceBrowser::copyIndexSlot()
|
|||
{
|
||||
if(i != getSelectionStart())
|
||||
clipboard += "\r\n";
|
||||
clipboard += getIndexText(i);
|
||||
clipboard += mTraceFile->getIndexText(i);
|
||||
}
|
||||
Bridge::CopyToClipboard(clipboard);
|
||||
}
|
||||
|
@ -1252,7 +1215,7 @@ void TraceBrowser::pushSelectionInto(bool copyBytes, QTextStream & stream, QText
|
|||
memoryText += token.text;
|
||||
}
|
||||
|
||||
stream << getIndexText(i) + " | " + address.leftJustified(addressLen, QChar(' '), true);
|
||||
stream << mTraceFile->getIndexText(i) + " | " + address.leftJustified(addressLen, QChar(' '), true);
|
||||
if(copyBytes)
|
||||
stream << " | " + bytes.leftJustified(bytesLen, QChar(' '), true);
|
||||
stream << " | " + disassembly.leftJustified(disassemblyLen, QChar(' '), true);
|
||||
|
@ -1260,7 +1223,7 @@ void TraceBrowser::pushSelectionInto(bool copyBytes, QTextStream & stream, QText
|
|||
stream << " | " + memoryText.leftJustified(memoryLen, QChar(' '), true) + " |" + fullComment;
|
||||
if(htmlStream)
|
||||
{
|
||||
*htmlStream << QString("<tr><td>%1</td><td>%2</td><td>").arg(getIndexText(i), address.toHtmlEscaped());
|
||||
*htmlStream << QString("<tr><td>%1</td><td>%2</td><td>").arg(mTraceFile->getIndexText(i), address.toHtmlEscaped());
|
||||
if(copyBytes)
|
||||
*htmlStream << QString("%1</td><td>").arg(bytesHTML);
|
||||
*htmlStream << QString("%1</td><td>").arg(htmlDisassembly);
|
||||
|
|
|
@ -42,7 +42,6 @@ private:
|
|||
void setupRightClickContextMenu();
|
||||
void makeVisible(duint index);
|
||||
QString getAddrText(dsint cur_addr, char label[MAX_LABEL_SIZE], bool getLabel);
|
||||
QString getIndexText(duint index) const;
|
||||
RichTextPainter::List getRichBytes(const Instruction_t & instr) const;
|
||||
void pushSelectionInto(bool copyBytes, QTextStream & stream, QTextStream* htmlStream = nullptr);
|
||||
void copySelectionSlot(bool copyBytes);
|
||||
|
@ -115,6 +114,7 @@ private:
|
|||
|
||||
signals:
|
||||
void displayReferencesWidget();
|
||||
void updateTraceRegistersView(void* registers);
|
||||
|
||||
public slots:
|
||||
void openFileSlot();
|
||||
|
|
|
@ -110,6 +110,23 @@ unsigned long long TraceFileReader::Length() const
|
|||
return length;
|
||||
}
|
||||
|
||||
QString TraceFileReader::getIndexText(unsigned long long index) const
|
||||
{
|
||||
QString indexString;
|
||||
indexString = QString::number(index, 16).toUpper();
|
||||
if(length < 16)
|
||||
return indexString;
|
||||
int digits;
|
||||
digits = floor(log2(length - 1) / 4) + 1;
|
||||
digits -= indexString.size();
|
||||
while(digits > 0)
|
||||
{
|
||||
indexString = '0' + indexString;
|
||||
digits = digits - 1;
|
||||
}
|
||||
return indexString;
|
||||
}
|
||||
|
||||
// Return the hash value of executable to be matched against current executable
|
||||
duint TraceFileReader::HashValue() const
|
||||
{
|
||||
|
|
|
@ -21,6 +21,8 @@ public:
|
|||
bool isError() const;
|
||||
int Progress() const;
|
||||
|
||||
QString getIndexText(unsigned long long index) const;
|
||||
|
||||
unsigned long long Length() const;
|
||||
|
||||
REGDUMP Registers(unsigned long long index);
|
||||
|
|
|
@ -9,23 +9,6 @@ static bool inRange(duint value, duint start, duint end)
|
|||
return value >= start && value <= end;
|
||||
}
|
||||
|
||||
static QString getIndexText(TraceFileReader* file, duint index)
|
||||
{
|
||||
QString indexString;
|
||||
indexString = QString::number(index, 16).toUpper();
|
||||
if(file->Length() < 16)
|
||||
return indexString;
|
||||
int digits;
|
||||
digits = floor(log2(file->Length() - 1) / 4) + 1;
|
||||
digits -= indexString.size();
|
||||
while(digits > 0)
|
||||
{
|
||||
indexString = '0' + indexString;
|
||||
digits = digits - 1;
|
||||
}
|
||||
return indexString;
|
||||
}
|
||||
|
||||
int TraceFileSearchConstantRange(TraceFileReader* file, duint start, duint end)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -90,7 +73,7 @@ int TraceFileSearchConstantRange(TraceFileReader* file, duint start, duint end)
|
|||
{
|
||||
GuiReferenceSetRowCount(count + 1);
|
||||
GuiReferenceSetCellContent(count, 0, ToPtrString(file->Registers(index).regcontext.cip).toUtf8().constData());
|
||||
GuiReferenceSetCellContent(count, 1, getIndexText(file, index).toUtf8().constData());
|
||||
GuiReferenceSetCellContent(count, 1, file->getIndexText(index).toUtf8().constData());
|
||||
unsigned char opcode[16];
|
||||
int opcodeSize = 0;
|
||||
file->OpCode(index, opcode, &opcodeSize);
|
||||
|
@ -135,7 +118,7 @@ int TraceFileSearchMemReference(TraceFileReader* file, duint address)
|
|||
{
|
||||
GuiReferenceSetRowCount(count + 1);
|
||||
GuiReferenceSetCellContent(count, 0, ToPtrString(file->Registers(index).regcontext.cip).toUtf8().constData());
|
||||
GuiReferenceSetCellContent(count, 1, getIndexText(file, index).toUtf8().constData());
|
||||
GuiReferenceSetCellContent(count, 1, file->getIndexText(index).toUtf8().constData());
|
||||
unsigned char opcode[16];
|
||||
int opcodeSize = 0;
|
||||
file->OpCode(index, opcode, &opcodeSize);
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
#include "TraceWidget.h"
|
||||
#include "ui_TraceWidget.h"
|
||||
#include "TraceBrowser.h"
|
||||
#include "RegistersView.h"
|
||||
#include "CPUInfoBox.h"
|
||||
|
||||
TraceWidget::TraceWidget(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TraceWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mTraceWidget = new TraceBrowser(this);
|
||||
mOverview = new StdTable(this);
|
||||
mInfo = new CPUInfoBox(this);
|
||||
mGeneralRegs = new RegistersView(this);
|
||||
//disasm
|
||||
ui->mTopLeftUpperRightFrameLayout->addWidget(mTraceWidget);
|
||||
//registers
|
||||
mGeneralRegs->setFixedWidth(1000);
|
||||
mGeneralRegs->ShowFPU(true);
|
||||
|
||||
QScrollArea* upperScrollArea = new QScrollArea(this);
|
||||
upperScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
upperScrollArea->setWidget(mGeneralRegs);
|
||||
|
||||
upperScrollArea->horizontalScrollBar()->setStyleSheet(ConfigHScrollBarStyle());
|
||||
upperScrollArea->verticalScrollBar()->setStyleSheet(ConfigVScrollBarStyle());
|
||||
|
||||
QPushButton* button_changeview = new QPushButton("", this);
|
||||
button_changeview->setStyleSheet("Text-align:left;padding: 4px;padding-left: 10px;");
|
||||
connect(button_changeview, SIGNAL(clicked()), mGeneralRegs, SLOT(onChangeFPUViewAction()));
|
||||
connect(mTraceWidget, SIGNAL(updateTraceRegistersView(void*)), this, SLOT(updateTraceRegistersView(void*)));
|
||||
|
||||
mGeneralRegs->SetChangeButton(button_changeview);
|
||||
|
||||
ui->mTopRightUpperFrameLayout->addWidget(button_changeview);
|
||||
ui->mTopRightUpperFrameLayout->addWidget(upperScrollArea);
|
||||
//info
|
||||
ui->mTopLeftLowerFrameLayout->addWidget(mInfo);
|
||||
int height = mInfo->getHeight();
|
||||
ui->mTopLeftLowerFrame->setMinimumHeight(height + 2);
|
||||
//overview
|
||||
ui->mTopRightLowerFrameLayout->addWidget(mOverview);
|
||||
|
||||
//set up overview
|
||||
mOverview->addColumnAt(500, tr("Overview"), true);
|
||||
mOverview->setRowCount(4);
|
||||
mOverview->setCellContent(0, 0, "hello");
|
||||
mOverview->setCellContent(1, 0, "world");
|
||||
mOverview->setCellContent(2, 0, "00000000");
|
||||
mOverview->setCellContent(3, 0, "here we will list all control flow transfers");
|
||||
}
|
||||
|
||||
TraceWidget::~TraceWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TraceWidget::updateTraceRegistersView(void* registers)
|
||||
{
|
||||
mGeneralRegs->setRegisters((REGDUMP*)registers);
|
||||
}
|
||||
|
||||
TraceBrowser* TraceWidget::getTraceBrowser()
|
||||
{
|
||||
return mTraceWidget;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef TRACEWIDGET_H
|
||||
#define TRACEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QVBoxLayout;
|
||||
class CPUWidget;
|
||||
class RegistersView;
|
||||
class TraceBrowser;
|
||||
class CPUInfoBox;
|
||||
class StdTable;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TraceWidget;
|
||||
}
|
||||
|
||||
class TraceWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TraceWidget(QWidget* parent);
|
||||
~TraceWidget();
|
||||
|
||||
TraceBrowser* getTraceBrowser();
|
||||
|
||||
protected slots:
|
||||
void updateTraceRegistersView(void* registers);
|
||||
|
||||
protected:
|
||||
TraceBrowser* mTraceWidget;
|
||||
RegistersView* mGeneralRegs;
|
||||
CPUInfoBox* mInfo;
|
||||
StdTable* mOverview;
|
||||
|
||||
private:
|
||||
Ui::TraceWidget* ui;
|
||||
};
|
||||
|
||||
#endif // TRACEWIDGET_H
|
|
@ -0,0 +1,205 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TraceWidget</class>
|
||||
<widget class="QWidget" name="TraceWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="mVSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QSplitter" name="mTopHSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QSplitter" name="mTopLeftVSplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="mTopLeftUpperRightFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="mTopLeftUpperRightFrameLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="mTopLeftLowerFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="mTopLeftLowerFrameLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="mTopRightVSplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="mTopRightUpperFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="mTopRightUpperFrameLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="mTopRightLowerFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="mTopRightLowerFrameLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionGoto">
|
||||
<property name="text">
|
||||
<string>Goto</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+G</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -74,6 +74,8 @@ RESOURCES += \
|
|||
resource.qrc
|
||||
|
||||
SOURCES += \
|
||||
Src/Gui/CPURegistersView.cpp \
|
||||
Src/Tracer/TraceWidget.cpp \
|
||||
Src/main.cpp \
|
||||
Src/Gui/MainWindow.cpp \
|
||||
Src/Gui/CPUWidget.cpp \
|
||||
|
@ -188,6 +190,8 @@ SOURCES += \
|
|||
|
||||
|
||||
HEADERS += \
|
||||
Src/Gui/CPURegistersView.h \
|
||||
Src/Tracer/TraceWidget.h \
|
||||
Src/main.h \
|
||||
Src/Gui/MainWindow.h \
|
||||
Src/Gui/CPUWidget.h \
|
||||
|
@ -345,7 +349,8 @@ FORMS += \
|
|||
Src/Gui/SimpleTraceDialog.ui \
|
||||
Src/Gui/MessagesBreakpoints.ui \
|
||||
Src/Gui/AboutDialog.ui \
|
||||
Src/Gui/ComboBoxDialog.ui
|
||||
Src/Gui/ComboBoxDialog.ui \
|
||||
Src/Tracer/TraceWidget.ui
|
||||
|
||||
##
|
||||
## Libraries
|
||||
|
|
|
@ -225,7 +225,9 @@ SOURCES += \
|
|||
gui/Src/Gui/MultiItemsSelectWindow.cpp \
|
||||
gui/Src/BasicView/AbstractStdTable.cpp \
|
||||
gui/Src/Gui/ZehSymbolTable.cpp \
|
||||
gui/Src/BasicView/StdSearchListView.cpp
|
||||
gui/Src/BasicView/StdSearchListView.cpp \
|
||||
gui/Src/Gui/CPURegistersView.cpp \
|
||||
gui/Src/Tracer/TraceWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
gui/Src/Exports.h \
|
||||
|
@ -462,7 +464,9 @@ HEADERS += \
|
|||
gui/Src/Gui/MultiItemsSelectWindow.h \
|
||||
gui/Src/BasicView/AbstractStdTable.h \
|
||||
gui/Src/Gui/ZehSymbolTable.h \
|
||||
gui/Src/BasicView/StdSearchListView.h
|
||||
gui/Src/BasicView/StdSearchListView.h \
|
||||
gui/Src/Gui/CPURegistersView.h \
|
||||
gui/Src/Tracer/TraceWidget.h
|
||||
|
||||
FORMS += \
|
||||
gui/Src/Gui/AppearanceDialog.ui \
|
||||
|
@ -501,7 +505,8 @@ FORMS += \
|
|||
gui/Src/Gui/SimpleTraceDialog.ui \
|
||||
gui/Src/Gui/StructWidget.ui \
|
||||
gui/Src/Gui/MessagesBreakpoints.ui \
|
||||
gui/Src/Gui/AboutDialog.ui
|
||||
gui/Src/Gui/AboutDialog.ui \
|
||||
gui/Src/Tracer/TraceWidget.ui
|
||||
|
||||
TRANSLATIONS += \
|
||||
gui/Translations/x64dbg.ts
|
Loading…
Reference in New Issue