Refactor AbstractTableView for cross-platform
parent
663bfbbb06
commit
7733012330
|
@ -176,7 +176,10 @@ extern "C"
|
|||
#define MAX_SECTION_SIZE 10
|
||||
#define MAX_COMMAND_LINE_SIZE 256
|
||||
#define MAX_MNEMONIC_SIZE 64
|
||||
|
||||
#ifndef PAGE_SIZE
|
||||
#define PAGE_SIZE 0x1000
|
||||
#endif // PAGE_SIZE
|
||||
|
||||
//Debugger enums
|
||||
typedef enum
|
||||
|
|
|
@ -19,11 +19,11 @@ public:
|
|||
virtual void unlock() = 0;
|
||||
virtual AbstractStdTable* list() const = 0;
|
||||
virtual AbstractStdTable* searchList() const = 0;
|
||||
virtual void filter(const QString & filter, FilterType type, int startColumn) = 0;
|
||||
virtual void filter(const QString & filter, FilterType type, duint startColumn) = 0;
|
||||
|
||||
bool rowMatchesFilter(const QString & filter, FilterType type, int row, int startColumn) const
|
||||
bool rowMatchesFilter(const QString & filter, FilterType type, duint row, duint startColumn) const
|
||||
{
|
||||
int count = list()->getColumnCount();
|
||||
auto count = list()->getColumnCount();
|
||||
if(startColumn + 1 > count)
|
||||
return false;
|
||||
auto cs = Qt::CaseInsensitive;
|
||||
|
@ -32,21 +32,21 @@ public:
|
|||
case FilterStartsWithTextCaseSensitive:
|
||||
cs = Qt::CaseSensitive;
|
||||
case FilterStartsWithTextCaseInsensitive:
|
||||
for(int i = startColumn; i < count; i++)
|
||||
for(duint i = startColumn; i < count; i++)
|
||||
if(list()->getCellContent(row, i).startsWith(filter, cs))
|
||||
return true;
|
||||
break;
|
||||
case FilterContainsTextCaseSensitive:
|
||||
cs = Qt::CaseSensitive;
|
||||
case FilterContainsTextCaseInsensitive:
|
||||
for(int i = startColumn; i < count; i++)
|
||||
for(duint i = startColumn; i < count; i++)
|
||||
if(list()->getCellContent(row, i).contains(filter, cs))
|
||||
return true;
|
||||
break;
|
||||
case FilterRegexCaseSensitive:
|
||||
cs = Qt::CaseSensitive;
|
||||
case FilterRegexCaseInsensitive:
|
||||
for(int i = startColumn; i < count; i++)
|
||||
for(duint i = startColumn; i < count; i++)
|
||||
if(list()->getCellContent(row, i).contains(QRegExp(filter, cs)))
|
||||
return true;
|
||||
break;
|
||||
|
|
|
@ -811,10 +811,10 @@ QString AbstractStdTable::copyTable(const std::vector<int> & colWidths)
|
|||
finalText += getColTitle(i);
|
||||
}
|
||||
finalText += "\r\n";
|
||||
for(int i = 0; i < rowCount; i++)
|
||||
for(duint i = 0; i < rowCount; i++)
|
||||
{
|
||||
QString finalRowText = "";
|
||||
for(int j = 0; j < colCount; j++)
|
||||
for(duint j = 0; j < colCount; j++)
|
||||
{
|
||||
if(j)
|
||||
finalRowText += " ";
|
||||
|
@ -857,7 +857,7 @@ void AbstractStdTable::copyTableResizeSlot()
|
|||
for(duint i = 0; i < colCount; i++)
|
||||
{
|
||||
auto max = getCellContent(0, i).length();
|
||||
for(int j = 1; j < rowCount; j++)
|
||||
for(duint j = 1; j < rowCount; j++)
|
||||
max = std::max(getCellContent(j, i).length(), max);
|
||||
colWidths.push_back(max);
|
||||
}
|
||||
|
@ -894,7 +894,7 @@ void AbstractStdTable::exportTableSlot()
|
|||
{
|
||||
std::vector<QString> headers;
|
||||
headers.reserve(getColumnCount());
|
||||
for(int i = 0; i < getColumnCount(); i++)
|
||||
for(duint i = 0; i < getColumnCount(); i++)
|
||||
headers.push_back(getColTitle(i));
|
||||
ExportCSV(getRowCount(), getColumnCount(), headers, [this](duint row, duint column)
|
||||
{
|
||||
|
@ -975,7 +975,7 @@ void AbstractStdTable::setupCopyColumnMenu(MenuBuilder* copyMenu)
|
|||
{
|
||||
copyMenu->addBuilder(new MenuBuilder(this, [this](QMenu * menu)
|
||||
{
|
||||
for(int i = 0; i < getColumnCount(); i++)
|
||||
for(duint i = 0; i < getColumnCount(); i++)
|
||||
{
|
||||
if(!getCellContent(getInitialSelection(), i).length()) //skip empty cells
|
||||
continue;
|
||||
|
|
|
@ -132,7 +132,7 @@ void AbstractTableView::updateShortcutsSlot()
|
|||
void AbstractTableView::loadColumnFromConfig(const QString & viewName)
|
||||
{
|
||||
duint columnCount = getColumnCount();
|
||||
for(int i = 0; i < columnCount; i++)
|
||||
for(duint i = 0; i < columnCount; i++)
|
||||
{
|
||||
duint width = ConfigUint("Gui", QString("%1ColumnWidth%2").arg(viewName).arg(i).toUtf8().constData());
|
||||
duint hidden = ConfigUint("Gui", QString("%1ColumnHidden%2").arg(viewName).arg(i).toUtf8().constData());
|
||||
|
@ -224,7 +224,7 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
QPen separatorPen(mSeparatorColor, 2);
|
||||
QBrush backgroundBrush(mHeaderBackgroundColor);
|
||||
|
||||
for(int j = 0; j < getColumnCount(); j++)
|
||||
for(duint j = 0; j < getColumnCount(); j++)
|
||||
{
|
||||
int i = mColumnOrder[j];
|
||||
if(getColumnHidden(i))
|
||||
|
@ -267,7 +267,7 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
int y = getHeaderHeight();
|
||||
|
||||
// Iterate over all columns and cells
|
||||
for(int k = 0; k < getColumnCount(); k++)
|
||||
for(duint k = 0; k < getColumnCount(); k++)
|
||||
{
|
||||
int j = mColumnOrder[k];
|
||||
if(getColumnHidden(j))
|
||||
|
@ -322,8 +322,8 @@ void AbstractTableView::mouseMoveEvent(QMouseEvent* event)
|
|||
{
|
||||
if(getColumnCount() <= 1)
|
||||
return;
|
||||
int colIndex = getColumnIndexFromX(event->x());
|
||||
int displayIndex = getColumnDisplayIndexFromX(event->x());
|
||||
auto colIndex = getColumnIndexFromX(event->x());
|
||||
auto displayIndex = getColumnDisplayIndexFromX(event->x());
|
||||
int startPos = getColumnPosition(displayIndex); // Position X of the start of column
|
||||
int endPos = startPos + getColumnWidth(colIndex); // Position X of the end of column
|
||||
bool onHandle = ((colIndex != 0) && (event->x() >= startPos) && (event->x() <= (startPos + 2))) || ((event->x() <= endPos) && (event->x() >= (endPos - 2)));
|
||||
|
@ -384,7 +384,7 @@ void AbstractTableView::mouseMoveEvent(QMouseEvent* event)
|
|||
|
||||
case AbstractTableView::HeaderButtonPressed:
|
||||
{
|
||||
int colIndex = getColumnIndexFromX(event->x());
|
||||
auto colIndex = getColumnIndexFromX(event->x());
|
||||
|
||||
if(colIndex == mHeader.activeButtonIndex)
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ void AbstractTableView::mousePressEvent(QMouseEvent* event)
|
|||
{
|
||||
mReorderStartX = event->x();
|
||||
|
||||
int colIndex = getColumnIndexFromX(event->x());
|
||||
auto colIndex = getColumnIndexFromX(event->x());
|
||||
if(mColumnList[colIndex].header.isClickable)
|
||||
{
|
||||
//qDebug() << "Button " << colIndex << "has been pressed.";
|
||||
|
@ -515,7 +515,7 @@ void AbstractTableView::mouseReleaseEvent(QMouseEvent* event)
|
|||
}
|
||||
|
||||
// Release all buttons
|
||||
for(int i = 0; i < getColumnCount(); i++)
|
||||
for(duint i = 0; i < getColumnCount(); i++)
|
||||
{
|
||||
mColumnList[i].header.isPressed = false;
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ void AbstractTableView::updateScrollBarRange(duint range)
|
|||
{
|
||||
// Count leading zeros
|
||||
int leadingZeroCount = 0;
|
||||
for(duint mask = 0x8000000000000000; mask != 0; mask >>= 1)
|
||||
for(uint64_t mask = 0x8000000000000000; mask != 0; mask >>= 1)
|
||||
{
|
||||
if((maxTableOffset & mask) != 0)
|
||||
{
|
||||
|
@ -954,28 +954,23 @@ dsint AbstractTableView::getIndexOffsetFromY(int y) const
|
|||
duint AbstractTableView::getColumnIndexFromX(int x) const
|
||||
{
|
||||
int scrollX = -horizontalScrollBar()->value();
|
||||
duint colIndex = 0;
|
||||
|
||||
while(colIndex < getColumnCount())
|
||||
for(duint colIndex = 0; colIndex < getColumnCount(); colIndex++)
|
||||
{
|
||||
auto col = mColumnOrder[colIndex];
|
||||
if(getColumnHidden(col))
|
||||
{
|
||||
colIndex++;
|
||||
continue;
|
||||
}
|
||||
scrollX += getColumnWidth(col);
|
||||
|
||||
scrollX += getColumnWidth(col);
|
||||
if(x <= scrollX)
|
||||
{
|
||||
return mColumnOrder[colIndex];
|
||||
}
|
||||
else if(colIndex < getColumnCount())
|
||||
{
|
||||
colIndex++;
|
||||
}
|
||||
}
|
||||
return getColumnCount() > 0 ? mColumnOrder[getColumnCount() - 1] : -1;
|
||||
|
||||
return getColumnCount() > 0 ? mColumnOrder[getColumnCount() - 1] : - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -985,31 +980,27 @@ duint AbstractTableView::getColumnIndexFromX(int x) const
|
|||
*
|
||||
* @return Displayed index.
|
||||
*/
|
||||
int AbstractTableView::getColumnDisplayIndexFromX(int x)
|
||||
duint AbstractTableView::getColumnDisplayIndexFromX(int x)
|
||||
{
|
||||
int scrollX = -horizontalScrollBar()->value();
|
||||
int colIndex = 0;
|
||||
|
||||
while(colIndex < getColumnCount())
|
||||
for(duint colIndex = 0; colIndex < getColumnCount(); colIndex++)
|
||||
{
|
||||
auto col = mColumnOrder[colIndex];
|
||||
if(getColumnHidden(col))
|
||||
{
|
||||
colIndex++;
|
||||
continue;
|
||||
}
|
||||
scrollX += getColumnWidth(col);
|
||||
|
||||
scrollX += getColumnWidth(col);
|
||||
if(x <= scrollX)
|
||||
{
|
||||
return colIndex;
|
||||
}
|
||||
else if(colIndex < getColumnCount())
|
||||
{
|
||||
colIndex++;
|
||||
}
|
||||
}
|
||||
return getColumnCount() - 1;
|
||||
|
||||
// TODO: what if there are no columns?
|
||||
return getColumnCount() > 0 ? getColumnCount() - 1 : -1;
|
||||
}
|
||||
|
||||
void AbstractTableView::updateLastColumnWidth()
|
||||
|
@ -1020,7 +1011,7 @@ void AbstractTableView::updateLastColumnWidth()
|
|||
int totalWidth = 0;
|
||||
int lastWidth = totalWidth;
|
||||
int last = 0;
|
||||
for(int i = 0; i < getColumnCount(); i++)
|
||||
for(duint i = 0; i < getColumnCount(); i++)
|
||||
{
|
||||
if(getColumnHidden(mColumnOrder[i]))
|
||||
continue;
|
||||
|
@ -1041,7 +1032,7 @@ void AbstractTableView::updateLastColumnWidth()
|
|||
MethodInvoker::invokeMethod([this]()
|
||||
{
|
||||
int totalWidth = 0;
|
||||
for(int i = 0; i < getColumnCount(); i++)
|
||||
for(duint i = 0; i < getColumnCount(); i++)
|
||||
if(!getColumnHidden(i))
|
||||
totalWidth += getColumnWidth(i);
|
||||
|
||||
|
@ -1065,7 +1056,7 @@ int AbstractTableView::getColumnPosition(duint index) const
|
|||
|
||||
if((index >= 0) && (index < getColumnCount()))
|
||||
{
|
||||
for(int i = 0; i < index; i++)
|
||||
for(duint i = 0; i < index; i++)
|
||||
if(!getColumnHidden(mColumnOrder[i]))
|
||||
posX += getColumnWidth(mColumnOrder[i]);
|
||||
return posX;
|
||||
|
@ -1150,7 +1141,7 @@ void AbstractTableView::deleteAllColumns()
|
|||
|
||||
void AbstractTableView::setColTitle(duint col, const QString & title)
|
||||
{
|
||||
if(mColumnList.size() > 0 && col >= 0 && col < mColumnList.size())
|
||||
if(mColumnList.size() > 0 && col < mColumnList.size())
|
||||
{
|
||||
Column column = mColumnList.takeAt(col);
|
||||
column.title = title;
|
||||
|
@ -1160,7 +1151,7 @@ void AbstractTableView::setColTitle(duint col, const QString & title)
|
|||
|
||||
QString AbstractTableView::getColTitle(duint col) const
|
||||
{
|
||||
if(mColumnList.size() > 0 && col >= 0 && col < mColumnList.size())
|
||||
if(mColumnList.size() > 0 && col < mColumnList.size())
|
||||
return mColumnList[col].title;
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#include "MemoryPage.h"
|
||||
#include "DisassemblyPopup.h"
|
||||
|
||||
Disassembly::Disassembly(QWidget* parent, bool isMain, Architecture* architecture)
|
||||
Disassembly::Disassembly(Architecture* architecture, bool isMain, QWidget* parent)
|
||||
: AbstractTableView(parent),
|
||||
mIsMain(isMain),
|
||||
mArchitecture(architecture)
|
||||
mArchitecture(architecture),
|
||||
mIsMain(isMain)
|
||||
{
|
||||
mMemPage = new MemoryPage(0, 0);
|
||||
|
||||
|
@ -73,6 +73,11 @@ Disassembly::~Disassembly()
|
|||
BridgeFree(mXrefInfo.references);
|
||||
}
|
||||
|
||||
Architecture* Disassembly::getArchitecture() const
|
||||
{
|
||||
return mArchitecture;
|
||||
}
|
||||
|
||||
void Disassembly::updateColors()
|
||||
{
|
||||
AbstractTableView::updateColors();
|
||||
|
@ -663,7 +668,7 @@ void Disassembly::mouseMoveEvent(QMouseEvent* event)
|
|||
|
||||
if((transY(y) >= 0) && (transY(y) <= this->getTableHeight()))
|
||||
{
|
||||
int i = getIndexOffsetFromY(transY(y));
|
||||
auto i = getIndexOffsetFromY(transY(y));
|
||||
|
||||
if(mMemPage->getSize() > 0)
|
||||
{
|
||||
|
@ -713,7 +718,7 @@ duint Disassembly::getAddressForPosition(int mousex, int mousey)
|
|||
return 0; //Don't show this in highlight mode
|
||||
if(getColumnIndexFromX(mousex) != 2)
|
||||
return 0; //Disassembly popup for other column is undefined
|
||||
int rowOffset = getIndexOffsetFromY(transY(mousey));
|
||||
auto rowOffset = getIndexOffsetFromY(transY(mousey));
|
||||
if(rowOffset < mInstBuffer.size())
|
||||
{
|
||||
ZydisTokenizer::SingleToken token;
|
||||
|
@ -752,7 +757,7 @@ void Disassembly::mousePressEvent(QMouseEvent* event)
|
|||
{
|
||||
if(getColumnIndexFromX(event->x()) == 2) //click in instruction column
|
||||
{
|
||||
int rowOffset = getIndexOffsetFromY(transY(event->y()));
|
||||
auto rowOffset = getIndexOffsetFromY(transY(event->y()));
|
||||
if(rowOffset < mInstBuffer.size())
|
||||
{
|
||||
ZydisTokenizer::SingleToken token;
|
||||
|
@ -790,7 +795,7 @@ void Disassembly::mousePressEvent(QMouseEvent* event)
|
|||
{
|
||||
if(event->y() > getHeaderHeight())
|
||||
{
|
||||
dsint index = getIndexOffsetFromY(transY(event->y()));
|
||||
auto index = getIndexOffsetFromY(transY(event->y()));
|
||||
|
||||
if(mInstBuffer.size() > index && index >= 0)
|
||||
{
|
||||
|
|
|
@ -13,8 +13,9 @@ class Disassembly : public AbstractTableView
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Disassembly(QWidget* parent, bool isMain, Architecture* architecture);
|
||||
Disassembly(Architecture* architecture, bool isMain, QWidget* parent = nullptr);
|
||||
~Disassembly() override;
|
||||
Architecture* getArchitecture() const;
|
||||
|
||||
// Configuration
|
||||
void updateColors() override;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,6 @@
|
|||
#include "RichTextPainter.h"
|
||||
#include "MemoryPage.h"
|
||||
#include "VaHistory.h"
|
||||
#include <QTextCodec>
|
||||
|
||||
class HexDump : public AbstractTableView
|
||||
{
|
||||
|
@ -74,12 +73,12 @@ public:
|
|||
bool isData = true;
|
||||
int itemCount = 16;
|
||||
int separator = 0;
|
||||
QTextCodec* textCodec = nullptr; //name of the text codec (leave empty if you want to keep your sanity)
|
||||
QByteArray textEncoding; // name of the text codec (leave empty if you want to keep your sanity)
|
||||
DataDescriptor data;
|
||||
std::function<void()> columnSwitch;
|
||||
};
|
||||
|
||||
explicit HexDump(QWidget* parent = 0);
|
||||
HexDump(Architecture* architecture, QWidget* parent = nullptr);
|
||||
~HexDump() override;
|
||||
|
||||
// Configuration
|
||||
|
@ -87,41 +86,40 @@ public:
|
|||
void updateFonts() override;
|
||||
void updateShortcuts() override;
|
||||
|
||||
//QString getStringToPrint(int rowBase, int rowOffset, int col);
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h) override;
|
||||
QString paintContent(QPainter* painter, duint row, duint column, int x, int y, int w, int h) override;
|
||||
void paintGraphicDump(QPainter* painter, int x, int y, int addr);
|
||||
void printSelected(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
void printSelected(QPainter* painter, duint row, duint column, int x, int y, int w, int h);
|
||||
|
||||
// Selection Management
|
||||
void expandSelectionUpTo(dsint rva);
|
||||
void setSingleSelection(dsint rva);
|
||||
dsint getInitialSelection() const;
|
||||
dsint getSelectionStart() const;
|
||||
dsint getSelectionEnd() const;
|
||||
bool isSelected(dsint rva) const;
|
||||
void expandSelectionUpTo(duint rva);
|
||||
void setSingleSelection(duint rva);
|
||||
duint getInitialSelection() const;
|
||||
duint getSelectionStart() const;
|
||||
duint getSelectionEnd() const;
|
||||
bool isSelected(duint rva) const;
|
||||
|
||||
virtual void getColumnRichText(int col, dsint rva, RichTextPainter::List & richText);
|
||||
virtual void getColumnRichText(duint column, duint rva, RichTextPainter::List & richText);
|
||||
|
||||
static size_t getSizeOf(DataSize size);
|
||||
|
||||
void toString(DataDescriptor desc, duint rva, byte_t* data, RichTextPainter::CustomRichText_t & richText);
|
||||
void toString(DataDescriptor desc, duint rva, uint8_t* data, RichTextPainter::CustomRichText_t & richText);
|
||||
|
||||
void byteToString(duint rva, byte_t byte, ByteViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
void wordToString(duint rva, uint16 word, WordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
static void dwordToString(duint rva, uint32 dword, DwordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
static void qwordToString(duint rva, uint64 qword, QwordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
void byteToString(duint rva, uint8_t byte, ByteViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
void wordToString(duint rva, uint16_t word, WordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
static void dwordToString(duint rva, uint32_t dword, DwordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
static void qwordToString(duint rva, uint64_t qword, QwordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
static void twordToString(duint rva, void* tword, TwordViewMode mode, RichTextPainter::CustomRichText_t & richText);
|
||||
|
||||
int getItemIndexFromX(int x) const;
|
||||
dsint getItemStartingAddress(int x, int y);
|
||||
duint getItemStartingAddress(int x, int y);
|
||||
|
||||
int getBytePerRowCount() const;
|
||||
size_t getBytePerRowCount() const;
|
||||
int getItemPixelWidth(ColumnDescriptor desc) const;
|
||||
|
||||
//descriptor management
|
||||
|
@ -129,8 +127,8 @@ public:
|
|||
void appendResetDescriptor(int width, QString title, bool clickable, ColumnDescriptor descriptor);
|
||||
void clearDescriptors();
|
||||
|
||||
void printDumpAt(dsint parVA, bool select, bool repaint = true, bool updateTableOffset = true);
|
||||
duint rvaToVa(dsint rva) const;
|
||||
void printDumpAt(duint parVA, bool select, bool repaint = true, bool updateTableOffset = true);
|
||||
duint rvaToVa(duint rva) const;
|
||||
|
||||
duint getTableOffsetRva() const;
|
||||
QString makeAddrText(duint va) const;
|
||||
|
@ -144,7 +142,7 @@ signals:
|
|||
void selectionUpdated();
|
||||
|
||||
public slots:
|
||||
void printDumpAt(dsint parVA);
|
||||
void printDumpAt(duint parVA);
|
||||
void debugStateChanged(DBGSTATE state);
|
||||
void updateDumpSlot();
|
||||
void copySelectionSlot();
|
||||
|
@ -162,9 +160,9 @@ private:
|
|||
|
||||
struct SelectionData
|
||||
{
|
||||
dsint firstSelectedIndex;
|
||||
dsint fromIndex;
|
||||
dsint toIndex;
|
||||
duint firstSelectedIndex = 0;
|
||||
duint fromIndex = 0;
|
||||
duint toIndex = 0;
|
||||
};
|
||||
|
||||
SelectionData mSelection;
|
||||
|
@ -209,13 +207,14 @@ private:
|
|||
std::vector<uint8_t> mUpdateCacheTemp;
|
||||
|
||||
protected:
|
||||
MemoryPage* mMemPage;
|
||||
int mByteOffset;
|
||||
Architecture* mArchitecture = nullptr;
|
||||
MemoryPage* mMemPage = nullptr;
|
||||
dsint mByteOffset = 0;
|
||||
QList<ColumnDescriptor> mDescriptor;
|
||||
int mForceColumn;
|
||||
bool mRvaDisplayEnabled;
|
||||
duint mRvaDisplayBase;
|
||||
dsint mRvaDisplayPageBase;
|
||||
duint mRvaDisplayPageBase;
|
||||
QString mSyncAddrExpression;
|
||||
QAction* mCopyAddress;
|
||||
QAction* mCopyRva;
|
||||
|
|
|
@ -278,7 +278,7 @@ void LabeledSplitter::loadFromConfig(const QString & configName)
|
|||
size_t sizeofState = strlen(state);
|
||||
if(sizeofState > 0)
|
||||
this->restoreState(QByteArray::fromBase64(QByteArray(state, int(sizeofState))));
|
||||
connect(Bridge::getBridge(), SIGNAL(shutdown()), this, SLOT(shutdownSlot()));
|
||||
connect(Bridge::getBridge(), SIGNAL(close()), this, SLOT(shutdownSlot()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ void ReferenceView::connectBridge()
|
|||
connect(Bridge::getBridge(), SIGNAL(referenceSetProgress(int)), this, SLOT(referenceSetProgressSlot(int)));
|
||||
connect(Bridge::getBridge(), SIGNAL(referenceSetCurrentTaskProgress(int, QString)), this, SLOT(referenceSetCurrentTaskProgressSlot(int, QString)));
|
||||
connect(Bridge::getBridge(), SIGNAL(referenceAddCommand(QString, QString)), this, SLOT(addCommand(QString, QString)));
|
||||
connect(stdSearchList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
|
||||
connect(stdList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
|
||||
connect(stdSearchList(), SIGNAL(selectionChanged(duint)), this, SLOT(searchSelectionChanged(int)));
|
||||
connect(stdList(), SIGNAL(selectionChanged(duint)), this, SLOT(searchSelectionChanged(int)));
|
||||
}
|
||||
|
||||
void ReferenceView::disconnectBridge()
|
||||
|
@ -113,8 +113,8 @@ void ReferenceView::disconnectBridge()
|
|||
disconnect(Bridge::getBridge(), SIGNAL(referenceSetProgress(int)), this, SLOT(referenceSetProgressSlot(int)));
|
||||
disconnect(Bridge::getBridge(), SIGNAL(referenceSetCurrentTaskProgress(int, QString)), this, SLOT(referenceSetCurrentTaskProgressSlot(int, QString)));
|
||||
disconnect(Bridge::getBridge(), SIGNAL(referenceAddCommand(QString, QString)), this, SLOT(addCommand(QString, QString)));
|
||||
disconnect(stdSearchList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
|
||||
disconnect(stdList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
|
||||
disconnect(stdSearchList(), SIGNAL(selectionChanged(int)), this, SLOT(searchSelectionChanged(int)));
|
||||
disconnect(stdList(), SIGNAL(selectionChanged(int)), this, SLOT(searchSelectionChanged(int)));
|
||||
}
|
||||
|
||||
int ReferenceView::progress() const
|
||||
|
@ -284,7 +284,7 @@ void ReferenceView::followGenericAddress()
|
|||
}
|
||||
}
|
||||
|
||||
void ReferenceView::setBreakpointAt(int row, BPSetAction action)
|
||||
void ReferenceView::setBreakpointAt(duint row, BPSetAction action)
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
@ -334,14 +334,14 @@ void ReferenceView::toggleBreakpoint()
|
|||
void ReferenceView::setBreakpointOnAllCommands()
|
||||
{
|
||||
GuiDisableUpdateScope s;
|
||||
for(int i = 0; i < mCurList->getRowCount(); i++)
|
||||
for(duint i = 0; i < mCurList->getRowCount(); i++)
|
||||
setBreakpointAt(i, Enable);
|
||||
}
|
||||
|
||||
void ReferenceView::removeBreakpointOnAllCommands()
|
||||
{
|
||||
GuiDisableUpdateScope s;
|
||||
for(int i = 0; i < mCurList->getRowCount(); i++)
|
||||
for(duint i = 0; i < mCurList->getRowCount(); i++)
|
||||
setBreakpointAt(i, Remove);
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ void ReferenceView::setBreakpointOnAllApiCalls()
|
|||
QString apiText = mCurList->getCellContent(mCurList->getInitialSelection(), 1);
|
||||
|
||||
GuiDisableUpdateScope s;
|
||||
for(int i = 0; i < mCurList->getRowCount(); i++)
|
||||
for(duint i = 0; i < mCurList->getRowCount(); i++)
|
||||
if(mCurList->getCellContent(i, 1) == apiText)
|
||||
setBreakpointAt(i, Enable);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ void ReferenceView::removeBreakpointOnAllApiCalls()
|
|||
QString apiText = mCurList->getCellContent(mCurList->getInitialSelection(), 1);
|
||||
|
||||
GuiDisableUpdateScope s;
|
||||
for(int i = 0; i < mCurList->getRowCount(); i++)
|
||||
for(duint i = 0; i < mCurList->getRowCount(); i++)
|
||||
if(mCurList->getCellContent(i, 1) == apiText)
|
||||
setBreakpointAt(i, Remove);
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ void ReferenceView::referenceExecCommand()
|
|||
for(int selected : mCurList->getSelection()) //to do: enable multi-selection
|
||||
{
|
||||
QString specializedCommand = command;
|
||||
for(int i = 0; i < mCurList->getColumnCount(); i++)
|
||||
for(duint i = 0; i < mCurList->getColumnCount(); i++)
|
||||
{
|
||||
QString token = "$" + QString::number(i);
|
||||
if(specializedCommand.contains(token))
|
||||
|
|
|
@ -75,7 +75,7 @@ private:
|
|||
Remove
|
||||
};
|
||||
|
||||
void setBreakpointAt(int row, BPSetAction action);
|
||||
void setBreakpointAt(duint row, BPSetAction action);
|
||||
dsint apiAddressFromString(const QString & s);
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
|
|
@ -93,7 +93,6 @@ SearchListView::SearchListView(QWidget* parent, AbstractSearchList* abstractSear
|
|||
|
||||
// Set global variables
|
||||
mCurList = abstractSearchList->list();
|
||||
mSearchStartCol = 0;
|
||||
|
||||
// Install input event filter
|
||||
mSearchBox->installEventFilter(this);
|
||||
|
@ -205,9 +204,9 @@ void SearchListView::filterEntries()
|
|||
bool hasSetSingleSelection = false;
|
||||
if(!mLastFirstColValue.isEmpty())
|
||||
{
|
||||
int rows = mCurList->getRowCount();
|
||||
auto rows = mCurList->getRowCount();
|
||||
mCurList->setTableOffset(0);
|
||||
for(int i = 0; i < rows; i++)
|
||||
for(duint i = 0; i < rows; i++)
|
||||
{
|
||||
if(mCurList->getCellContent(i, 0) == mLastFirstColValue)
|
||||
{
|
||||
|
|
|
@ -14,8 +14,8 @@ class SearchListView : public QWidget, public ActionHelper<SearchListView>
|
|||
public:
|
||||
explicit SearchListView(QWidget* parent, AbstractSearchList* abstractSearchList, bool enableRegex, bool enableLock);
|
||||
|
||||
AbstractStdTable* mCurList;
|
||||
int mSearchStartCol;
|
||||
AbstractStdTable* mCurList = nullptr;
|
||||
duint mSearchStartCol = 0;
|
||||
|
||||
bool findTextInList(AbstractStdTable* list, QString text, int row, int startcol, bool startswith);
|
||||
void refreshSearchList();
|
||||
|
|
|
@ -24,20 +24,13 @@ int StdIconTable::getIconColumn() const
|
|||
return mIconColumn;
|
||||
}
|
||||
|
||||
void StdIconTable::setRowCount(dsint count)
|
||||
void StdIconTable::setRowCount(duint count)
|
||||
{
|
||||
int wRowToAddOrRemove = count - int(mIcon.size());
|
||||
for(int i = 0; i < qAbs(wRowToAddOrRemove); i++)
|
||||
{
|
||||
if(wRowToAddOrRemove > 0)
|
||||
mIcon.push_back(QIcon());
|
||||
else
|
||||
mIcon.pop_back();
|
||||
}
|
||||
mIcon.resize(count);
|
||||
StdTable::setRowCount(count);
|
||||
}
|
||||
|
||||
void StdIconTable::sortRows(int column, bool ascending)
|
||||
void StdIconTable::sortRows(duint column, bool ascending)
|
||||
{
|
||||
auto sortFn = mColumnSortFunctions.at(column);
|
||||
std::vector<size_t> index;
|
||||
|
@ -61,24 +54,24 @@ void StdIconTable::sortRows(int column, bool ascending)
|
|||
}
|
||||
}
|
||||
|
||||
QString StdIconTable::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
QString StdIconTable::paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h)
|
||||
{
|
||||
if(col == mIconColumn)
|
||||
{
|
||||
// Draw the selection first, so that transparent icons are drawn properly
|
||||
if(isSelected(rowBase, rowOffset))
|
||||
if(isSelected(row))
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(mSelectionColor));
|
||||
|
||||
mIcon.at(rowBase + rowOffset).paint(painter, x, y, h, h);
|
||||
QString wStr = StdTable::paintContent(painter, rowBase, rowOffset, col, x + h, y, w - h, h);
|
||||
mIcon.at(row).paint(painter, x, y, h, h);
|
||||
QString str = StdTable::paintContent(painter, row, col, x + h, y, w - h, h);
|
||||
|
||||
if(wStr.length())
|
||||
if(str.length())
|
||||
{
|
||||
painter->setPen(getCellColor(rowBase + rowOffset, col));
|
||||
painter->drawText(QRect(x + 4 + h, y, w - 4 - h, h), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
||||
painter->setPen(getCellColor(row, col));
|
||||
painter->drawText(QRect(x + 4 + h, y, w - 4 - h, h), Qt::AlignVCenter | Qt::AlignLeft, str);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
else
|
||||
return StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
return StdTable::paintContent(painter, row, col, x, y, w, h);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ void StdSearchListView::reloadData()
|
|||
});
|
||||
}
|
||||
|
||||
void StdSearchListView::setSearchStartCol(int col)
|
||||
void StdSearchListView::setSearchStartCol(duint col)
|
||||
{
|
||||
if(col < stdList()->getColumnCount())
|
||||
mSearchStartCol = col;
|
||||
|
|
|
@ -23,7 +23,7 @@ public slots:
|
|||
virtual void setRowCount(dsint count);
|
||||
void setCellContent(int r, int c, QString s);
|
||||
void reloadData();
|
||||
void setSearchStartCol(int col);
|
||||
void setSearchStartCol(duint col);
|
||||
|
||||
private:
|
||||
StdTableSearchList* mSearchListData;
|
||||
|
|
|
@ -52,30 +52,36 @@ void StdTable::deleteAllColumns()
|
|||
mColumnSortFunctions.clear();
|
||||
}
|
||||
|
||||
void StdTable::setRowCount(dsint count)
|
||||
void StdTable::setRowCount(duint count)
|
||||
{
|
||||
int wRowToAddOrRemove = count - int(mData.size());
|
||||
for(int i = 0; i < qAbs(wRowToAddOrRemove); i++)
|
||||
auto oldSize = mData.size();
|
||||
mData.resize(count);
|
||||
if(oldSize < count)
|
||||
{
|
||||
if(wRowToAddOrRemove > 0)
|
||||
for(duint i = oldSize; i < count; i++)
|
||||
{
|
||||
mData.push_back(std::vector<CellData>());
|
||||
for(int j = 0; j < getColumnCount(); j++)
|
||||
mData[mData.size() - 1].push_back(CellData());
|
||||
mData[i].resize(getColumnCount());
|
||||
}
|
||||
else
|
||||
mData.pop_back();
|
||||
}
|
||||
AbstractTableView::setRowCount(count);
|
||||
}
|
||||
|
||||
void StdTable::setCellContent(int r, int c, QString s)
|
||||
void StdTable::setCellContent(duint r, duint c, QString s)
|
||||
{
|
||||
if(isValidIndex(r, c))
|
||||
mData[r][c].text = std::move(s);
|
||||
}
|
||||
|
||||
QString StdTable::getCellContent(int r, int c)
|
||||
void StdTable::setCellContent(duint r, duint c, QString s, duint userdata)
|
||||
{
|
||||
if(isValidIndex(r, c))
|
||||
{
|
||||
mData[r][c].text = std::move(s);
|
||||
mData[r][c].userdata = userdata;
|
||||
}
|
||||
}
|
||||
|
||||
QString StdTable::getCellContent(duint r, duint c)
|
||||
{
|
||||
if(isValidIndex(r, c))
|
||||
return mData[r][c].text;
|
||||
|
@ -83,25 +89,25 @@ QString StdTable::getCellContent(int r, int c)
|
|||
return QString("");
|
||||
}
|
||||
|
||||
void StdTable::setCellUserdata(int r, int c, duint userdata)
|
||||
void StdTable::setCellUserdata(duint r, duint c, duint userdata)
|
||||
{
|
||||
if(isValidIndex(r, c))
|
||||
mData[r][c].userdata = userdata;
|
||||
}
|
||||
|
||||
duint StdTable::getCellUserdata(int r, int c)
|
||||
duint StdTable::getCellUserdata(duint r, duint c)
|
||||
{
|
||||
return isValidIndex(r, c) ? mData[r][c].userdata : 0;
|
||||
}
|
||||
|
||||
bool StdTable::isValidIndex(int r, int c)
|
||||
bool StdTable::isValidIndex(duint r, duint c)
|
||||
{
|
||||
if(r < 0 || c < 0 || r >= int(mData.size()))
|
||||
return false;
|
||||
return c < int(mData.at(r).size());
|
||||
}
|
||||
|
||||
void StdTable::sortRows(int column, bool ascending)
|
||||
void StdTable::sortRows(duint column, bool ascending)
|
||||
{
|
||||
auto sortFn = mColumnSortFunctions.at(column);
|
||||
std::stable_sort(mData.begin(), mData.end(), [column, ascending, &sortFn](const std::vector<CellData> & a, const std::vector<CellData> & b)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "StdTableSearchList.h"
|
||||
#include "StdIconTable.h"
|
||||
|
||||
void StdTableSearchList::filter(const QString & filter, FilterType type, int startColumn)
|
||||
void StdTableSearchList::filter(const QString & filter, FilterType type, duint startColumn)
|
||||
{
|
||||
StdIconTable* mSearchIconList = qobject_cast<StdIconTable*>(mSearchList);
|
||||
StdIconTable* mIconList = qobject_cast<StdIconTable*>(mList);
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
AbstractStdTable* list() const override { return mList; }
|
||||
AbstractStdTable* searchList() const override { return mSearchList; }
|
||||
|
||||
void filter(const QString & filter, FilterType type, int startColumn) override;
|
||||
void filter(const QString & filter, FilterType type, duint startColumn) override;
|
||||
|
||||
private:
|
||||
StdTable* mList;
|
||||
|
|
|
@ -85,7 +85,7 @@ void Bridge::initBridge()
|
|||
mBridge = new Bridge();
|
||||
}
|
||||
|
||||
Architecture* Bridge::getArch()
|
||||
Architecture* Bridge::getArchitecture()
|
||||
{
|
||||
return &mArch;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
|
||||
case GUI_REF_SETSEARCHSTARTCOL:
|
||||
if(referenceManager->currentReferenceView())
|
||||
referenceManager->currentReferenceView()->setSearchStartCol((int)param1);
|
||||
referenceManager->currentReferenceView()->setSearchStartCol((duint)param1);
|
||||
break;
|
||||
|
||||
case GUI_REF_INITIALIZE:
|
||||
|
@ -379,7 +379,7 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
|
|||
byte_t buffer[16];
|
||||
if(!DbgMemRead(parVA, buffer, 16))
|
||||
return 0;
|
||||
QZydis disasm(int(ConfigUint("Disassembler", "MaxModuleSize")), Bridge::getArch());
|
||||
QZydis disasm(int(ConfigUint("Disassembler", "MaxModuleSize")), Bridge::getArchitecture());
|
||||
Instruction_t instr = disasm.DisassembleAt(buffer, 16, 0, parVA);
|
||||
QString finalInstruction;
|
||||
for(const auto & curToken : instr.tokens.tokens)
|
||||
|
|
|
@ -43,6 +43,8 @@ class QZydis
|
|||
{
|
||||
public:
|
||||
QZydis(int maxModuleSize, Architecture* architecture);
|
||||
QZydis(const QZydis &) = delete;
|
||||
QZydis(QZydis &&) = delete;
|
||||
~QZydis();
|
||||
ulong DisassembleBack(const uint8_t* data, duint base, duint size, duint ip, int n);
|
||||
ulong DisassembleNext(const uint8_t* data, duint base, duint size, duint ip, int n);
|
||||
|
|
|
@ -112,7 +112,7 @@ retryFindWindow:
|
|||
refresh();
|
||||
QString pidText = QString().sprintf(ConfigBool("Gui", "PidTidInHex") ? "%.8X" : "%u", pid);
|
||||
bool found = false;
|
||||
for(int i = 0; i < mSearchListView->mCurList->getRowCount(); i++)
|
||||
for(duint i = 0; i < mSearchListView->mCurList->getRowCount(); i++)
|
||||
{
|
||||
if(mSearchListView->mCurList->getCellContent(i, ColPid) == pidText)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ BreakpointsView::BreakpointsView(QWidget* parent)
|
|||
addColumnAt(0, tr("Summary"), true);
|
||||
loadColumnFromConfig("BreakpointsView");
|
||||
|
||||
mDisasm = new QZydis(ConfigUint("Disassembler", "MaxModuleSize"), Bridge::getArch());
|
||||
mDisasm = new QZydis(ConfigUint("Disassembler", "MaxModuleSize"), Bridge::getArchitecture());
|
||||
mDisasm->UpdateConfig();
|
||||
enableMultiSelection(true);
|
||||
|
||||
|
|
|
@ -3,13 +3,10 @@
|
|||
#include "Configuration.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
CPUArgumentWidget::CPUArgumentWidget(QWidget* parent) :
|
||||
CPUArgumentWidget::CPUArgumentWidget(Architecture* architecture, QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CPUArgumentWidget),
|
||||
mTable(nullptr),
|
||||
mCurrentCallingConvention(-1),
|
||||
mStackOffset(0),
|
||||
mAllowUpdate(true)
|
||||
mArchitecture(architecture)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
mTable = ui->table;
|
||||
|
@ -32,7 +29,7 @@ CPUArgumentWidget::CPUArgumentWidget(QWidget* parent) :
|
|||
connect(mFollowAddrStack, SIGNAL(triggered()), this, SLOT(followStackSlot()));
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(repaintTableView()), this, SLOT(refreshData()));
|
||||
connect(Bridge::getBridge(), SIGNAL(disassembleAt(dsint, dsint)), this, SLOT(disassembleAtSlot(dsint, dsint)));
|
||||
connect(Bridge::getBridge(), SIGNAL(disassembleAt(duint, duint)), this, SLOT(disassembleAtSlot(duint, duint)));
|
||||
}
|
||||
|
||||
CPUArgumentWidget::~CPUArgumentWidget()
|
||||
|
@ -46,7 +43,7 @@ void CPUArgumentWidget::updateStackOffset(bool iscall)
|
|||
mStackOffset = cur.getStackOffset() + (iscall ? 0 : cur.getCallOffset());
|
||||
}
|
||||
|
||||
void CPUArgumentWidget::disassembleAtSlot(dsint addr, dsint cip)
|
||||
void CPUArgumentWidget::disassembleAtSlot(duint addr, duint cip)
|
||||
{
|
||||
Q_UNUSED(addr);
|
||||
if(mCurrentCallingConvention == -1) //no calling conventions
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <vector>
|
||||
#include "StdTable.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Architecture.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -15,7 +16,7 @@ class CPUArgumentWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CPUArgumentWidget(QWidget* parent = 0);
|
||||
explicit CPUArgumentWidget(Architecture* architecture, QWidget* parent = nullptr);
|
||||
~CPUArgumentWidget();
|
||||
|
||||
static QString defaultArgFormat(const QString & format, const QString & expression)
|
||||
|
@ -40,7 +41,7 @@ public:
|
|||
}
|
||||
|
||||
public slots:
|
||||
void disassembleAtSlot(dsint addr, dsint cip);
|
||||
void disassembleAtSlot(duint addr, duint cip);
|
||||
void refreshData();
|
||||
|
||||
private slots:
|
||||
|
@ -133,11 +134,12 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
Ui::CPUArgumentWidget* ui;
|
||||
StdTable* mTable;
|
||||
int mCurrentCallingConvention;
|
||||
duint mStackOffset;
|
||||
bool mAllowUpdate;
|
||||
Architecture* mArchitecture = nullptr;
|
||||
Ui::CPUArgumentWidget* ui = nullptr;
|
||||
StdTable* mTable = nullptr;
|
||||
int mCurrentCallingConvention = -1;
|
||||
duint mStackOffset = 0;
|
||||
bool mAllowUpdate = true;
|
||||
std::vector<CallingConvention> mCallingConventions;
|
||||
std::vector<duint> mArgumentValues;
|
||||
QAction* mFollowDisasm;
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
#include "BrowseDialog.h"
|
||||
#include "Tracer/TraceBrowser.h"
|
||||
|
||||
CPUDisassembly::CPUDisassembly(QWidget* parent, bool isMain) : Disassembly(parent, isMain)
|
||||
CPUDisassembly::CPUDisassembly(Architecture* architecture, bool isMain, QWidget* parent)
|
||||
: Disassembly(architecture, isMain, parent)
|
||||
{
|
||||
setWindowTitle("Disassembly");
|
||||
|
||||
|
@ -34,7 +35,7 @@ CPUDisassembly::CPUDisassembly(QWidget* parent, bool isMain) : Disassembly(paren
|
|||
setupRightClickContextMenu();
|
||||
|
||||
// Connect bridge<->disasm calls
|
||||
connect(Bridge::getBridge(), SIGNAL(disassembleAt(dsint, dsint)), this, SLOT(disassembleAtSlot(dsint, dsint)));
|
||||
connect(Bridge::getBridge(), SIGNAL(disassembleAt(duint, duint)), this, SLOT(disassembleAtSlot(duint, duint)));
|
||||
if(mIsMain)
|
||||
{
|
||||
connect(Bridge::getBridge(), SIGNAL(selectionDisasmGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
|
||||
|
@ -133,7 +134,7 @@ void CPUDisassembly::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
void CPUDisassembly::addFollowReferenceMenuItem(QString name, dsint value, QMenu* menu, bool isReferences, bool isFollowInCPU)
|
||||
void CPUDisassembly::addFollowReferenceMenuItem(QString name, duint value, QMenu* menu, bool isReferences, bool isFollowInCPU)
|
||||
{
|
||||
foreach(QAction* action, menu->actions()) //check for duplicate action
|
||||
if(action->text() == name)
|
||||
|
@ -149,7 +150,7 @@ void CPUDisassembly::addFollowReferenceMenuItem(QString name, dsint value, QMenu
|
|||
connect(newAction, SIGNAL(triggered()), this, SLOT(followActionSlot()));
|
||||
}
|
||||
|
||||
void CPUDisassembly::setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isReferences, bool isFollowInCPU)
|
||||
void CPUDisassembly::setupFollowReferenceMenu(duint va, QMenu* menu, bool isReferences, bool isFollowInCPU)
|
||||
{
|
||||
//remove previous actions
|
||||
QList<QAction*> list = menu->actions();
|
||||
|
@ -162,12 +163,12 @@ void CPUDisassembly::setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isRef
|
|||
if(isReferences)
|
||||
menu->addAction(mReferenceSelectedAddressAction);
|
||||
else
|
||||
addFollowReferenceMenuItem(tr("&Selected Address"), wVA, menu, isReferences, isFollowInCPU);
|
||||
addFollowReferenceMenuItem(tr("&Selected Address"), va, menu, isReferences, isFollowInCPU);
|
||||
}
|
||||
|
||||
//add follow actions
|
||||
DISASM_INSTR instr;
|
||||
DbgDisasmAt(wVA, &instr);
|
||||
DbgDisasmAt(va, &instr);
|
||||
|
||||
if(!isReferences) //follow in dump
|
||||
{
|
||||
|
@ -735,19 +736,19 @@ void CPUDisassembly::setLabelSlot()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
duint wVA = rvaToVa(getInitialSelection());
|
||||
duint va = rvaToVa(getInitialSelection());
|
||||
LineEditDialog mLineEdit(this);
|
||||
mLineEdit.setTextMaxLength(MAX_LABEL_SIZE - 2);
|
||||
QString addr_text = ToPtrString(wVA);
|
||||
QString addr_text = ToPtrString(va);
|
||||
char label_text[MAX_COMMENT_SIZE] = "";
|
||||
if(DbgGetLabelAt((duint)wVA, SEG_DEFAULT, label_text))
|
||||
if(DbgGetLabelAt((duint)va, SEG_DEFAULT, label_text))
|
||||
mLineEdit.setText(QString(label_text));
|
||||
mLineEdit.setWindowTitle(tr("Add label at ") + addr_text);
|
||||
restart:
|
||||
if(mLineEdit.exec() != QDialog::Accepted)
|
||||
return;
|
||||
QByteArray utf8data = mLineEdit.editText.toUtf8();
|
||||
if(!utf8data.isEmpty() && DbgIsValidExpression(utf8data.constData()) && DbgValFromString(utf8data.constData()) != wVA)
|
||||
if(!utf8data.isEmpty() && DbgIsValidExpression(utf8data.constData()) && DbgValFromString(utf8data.constData()) != va)
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Warning, tr("The label may be in use"),
|
||||
tr("The label \"%1\" may be an existing label or a valid expression. Using such label might have undesired effects. Do you still want to continue?").arg(mLineEdit.editText),
|
||||
|
@ -758,7 +759,7 @@ restart:
|
|||
if(msg.exec() == QMessageBox::No)
|
||||
goto restart;
|
||||
}
|
||||
if(!DbgSetLabelAt(wVA, utf8data.constData()))
|
||||
if(!DbgSetLabelAt(va, utf8data.constData()))
|
||||
SimpleErrorBox(this, tr("Error!"), tr("DbgSetLabelAt failed!"));
|
||||
|
||||
GuiUpdateAllViews();
|
||||
|
@ -914,7 +915,7 @@ void CPUDisassembly::assembleSlot()
|
|||
|
||||
assembly_error = false;
|
||||
|
||||
assembleDialog.setSelectedInstrVa(wVA);
|
||||
assembleDialog.setSelectedInstrVa(va);
|
||||
if(ConfigBool("Disassembler", "Uppercase"))
|
||||
actual_inst = actual_inst.toUpper().replace(QRegularExpression("0X([0-9A-F]+)"), "0x\\1");
|
||||
assembleDialog.setTextEditValue(actual_inst);
|
||||
|
@ -937,7 +938,7 @@ void CPUDisassembly::assembleSlot()
|
|||
if(expression == QString("???") || expression.toLower() == instr.instStr.toLower() || expression == QString(""))
|
||||
break;
|
||||
|
||||
if(!DbgFunctions()->AssembleAtEx(wVA, expression.toUtf8().constData(), error, assembleDialog.bFillWithNopsChecked))
|
||||
if(!DbgFunctions()->AssembleAtEx(va, expression.toUtf8().constData(), error, assembleDialog.bFillWithNopsChecked))
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Error!"), tr("Failed to assemble instruction \" %1 \" (%2)").arg(expression).arg(error));
|
||||
msg.setWindowIcon(DIcon("compile-error"));
|
||||
|
@ -951,20 +952,20 @@ void CPUDisassembly::assembleSlot()
|
|||
while(assembly_error);
|
||||
|
||||
//select next instruction after assembling
|
||||
setSingleSelection(wRVA);
|
||||
setSingleSelection(rva);
|
||||
|
||||
dsint botRVA = getTableOffset();
|
||||
dsint topRVA = getInstructionRVA(getTableOffset(), getNbrOfLineToPrint() - 1);
|
||||
auto botRVA = getTableOffset();
|
||||
auto topRVA = getInstructionRVA(getTableOffset(), getNbrOfLineToPrint() - 1);
|
||||
|
||||
dsint wInstrSize = getInstructionRVA(wRVA, 1) - wRVA - 1;
|
||||
|
||||
expandSelectionUpTo(wRVA + wInstrSize);
|
||||
// TODO: this seems dumb
|
||||
auto instrSize = getInstructionRVA(rva, 1) - rva - 1;
|
||||
expandSelectionUpTo(rva + instrSize);
|
||||
selectNext(false);
|
||||
|
||||
if(getSelectionStart() < botRVA)
|
||||
setTableOffset(getSelectionStart());
|
||||
else if(getSelectionEnd() >= topRVA)
|
||||
setTableOffset(getInstructionRVA(getSelectionEnd(), -getNbrOfLineToPrint() + 2));
|
||||
setTableOffset(getInstructionRVA(getSelectionEnd(), -(dsint)getNbrOfLineToPrint() + 2));
|
||||
|
||||
//refresh view
|
||||
GuiUpdateAllViews();
|
||||
|
@ -1533,7 +1534,8 @@ void CPUDisassembly::pushSelectionInto(bool copyBytes, QTextStream & stream, QTe
|
|||
if(i)
|
||||
stream << "\r\n";
|
||||
duint cur_addr = rvaToVa(inst.rva);
|
||||
QString address = getAddrText(cur_addr, 0, addressLen > sizeof(duint) * 2 + 1);
|
||||
QString label;
|
||||
QString address = getAddrText(cur_addr, label, addressLen > sizeof(duint) * 2 + 1);
|
||||
QString bytes;
|
||||
QString bytesHtml;
|
||||
if(copyBytes)
|
||||
|
|
|
@ -13,7 +13,7 @@ class CPUDisassembly : public Disassembly
|
|||
Q_OBJECT
|
||||