Refactor AbstractTableView for cross-platform
This commit is contained in:
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
|
||||
|
||||
public:
|
||||
CPUDisassembly(QWidget* parent, bool isMain);
|
||||
CPUDisassembly(Architecture* architecture, bool isMain, QWidget* parent = nullptr);
|
||||
|
||||
// Mouse management
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
@ -22,8 +22,8 @@ public:
|
|||
|
||||
// Context menu management
|
||||
void setupRightClickContextMenu();
|
||||
void addFollowReferenceMenuItem(QString name, dsint value, QMenu* menu, bool isReferences, bool isFollowInCPU);
|
||||
void setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isReferences, bool isFollowInCPU);
|
||||
void addFollowReferenceMenuItem(QString name, duint value, QMenu* menu, bool isReferences, bool isFollowInCPU);
|
||||
void setupFollowReferenceMenu(duint va, QMenu* menu, bool isReferences, bool isFollowInCPU);
|
||||
void copySelectionSlot(bool copyBytes);
|
||||
void copySelectionToFileSlot(bool copyBytes);
|
||||
void setSideBar(CPUSideBar* sideBar);
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#include "MiscUtil.h"
|
||||
#include "BackgroundFlickerThread.h"
|
||||
|
||||
CPUDump::CPUDump(CPUDisassembly* disas, CPUMultiDump* multiDump, QWidget* parent) : HexDump(parent)
|
||||
CPUDump::CPUDump(CPUMultiDump* multiDump, CPUDisassembly* disassembly, QWidget* parent)
|
||||
: HexDump(multiDump->getArchitecture(), parent),
|
||||
mMultiDump(multiDump),
|
||||
mDisassembly(disassembly)
|
||||
{
|
||||
mDisas = disas;
|
||||
mMultiDump = multiDump;
|
||||
|
||||
duint setting;
|
||||
if(BridgeSettingGetUint("Gui", "AsciiSeparator", &setting))
|
||||
mAsciiSeparator = setting & 0xF;
|
||||
|
@ -27,7 +27,7 @@ CPUDump::CPUDump(CPUDisassembly* disas, CPUMultiDump* multiDump, QWidget* parent
|
|||
setView((ViewEnum_t)ConfigUint("HexDump", "DefaultView"));
|
||||
|
||||
connect(this, SIGNAL(selectionUpdated()), this, SLOT(selectionUpdatedSlot()));
|
||||
connect(this, SIGNAL(headerButtonReleased(int)), this, SLOT(headerButtonReleasedSlot(int)));
|
||||
connect(this, SIGNAL(headerButtonReleased(duint)), this, SLOT(headerButtonReleasedSlot(duint)));
|
||||
|
||||
mPluginMenu = multiDump->mDumpPluginMenu;
|
||||
|
||||
|
@ -263,7 +263,7 @@ void CPUDump::getAttention()
|
|||
thread->start();
|
||||
}
|
||||
|
||||
void CPUDump::getColumnRichText(int col, dsint rva, RichTextPainter::List & richText)
|
||||
void CPUDump::getColumnRichText(duint col, duint rva, RichTextPainter::List & richText)
|
||||
{
|
||||
if(col && !mDescriptor.at(col - 1).isData && mDescriptor.at(col - 1).itemCount) //print comments
|
||||
{
|
||||
|
@ -308,16 +308,17 @@ void CPUDump::getColumnRichText(int col, dsint rva, RichTextPainter::List & rich
|
|||
HexDump::getColumnRichText(col, rva, richText);
|
||||
}
|
||||
|
||||
QString CPUDump::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
QString CPUDump::paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h)
|
||||
{
|
||||
// Reset byte offset when base address is reached
|
||||
if(rowBase == 0 && mByteOffset != 0)
|
||||
// TODO: wtf?
|
||||
if(getTableOffset() == 0 && mByteOffset != 0)
|
||||
printDumpAt(mMemPage->getBase(), false, false);
|
||||
|
||||
if(!col) //address
|
||||
{
|
||||
char label[MAX_LABEL_SIZE] = "";
|
||||
dsint cur_addr = rvaToVa((rowBase + rowOffset) * getBytePerRowCount() - mByteOffset);
|
||||
dsint cur_addr = rvaToVa(row * getBytePerRowCount() - mByteOffset);
|
||||
QColor background;
|
||||
if(DbgGetLabelAt(cur_addr, SEG_DEFAULT, label)) //label
|
||||
{
|
||||
|
@ -334,7 +335,7 @@ QString CPUDump::paintContent(QPainter* painter, dsint rowBase, int rowOffset, i
|
|||
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(cur_addr));
|
||||
return QString();
|
||||
}
|
||||
return HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
return HexDump::paintContent(painter, row, col, x, y, w, h);
|
||||
}
|
||||
|
||||
void CPUDump::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
@ -1327,7 +1328,7 @@ void CPUDump::findReferencesSlot()
|
|||
{
|
||||
QString addrStart = ToPtrString(rvaToVa(getSelectionStart()));
|
||||
QString addrEnd = ToPtrString(rvaToVa(getSelectionEnd()));
|
||||
QString addrDisasm = ToPtrString(mDisas->rvaToVa(mDisas->getSelectionStart()));
|
||||
QString addrDisasm = ToPtrString(mDisassembly->rvaToVa(mDisassembly->getSelectionStart()));
|
||||
DbgCmdExec(QString("findrefrange " + addrStart + ", " + addrEnd + ", " + addrDisasm));
|
||||
emit displayReferencesWidget();
|
||||
}
|
||||
|
@ -1611,7 +1612,7 @@ void CPUDump::setView(ViewEnum_t view)
|
|||
}
|
||||
}
|
||||
|
||||
void CPUDump::headerButtonReleasedSlot(int colIndex)
|
||||
void CPUDump::headerButtonReleasedSlot(duint colIndex)
|
||||
{
|
||||
auto callback = mDescriptor[colIndex].columnSwitch;
|
||||
if(callback)
|
||||
|
|
|
@ -12,9 +12,9 @@ class CPUDump : public HexDump
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPUDump(CPUDisassembly* disas, CPUMultiDump* multiDump, QWidget* parent = 0);
|
||||
void getColumnRichText(int col, dsint rva, RichTextPainter::List & richText) override;
|
||||
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
explicit CPUDump(CPUMultiDump* multiDump, CPUDisassembly* disasassembly, QWidget* parent = nullptr);
|
||||
void getColumnRichText(duint col, duint rva, RichTextPainter::List & richText) override;
|
||||
QString paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h) override;
|
||||
void setupContextMenu();
|
||||
void getAttention();
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
|
@ -82,7 +82,7 @@ public slots:
|
|||
void syncWithExpressionSlot();
|
||||
void allocMemorySlot();
|
||||
|
||||
void headerButtonReleasedSlot(int colIndex);
|
||||
void headerButtonReleasedSlot(duint colIndex);
|
||||
|
||||
private:
|
||||
MenuBuilder* mMenuBuilder;
|
||||
|
@ -94,8 +94,8 @@ private:
|
|||
|
||||
GotoDialog* mGoto = nullptr;
|
||||
GotoDialog* mGotoOffset = nullptr;
|
||||
CPUDisassembly* mDisas;
|
||||
CPUMultiDump* mMultiDump;
|
||||
CPUDisassembly* mDisassembly = nullptr;
|
||||
CPUMultiDump* mMultiDump = nullptr;
|
||||
int mAsciiSeparator = 0;
|
||||
|
||||
enum ViewEnum_t
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#include "Bridge.h"
|
||||
#include "QZydis.h"
|
||||
|
||||
CPUInfoBox::CPUInfoBox(QWidget* parent) : StdTable(parent)
|
||||
CPUInfoBox::CPUInfoBox(Architecture* architecture, QWidget* parent)
|
||||
: StdTable(parent),
|
||||
mArchitecture(architecture)
|
||||
{
|
||||
setWindowTitle("InfoBox");
|
||||
enableMultiSelection(false);
|
||||
|
@ -32,7 +34,7 @@ CPUInfoBox::CPUInfoBox(QWidget* parent) : StdTable(parent)
|
|||
setSingleSelection(-1);
|
||||
|
||||
int maxModuleSize = (int)ConfigUint("Disassembler", "MaxModuleSize");
|
||||
mDisasm = new QZydis(maxModuleSize, Bridge::getArch());
|
||||
mDisasm = new QZydis(maxModuleSize, architecture);
|
||||
|
||||
setupContextMenu();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "StdTable.h"
|
||||
#include "Architecture.h"
|
||||
|
||||
class WordEditDialog;
|
||||
class XrefBrowseDialog;
|
||||
|
@ -10,7 +11,7 @@ class CPUInfoBox : public StdTable
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPUInfoBox(QWidget* parent = 0);
|
||||
CPUInfoBox(Architecture* architecture, QWidget* parent = nullptr);
|
||||
~CPUInfoBox();
|
||||
int getHeight();
|
||||
void addFollowMenuItem(QMenu* menu, QString name, duint value);
|
||||
|
@ -37,6 +38,7 @@ public slots:
|
|||
void addInfoLine(const QString & infoLine);
|
||||
|
||||
private:
|
||||
Architecture* mArchitecture = nullptr;
|
||||
duint mCurAddr = 0;
|
||||
duint mCurRva = 0;
|
||||
duint mCurOffset = 0;
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
#include <QMessageBox>
|
||||
#include <QTabBar>
|
||||
|
||||
CPUMultiDump::CPUMultiDump(CPUDisassembly* disas, int nbCpuDumpTabs, QWidget* parent)
|
||||
: MHTabWidget(parent, true)
|
||||
CPUMultiDump::CPUMultiDump(CPUDisassembly* disassembly, int nbCpuDumpTabs, QWidget* parent)
|
||||
: MHTabWidget(parent, true),
|
||||
mMainDisassembly(disassembly)
|
||||
{
|
||||
setWindowTitle("CPUMultiDump");
|
||||
mMaxCPUDumpTabs = nbCpuDumpTabs;
|
||||
|
@ -22,7 +23,7 @@ CPUMultiDump::CPUMultiDump(CPUDisassembly* disas, int nbCpuDumpTabs, QWidget* pa
|
|||
|
||||
for(uint i = 0; i < mMaxCPUDumpTabs; i++)
|
||||
{
|
||||
CPUDump* cpuDump = new CPUDump(disas, this);
|
||||
CPUDump* cpuDump = new CPUDump(this, mMainDisassembly);
|
||||
//cpuDump->loadColumnFromConfig(QString("CPUDump%1").arg(i + 1)); //TODO: needs a workaround because the columns change
|
||||
connect(cpuDump, SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidgetSlot()));
|
||||
connect(cpuDump, SIGNAL(showDisassemblyTab(duint, duint, duint)), this, SLOT(showDisassemblyTabSlot(duint, duint, duint)));
|
||||
|
@ -50,7 +51,7 @@ CPUMultiDump::CPUMultiDump(CPUDisassembly* disas, int nbCpuDumpTabs, QWidget* pa
|
|||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateCurrentTabSlot(int)));
|
||||
connect(tabBar(), SIGNAL(OnDoubleClickTabIndex(int)), this, SLOT(openChangeTabTitleDialogSlot(int)));
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(dumpAt(dsint)), this, SLOT(printDumpAtSlot(dsint)));
|
||||
connect(Bridge::getBridge(), SIGNAL(dumpAt(duint)), this, SLOT(printDumpAtSlot(duint)));
|
||||
connect(Bridge::getBridge(), SIGNAL(dumpAtN(duint, int)), this, SLOT(printDumpAtNSlot(duint, int)));
|
||||
connect(Bridge::getBridge(), SIGNAL(selectionDumpGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
|
||||
connect(Bridge::getBridge(), SIGNAL(selectionDumpSet(const SELECTIONDATA*)), this, SLOT(selectionSetSlot(const SELECTIONDATA*)));
|
||||
|
@ -61,6 +62,11 @@ CPUMultiDump::CPUMultiDump(CPUDisassembly* disas, int nbCpuDumpTabs, QWidget* pa
|
|||
connect(mCurrentCPUDump, SIGNAL(selectionUpdated()), mCurrentCPUDump, SLOT(selectionUpdatedSlot()));
|
||||
}
|
||||
|
||||
Architecture* CPUMultiDump::getArchitecture() const
|
||||
{
|
||||
return mMainDisassembly->getArchitecture();
|
||||
}
|
||||
|
||||
CPUDump* CPUMultiDump::getCurrentCPUDump()
|
||||
{
|
||||
return mCurrentCPUDump;
|
||||
|
@ -152,7 +158,7 @@ void CPUMultiDump::updateCurrentTabSlot(int tabIndex)
|
|||
mCurrentCPUDump = t;
|
||||
}
|
||||
|
||||
void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
||||
void CPUMultiDump::printDumpAtSlot(duint va)
|
||||
{
|
||||
if(mInitAllDumpTabs)
|
||||
{
|
||||
|
@ -165,8 +171,8 @@ void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
|||
if(cpuDump)
|
||||
{
|
||||
cpuDump->mHistory.historyClear();
|
||||
cpuDump->mHistory.addVaToHistory(parVa);
|
||||
cpuDump->printDumpAt(parVa);
|
||||
cpuDump->mHistory.addVaToHistory(va);
|
||||
cpuDump->printDumpAt(va);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,12 +181,12 @@ void CPUMultiDump::printDumpAtSlot(dsint parVa)
|
|||
else
|
||||
{
|
||||
SwitchToDumpWindow();
|
||||
mCurrentCPUDump->printDumpAt(parVa);
|
||||
mCurrentCPUDump->mHistory.addVaToHistory(parVa);
|
||||
mCurrentCPUDump->printDumpAt(va);
|
||||
mCurrentCPUDump->mHistory.addVaToHistory(va);
|
||||
}
|
||||
}
|
||||
|
||||
void CPUMultiDump::printDumpAtNSlot(duint parVa, int index)
|
||||
void CPUMultiDump::printDumpAtNSlot(duint va, int index)
|
||||
{
|
||||
int tabindex = GetDumpWindowIndex(index);
|
||||
if(tabindex == 2147483647)
|
||||
|
@ -189,8 +195,8 @@ void CPUMultiDump::printDumpAtNSlot(duint parVa, int index)
|
|||
if(!current)
|
||||
return;
|
||||
setCurrentIndex(tabindex);
|
||||
current->printDumpAt(parVa);
|
||||
current->mHistory.addVaToHistory(parVa);
|
||||
current->printDumpAt(va);
|
||||
current->mHistory.addVaToHistory(va);
|
||||
}
|
||||
|
||||
void CPUMultiDump::selectionGetSlot(SELECTIONDATA* selectionData)
|
||||
|
@ -238,23 +244,23 @@ void CPUMultiDump::focusCurrentDumpSlot()
|
|||
void CPUMultiDump::showDisassemblyTabSlot(duint selectionStart, duint selectionEnd, duint firstAddress)
|
||||
{
|
||||
Q_UNUSED(firstAddress); // TODO: implement setTableOffset(firstAddress)
|
||||
if(!mDisassembly)
|
||||
if(!mExtraDisassembly)
|
||||
{
|
||||
mDisassembly = new CPUDisassembly(this, false);
|
||||
this->addTabEx(mDisassembly, DIcon(ArchValue("processor32", "processor64")), tr("Disassembly"), "DumpDisassembly");
|
||||
mExtraDisassembly = new CPUDisassembly(mMainDisassembly->getArchitecture(), false, this);
|
||||
this->addTabEx(mExtraDisassembly, DIcon(ArchValue("processor32", "processor64")), tr("Disassembly"), "DumpDisassembly");
|
||||
}
|
||||
// Set CIP
|
||||
auto clearHistory = mDisassembly->getBase() == 0;
|
||||
mDisassembly->disassembleAtSlot(selectionStart, Bridge::getBridge()->mLastCip);
|
||||
auto clearHistory = mExtraDisassembly->getBase() == 0;
|
||||
mExtraDisassembly->disassembleAtSlot(selectionStart, Bridge::getBridge()->mLastCip);
|
||||
if(clearHistory)
|
||||
mDisassembly->historyClear();
|
||||
mExtraDisassembly->historyClear();
|
||||
// Make the address visisble in memory
|
||||
mDisassembly->disassembleAt(selectionStart, true, -1);
|
||||
mExtraDisassembly->disassembleAt(selectionStart, true, -1);
|
||||
// Set selection to match the dump
|
||||
mDisassembly->setSingleSelection(selectionStart - mDisassembly->getBase());
|
||||
mDisassembly->expandSelectionUpTo(selectionEnd - mDisassembly->getBase());
|
||||
mExtraDisassembly->setSingleSelection(selectionStart - mExtraDisassembly->getBase());
|
||||
mExtraDisassembly->expandSelectionUpTo(selectionEnd - mExtraDisassembly->getBase());
|
||||
// Show the tab
|
||||
setCurrentWidget(mDisassembly);
|
||||
setCurrentWidget(mExtraDisassembly);
|
||||
}
|
||||
|
||||
void CPUMultiDump::getDumpAttention()
|
||||
|
|
|
@ -14,11 +14,12 @@ class CPUMultiDump : public MHTabWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPUMultiDump(CPUDisassembly* disas, int nbCpuDumpTabs = 1, QWidget* parent = 0);
|
||||
explicit CPUMultiDump(CPUDisassembly* disassembly, int nbCpuDumpTabs = 1, QWidget* parent = nullptr);
|
||||
Architecture* getArchitecture() const;
|
||||
CPUDump* getCurrentCPUDump();
|
||||
void getTabNames(QList<QString> & names);
|
||||
int getMaxCPUTabs();
|
||||
QMenu* mDumpPluginMenu;
|
||||
QMenu* mDumpPluginMenu; // TODO: no
|
||||
void saveWindowSettings();
|
||||
void loadWindowSettings();
|
||||
|
||||
|
@ -27,8 +28,8 @@ signals:
|
|||
|
||||
public slots:
|
||||
void updateCurrentTabSlot(int tabIndex);
|
||||
void printDumpAtSlot(dsint parVa);
|
||||
void printDumpAtNSlot(duint parVa, int index);
|
||||
void printDumpAtSlot(duint va);
|
||||
void printDumpAtNSlot(duint va, int index);
|
||||
void selectionGetSlot(SELECTIONDATA* selectionData);
|
||||
void selectionSetSlot(const SELECTIONDATA* selectionData);
|
||||
void dbgStateChangedSlot(DBGSTATE dbgState);
|
||||
|
@ -46,7 +47,8 @@ private:
|
|||
WatchView* mWatch;
|
||||
LocalVarsView* mLocalVars;
|
||||
StructWidget* mStructWidget;
|
||||
CPUDisassembly* mDisassembly = nullptr;
|
||||
CPUDisassembly* mMainDisassembly = nullptr;
|
||||
CPUDisassembly* mExtraDisassembly = nullptr;
|
||||
|
||||
int GetDumpWindowIndex(int dump);
|
||||
int GetWatchWindowIndex();
|
||||
|
|
|
@ -37,7 +37,7 @@ CPURegistersView::CPURegistersView(CPUWidget* parent) : RegistersView(parent), m
|
|||
connect(Bridge::getBridge(), SIGNAL(updateRegisters()), this, SLOT(updateRegistersSlot()));
|
||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayCustomContextMenuSlot(QPoint)));
|
||||
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(debugStateChangedSlot(DBGSTATE)));
|
||||
connect(parent->getDisasmWidget(), SIGNAL(selectionChanged(dsint)), this, SLOT(disasmSelectionChangedSlot(dsint)));
|
||||
connect(parent->getDisasmWidget(), SIGNAL(selectionChanged(duint)), this, SLOT(disasmSelectionChangedSlot(duint)));
|
||||
// context menu actions
|
||||
connect(wCM_Incrementx87Stack, SIGNAL(triggered()), this, SLOT(onIncrementx87StackAction()));
|
||||
connect(wCM_Decrementx87Stack, SIGNAL(triggered()), this, SLOT(onDecrementx87StackAction()));
|
||||
|
|
|
@ -215,7 +215,7 @@ void CPUSideBar::paintEvent(QPaintEvent* event)
|
|||
std::vector<JumpLine> jumpLines;
|
||||
std::vector<LabelArrow> labelArrows;
|
||||
|
||||
for(int line = 0; line < mViewableRows; line++)
|
||||
for(duint line = 0; line < mViewableRows; line++)
|
||||
{
|
||||
if(line >= mInstrBuffer->size()) //at the end of the page it will crash otherwise
|
||||
break;
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "CPUMultiDump.h"
|
||||
#include "GotoDialog.h"
|
||||
|
||||
CPUStack::CPUStack(CPUMultiDump* multiDump, QWidget* parent) : HexDump(parent)
|
||||
CPUStack::CPUStack(CPUMultiDump* multiDump, QWidget* parent)
|
||||
: HexDump(multiDump->getArchitecture(), parent)
|
||||
{
|
||||
setWindowTitle("Stack");
|
||||
setShowHeader(false);
|
||||
|
@ -309,7 +310,7 @@ void CPUStack::updateFreezeStackAction()
|
|||
mFreezeStack->setChecked(bStackFrozen);
|
||||
}
|
||||
|
||||
void CPUStack::getColumnRichText(int col, dsint rva, RichTextPainter::List & richText)
|
||||
void CPUStack::getColumnRichText(duint col, duint rva, RichTextPainter::List & richText)
|
||||
{
|
||||
// Compute VA
|
||||
duint va = rvaToVa(rva);
|
||||
|
@ -365,24 +366,24 @@ void CPUStack::getColumnRichText(int col, dsint rva, RichTextPainter::List & ric
|
|||
HexDump::getColumnRichText(col, rva, richText);
|
||||
}
|
||||
|
||||
QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
QString CPUStack::paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h)
|
||||
{
|
||||
// Compute RVA
|
||||
int wBytePerRowCount = getBytePerRowCount();
|
||||
dsint wRva = (rowBase + rowOffset) * wBytePerRowCount - mByteOffset;
|
||||
duint wVa = rvaToVa(wRva);
|
||||
auto bytePerRowCount = getBytePerRowCount();
|
||||
dsint rva = row * bytePerRowCount - mByteOffset;
|
||||
duint va = rvaToVa(rva);
|
||||
|
||||
bool wIsSelected = isSelected(wRva);
|
||||
if(wIsSelected) //highlight if selected
|
||||
bool rowSelected = isSelected(rva);
|
||||
if(rowSelected) //highlight if selected
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(mSelectionColor));
|
||||
|
||||
if(col == 0) // paint stack address
|
||||
{
|
||||
QColor background;
|
||||
char labelText[MAX_LABEL_SIZE] = "";
|
||||
if(DbgGetLabelAt(wVa, SEG_DEFAULT, labelText)) //label
|
||||
if(DbgGetLabelAt(va, SEG_DEFAULT, labelText)) //label
|
||||
{
|
||||
if(wVa == mCsp) //CSP
|
||||
if(va == mCsp) //CSP
|
||||
{
|
||||
background = ConfigColor("StackCspBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackCspColor")));
|
||||
|
@ -395,12 +396,12 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
|
|||
}
|
||||
else //no label
|
||||
{
|
||||
if(wVa == mCsp) //CSP
|
||||
if(va == mCsp) //CSP
|
||||
{
|
||||
background = ConfigColor("StackCspBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackCspColor")));
|
||||
}
|
||||
else if(wIsSelected) //selected normal address
|
||||
else if(rowSelected) //selected normal address
|
||||
{
|
||||
background = ConfigColor("StackSelectedAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackSelectedAddressColor"))); //black address (DisassemblySelectedAddressColor)
|
||||
|
@ -413,7 +414,7 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
|
|||
}
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background when defined
|
||||
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(wVa));
|
||||
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, makeAddrText(va));
|
||||
return QString();
|
||||
}
|
||||
else if(col == 1) // paint stack data
|
||||
|
@ -422,14 +423,14 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
|
|||
{
|
||||
int stackFrameBitfield = 0; // 0:none, 1:top of stack frame, 2:bottom of stack frame, 4:middle of stack frame
|
||||
int party = 0;
|
||||
if(wVa >= mCallstack[0].addr)
|
||||
if(va >= mCallstack[0].addr)
|
||||
{
|
||||
for(size_t i = 0; i < mCallstack.size() - 1; i++)
|
||||
{
|
||||
if(wVa >= mCallstack[i].addr && wVa < mCallstack[i + 1].addr)
|
||||
if(va >= mCallstack[i].addr && va < mCallstack[i + 1].addr)
|
||||
{
|
||||
stackFrameBitfield |= (mCallstack[i].addr == wVa) ? 1 : 0;
|
||||
stackFrameBitfield |= (mCallstack[i + 1].addr == wVa + sizeof(duint)) ? 2 : 0;
|
||||
stackFrameBitfield |= (mCallstack[i].addr == va) ? 1 : 0;
|
||||
stackFrameBitfield |= (mCallstack[i + 1].addr == va + sizeof(duint)) ? 2 : 0;
|
||||
if(stackFrameBitfield == 0)
|
||||
stackFrameBitfield = 4;
|
||||
party = mCallstack[i].party;
|
||||
|
@ -438,14 +439,14 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
|
|||
}
|
||||
// draw stack frame
|
||||
if(stackFrameBitfield == 0)
|
||||
return HexDump::paintContent(painter, rowBase, rowOffset, 1, x, y, w, h);
|
||||
return HexDump::paintContent(painter, row, 1, x, y, w, h);
|
||||
else
|
||||
{
|
||||
int height = getRowHeight();
|
||||
int halfHeight = height / 2;
|
||||
int width = 5;
|
||||
int offset = 2;
|
||||
auto result = HexDump::paintContent(painter, rowBase, rowOffset, 1, x + (width - 2), y, w - (width - 2), h);
|
||||
auto result = HexDump::paintContent(painter, row, 1, x + (width - 2), y, w - (width - 2), h);
|
||||
if(party == mod_user)
|
||||
painter->setPen(QPen(mUserStackFrameColor, 2));
|
||||
else
|
||||
|
@ -468,13 +469,13 @@ QString CPUStack::paintContent(QPainter* painter, dsint rowBase, int rowOffset,
|
|||
}
|
||||
}
|
||||
else
|
||||
return HexDump::paintContent(painter, rowBase, rowOffset, 1, x, y, w, h);
|
||||
return HexDump::paintContent(painter, row, 1, x, y, w, h);
|
||||
}
|
||||
else
|
||||
return HexDump::paintContent(painter, rowBase, rowOffset, 1, x, y, w, h);
|
||||
return HexDump::paintContent(painter, row, 1, x, y, w, h);
|
||||
}
|
||||
else
|
||||
return HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
return HexDump::paintContent(painter, row, col, x, y, w, h);
|
||||
}
|
||||
|
||||
void CPUStack::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
@ -602,7 +603,7 @@ void CPUStack::updateSlot()
|
|||
}
|
||||
}
|
||||
|
||||
void CPUStack::disasmSelectionChanged(dsint parVA)
|
||||
void CPUStack::disasmSelectionChanged(duint parVA)
|
||||
{
|
||||
// When the selected instruction is changed, select the argument that is in the stack.
|
||||
DISASM_INSTR instr;
|
||||
|
|
|
@ -11,16 +11,16 @@ class CPUStack : public HexDump
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPUStack(CPUMultiDump* multiDump, QWidget* parent = 0);
|
||||
explicit CPUStack(CPUMultiDump* multiDump, QWidget* parent = nullptr);
|
||||
|
||||
// Configuration
|
||||
virtual void updateColors();
|
||||
virtual void updateFonts();
|
||||
void updateColors() override;
|
||||
void updateFonts() override;
|
||||
|
||||
void getColumnRichText(int col, dsint rva, RichTextPainter::List & richText) override;
|
||||
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
void getColumnRichText(duint col, duint rva, RichTextPainter::List & richText) override;
|
||||
QString paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void setupContextMenu();
|
||||
void updateFreezeStackAction();
|
||||
|
@ -52,7 +52,7 @@ public slots:
|
|||
void realignSlot();
|
||||
void freezeStackSlot();
|
||||
void dbgStateChangedSlot(DBGSTATE state);
|
||||
void disasmSelectionChanged(dsint parVA);
|
||||
void disasmSelectionChanged(duint parVA);
|
||||
void updateSlot();
|
||||
void copyPtrColumnSlot();
|
||||
void copyCommentsColumnSlot();
|
||||
|
@ -82,5 +82,5 @@ private:
|
|||
CommonActions* mCommonActions;
|
||||
|
||||
std::vector<CPUCallStack> mCallstack;
|
||||
static int CPUStack::getCurrentFrame(const std::vector<CPUStack::CPUCallStack> & mCallstack, duint wVA);
|
||||
static int CPUStack::getCurrentFrame(const std::vector<CPUStack::CPUCallStack> & mCallstack, duint va);
|
||||
};
|
||||
|
|
|
@ -14,22 +14,25 @@
|
|||
#include "Configuration.h"
|
||||
#include "TabWidget.h"
|
||||
|
||||
CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
||||
CPUWidget::CPUWidget(Architecture* architecture, QWidget* parent)
|
||||
: QWidget(parent),
|
||||
ui(new Ui::CPUWidget),
|
||||
mArchitecture(architecture)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setDefaultDisposition();
|
||||
|
||||
setStyleSheet("AbstractTableView:focus, CPURegistersView:focus, CPUSideBar:focus { border: 1px solid #000000; }");
|
||||
|
||||
mDisas = new CPUDisassembly(this, true);
|
||||
mSideBar = new CPUSideBar(mDisas);
|
||||
mDisas->setSideBar(mSideBar);
|
||||
mArgumentWidget = new CPUArgumentWidget(this);
|
||||
mGraph = new DisassemblerGraphView(this);
|
||||
mDisassembly = new CPUDisassembly(architecture, true, this);
|
||||
mSideBar = new CPUSideBar(mDisassembly);
|
||||
mDisassembly->setSideBar(mSideBar);
|
||||
mArgumentWidget = new CPUArgumentWidget(architecture, this);
|
||||
mGraph = new DisassemblerGraphView(architecture, this);
|
||||
|
||||
connect(mDisas, SIGNAL(tableOffsetChanged(dsint)), mSideBar, SLOT(changeTopmostAddress(dsint)));
|
||||
connect(mDisas, SIGNAL(viewableRowsChanged(int)), mSideBar, SLOT(setViewableRows(int)));
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mSideBar, SLOT(setSelection(dsint)));
|
||||
connect(mDisassembly, SIGNAL(tableOffsetChanged(duint)), mSideBar, SLOT(changeTopmostAddress(duint)));
|
||||
connect(mDisassembly, SIGNAL(viewableRowsChanged(duint)), mSideBar, SLOT(setViewableRows(duint)));
|
||||
connect(mDisassembly, SIGNAL(selectionChanged(duint)), mSideBar, SLOT(setSelection(duint)));
|
||||
connect(mGraph, SIGNAL(detachGraph()), this, SLOT(detachGraph()));
|
||||
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), mSideBar, SLOT(debugStateChangedSlot(DBGSTATE)));
|
||||
connect(Bridge::getBridge(), SIGNAL(updateSideBar()), mSideBar, SLOT(reload()));
|
||||
|
@ -37,12 +40,12 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
connect(Bridge::getBridge(), SIGNAL(focusDisasm()), this, SLOT(setDisasmFocus()));
|
||||
connect(Bridge::getBridge(), SIGNAL(focusGraph()), this, SLOT(setGraphFocus()));
|
||||
|
||||
mDisas->setCodeFoldingManager(mSideBar->getCodeFoldingManager());
|
||||
mDisassembly->setCodeFoldingManager(mSideBar->getCodeFoldingManager());
|
||||
|
||||
ui->mTopLeftUpperHSplitter->setCollapsible(0, true); //allow collapsing of the side bar
|
||||
|
||||
ui->mTopLeftUpperLeftFrameLayout->addWidget(mSideBar);
|
||||
ui->mTopLeftUpperRightFrameLayout->addWidget(mDisas);
|
||||
ui->mTopLeftUpperRightFrameLayout->addWidget(mDisassembly);
|
||||
ui->mTopLeftUpperRightFrameLayout->addWidget(mGraph);
|
||||
mGraph->hide();
|
||||
disasMode = 0;
|
||||
|
@ -51,14 +54,14 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
ui->mTopLeftVSplitter->setCollapsible(1, true); //allow collapsing of the InfoBox
|
||||
connect(ui->mTopLeftVSplitter, SIGNAL(splitterMoved(int, int)), this, SLOT(splitterMoved(int, int)));
|
||||
|
||||
mInfo = new CPUInfoBox();
|
||||
mInfo = new CPUInfoBox(architecture);
|
||||
ui->mTopLeftLowerFrameLayout->addWidget(mInfo);
|
||||
int height = mInfo->getHeight();
|
||||
ui->mTopLeftLowerFrame->setMinimumHeight(height + 2);
|
||||
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(mDisassembly, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
|
||||
mDump = new CPUMultiDump(mDisas, 5, this); //dump widget
|
||||
mDump = new CPUMultiDump(mDisassembly, 5, this); //dump widget
|
||||
ui->mBotLeftFrameLayout->addWidget(mDump);
|
||||
|
||||
mGeneralRegs = new CPURegistersView(this);
|
||||
|
@ -85,9 +88,9 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
|
||||
mStack = new CPUStack(mDump, 0); //stack widget
|
||||
ui->mBotRightFrameLayout->addWidget(mStack);
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mStack, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(mDisassembly, SIGNAL(selectionChanged(duint)), mStack, SLOT(disasmSelectionChanged(duint)));
|
||||
|
||||
mDisas->setAccessibleName(tr("Disassembly"));
|
||||
mDisassembly->setAccessibleName(tr("Disassembly"));
|
||||
mStack->setAccessibleName(tr("Stack"));
|
||||
upperScrollArea->setAccessibleName(tr("Registers"));
|
||||
mDump->setAccessibleName(tr("Dump"));
|
||||
|
@ -96,7 +99,7 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
|
|||
mInfo->setAccessibleName(tr("InfoBox"));
|
||||
|
||||
// load column config
|
||||
mDisas->loadColumnFromConfig("CPUDisassembly");
|
||||
mDisassembly->loadColumnFromConfig("CPUDisassembly");
|
||||
mStack->loadColumnFromConfig("CPUStack");
|
||||
}
|
||||
|
||||
|
@ -146,6 +149,11 @@ CPUWidget::~CPUWidget()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
Architecture* CPUWidget::getArchitecture() const
|
||||
{
|
||||
return mArchitecture;
|
||||
}
|
||||
|
||||
void CPUWidget::setDefaultDisposition()
|
||||
{
|
||||
// This is magic, don't touch it...
|
||||
|
@ -180,18 +188,18 @@ void CPUWidget::setDisasmFocus()
|
|||
if(disasMode == 1)
|
||||
{
|
||||
mGraph->hide();
|
||||
mDisas->show();
|
||||
mDisassembly->show();
|
||||
mSideBar->show();
|
||||
ui->mTopLeftUpperHSplitter->restoreState(mDisasmSidebarSplitterStatus);
|
||||
disasMode = 0;
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
disconnect(mGraph, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(mDisassembly, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
disconnect(mGraph, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
}
|
||||
else if(disasMode == 2)
|
||||
{
|
||||
activateWindow();
|
||||
}
|
||||
mDisas->setFocus();
|
||||
mDisassembly->setFocus();
|
||||
}
|
||||
|
||||
void CPUWidget::setGraphFocus()
|
||||
|
@ -199,14 +207,14 @@ void CPUWidget::setGraphFocus()
|
|||
if(disasMode == 0)
|
||||
{
|
||||
mDisasmSidebarSplitterStatus = ui->mTopLeftUpperHSplitter->saveState();
|
||||
mDisas->hide();
|
||||
mDisassembly->hide();
|
||||
mSideBar->hide();
|
||||
mGraph->show();
|
||||
// Hide the sidebar area
|
||||
ui->mTopLeftUpperHSplitter->setSizes(QList<int>({0, 100}));
|
||||
disasMode = 1;
|
||||
disconnect(mDisas, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(mGraph, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
disconnect(mDisassembly, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
connect(mGraph, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
}
|
||||
else if(disasMode == 2)
|
||||
{
|
||||
|
@ -250,12 +258,12 @@ void CPUWidget::detachGraph()
|
|||
|
||||
disasMode = 2;
|
||||
|
||||
mDisas->show();
|
||||
mDisassembly->show();
|
||||
mSideBar->show();
|
||||
// restore the sidebar splitter so that the sidebar is visible
|
||||
ui->mTopLeftUpperHSplitter->restoreState(mDisasmSidebarSplitterStatus);
|
||||
connect(mDisas, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(mGraph, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
connect(mDisassembly, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
connect(mGraph, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +274,7 @@ void CPUWidget::attachGraph(QWidget* widget)
|
|||
ui->mTopLeftUpperRightFrameLayout->addWidget(mGraph);
|
||||
mGraph->hide();
|
||||
mGraphWindow->close();
|
||||
disconnect(mGraph, SIGNAL(selectionChanged(dsint)), mInfo, SLOT(disasmSelectionChanged(dsint)));
|
||||
disconnect(mGraph, SIGNAL(selectionChanged(duint)), mInfo, SLOT(disasmSelectionChanged(duint)));
|
||||
delete mGraphWindow;
|
||||
mGraphWindow = nullptr;
|
||||
disasMode = 0;
|
||||
|
@ -276,9 +284,9 @@ void CPUWidget::attachGraph(QWidget* widget)
|
|||
duint CPUWidget::getSelectionVa()
|
||||
{
|
||||
if(disasMode < 2)
|
||||
return disasMode == 0 ? mDisas->getSelectedVa() : mGraph->get_cursor_pos();
|
||||
return disasMode == 0 ? mDisassembly->getSelectedVa() : mGraph->get_cursor_pos();
|
||||
else
|
||||
return !mGraph->hasFocus() ? mDisas->getSelectedVa() : mGraph->get_cursor_pos();
|
||||
return !mGraph->hasFocus() ? mDisassembly->getSelectedVa() : mGraph->get_cursor_pos();
|
||||
}
|
||||
|
||||
CPUSideBar* CPUWidget::getSidebarWidget()
|
||||
|
@ -288,7 +296,7 @@ CPUSideBar* CPUWidget::getSidebarWidget()
|
|||
|
||||
CPUDisassembly* CPUWidget::getDisasmWidget()
|
||||
{
|
||||
return mDisas;
|
||||
return mDisassembly;
|
||||
}
|
||||
|
||||
DisassemblerGraphView* CPUWidget::getGraphWidget()
|
||||
|
|
|
@ -24,8 +24,9 @@ class CPUWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CPUWidget(QWidget* parent = 0);
|
||||
explicit CPUWidget(Architecture* architecture, QWidget* parent = nullptr);
|
||||
~CPUWidget();
|
||||
Architecture* getArchitecture() const;
|
||||
|
||||
// Misc
|
||||
void setDefaultDisposition();
|
||||
|
@ -49,7 +50,7 @@ public slots:
|
|||
|
||||
protected:
|
||||
CPUSideBar* mSideBar;
|
||||
CPUDisassembly* mDisas;
|
||||
CPUDisassembly* mDisassembly;
|
||||
DisassemblerGraphView* mGraph;
|
||||
MHDetachedWindow* mGraphWindow;
|
||||
CPUMultiDump* mDump;
|
||||
|
@ -61,6 +62,7 @@ protected:
|
|||
int disasMode;
|
||||
|
||||
private:
|
||||
Architecture* mArchitecture = nullptr;
|
||||
Ui::CPUWidget* ui;
|
||||
QByteArray mDisasmSidebarSplitterStatus;
|
||||
|
||||
|
|
|
@ -73,16 +73,16 @@ void CallStackView::setupContextMenu()
|
|||
mMenuBuilder->loadFromConfig();
|
||||
}
|
||||
|
||||
QString CallStackView::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
QString CallStackView::paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h)
|
||||
{
|
||||
if(isSelected(rowBase, rowOffset))
|
||||
if(isSelected(row))
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(mSelectionColor));
|
||||
|
||||
bool isSpaceRow = !getCellContent(rowBase + rowOffset, ColThread).isEmpty();
|
||||
bool isSpaceRow = !getCellContent(row, ColThread).isEmpty();
|
||||
|
||||
if(col == ColThread && !(rowBase + rowOffset))
|
||||
if(col == ColThread && row == 0)
|
||||
{
|
||||
QString ret = getCellContent(rowBase + rowOffset, col);
|
||||
QString ret = getCellContent(row, col);
|
||||
if(!ret.isEmpty())
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("ThreadCurrentBackgroundColor")));
|
||||
|
@ -98,8 +98,8 @@ QString CallStackView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
|||
}
|
||||
else if(col == ColFrom || col == ColTo || col == ColAddress)
|
||||
{
|
||||
QString ret = getCellContent(rowBase + rowOffset, col);
|
||||
BPXTYPE bpxtype = DbgGetBpxTypeAt(getCellUserdata(rowBase + rowOffset, col));
|
||||
QString ret = getCellContent(row, col);
|
||||
BPXTYPE bpxtype = DbgGetBpxTypeAt(getCellUserdata(row, col));
|
||||
if(bpxtype & bp_normal)
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyBreakpointBackgroundColor")));
|
||||
|
@ -115,7 +115,7 @@ QString CallStackView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
|||
return "";
|
||||
}
|
||||
}
|
||||
return StdIconTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
return StdIconTable::paintContent(painter, row, col, x, y, w, h);
|
||||
}
|
||||
|
||||
void CallStackView::updateCallStack()
|
||||
|
|
|
@ -10,7 +10,7 @@ ColumnReorderDialog::ColumnReorderDialog(AbstractTableView* parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
for(int j = 0; j < parent->getColumnCount(); j++)
|
||||
for(duint j = 0; j < parent->getColumnCount(); j++)
|
||||
{
|
||||
int i = parent->mColumnOrder[j];
|
||||
if(parent->getColumnHidden(i))
|
||||
|
|
|
@ -17,18 +17,12 @@
|
|||
#include "MiscUtil.h"
|
||||
#include <QMainWindow>
|
||||
|
||||
DisassemblerGraphView::DisassemblerGraphView(QWidget* parent)
|
||||
DisassemblerGraphView::DisassemblerGraphView(Architecture* architecture, QWidget* parent)
|
||||
: QAbstractScrollArea(parent),
|
||||
mFontMetrics(nullptr),
|
||||
currentGraph(duint(0)),
|
||||
disasm(ConfigUint("Disassembler", "MaxModuleSize"), Bridge::getArch()),
|
||||
mCip(0),
|
||||
mGoto(nullptr),
|
||||
syncOrigin(false),
|
||||
forceCenter(false),
|
||||
layoutType(LayoutType::Medium),
|
||||
mHistoryLock(false),
|
||||
mXrefDlg(nullptr)
|
||||
mArchitecture(architecture),
|
||||
currentGraph(0),
|
||||
disasm(ConfigUint("Disassembler", "MaxModuleSize"), architecture),
|
||||
layoutType(LayoutType::Medium)
|
||||
{
|
||||
this->status = "Loading...";
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ public:
|
|||
bool inBlock = false;
|
||||
};
|
||||
|
||||
DisassemblerGraphView(QWidget* parent = nullptr);
|
||||
DisassemblerGraphView(Architecture* architecture, QWidget* parent = nullptr);
|
||||
~DisassemblerGraphView();
|
||||
void resetGraph();
|
||||
void initFont();
|
||||
|
@ -294,6 +294,7 @@ public slots:
|
|||
void enableHighlightingModeSlot();
|
||||
|
||||
private:
|
||||
Architecture* mArchitecture = nullptr;
|
||||
bool graphZoomMode;
|
||||
qreal zoomLevel;
|
||||
qreal zoomLevelOld;
|
||||
|
@ -329,23 +330,23 @@ private:
|
|||
std::unordered_map<duint, DisassemblerBlock> blocks;
|
||||
std::vector<int> col_edge_x;
|
||||
std::vector<int> row_edge_y;
|
||||
CachedFontMetrics* mFontMetrics;
|
||||
MenuBuilder* mMenuBuilder;
|
||||
CommonActions* mCommonActions;
|
||||
QMenu* mPluginMenu;
|
||||
CachedFontMetrics* mFontMetrics = nullptr;
|
||||
MenuBuilder* mMenuBuilder = nullptr;
|
||||
CommonActions* mCommonActions = nullptr;
|
||||
QMenu* mPluginMenu = nullptr;
|
||||
bool drawOverview;
|
||||
bool onlySummary;
|
||||
bool syncOrigin;
|
||||
bool syncOrigin = false;
|
||||
int overviewXOfs;
|
||||
int overviewYOfs;
|
||||
qreal overviewScale;
|
||||
duint mCip;
|
||||
bool forceCenter;
|
||||
duint mCip = 0;
|
||||
bool forceCenter = false;
|
||||
bool saveGraph;
|
||||
bool mHistoryLock; //Don't add a history while going to previous/next
|
||||
bool mHistoryLock = false; //Don't add a history while going to previous/next
|
||||
LayoutType layoutType;
|
||||
|
||||
MenuBuilder* mHighlightMenuBuilder;
|
||||
MenuBuilder* mHighlightMenuBuilder = nullptr;
|
||||
ZydisTokenizer::SingleToken mHighlightToken;
|
||||
bool mHighlightingModeEnabled;
|
||||
bool mPermanentHighlightingMode;
|
||||
|
@ -387,8 +388,8 @@ private:
|
|||
BridgeCFGraph currentGraph;
|
||||
std::unordered_map<duint, duint> currentBlockMap;
|
||||
QZydis disasm;
|
||||
GotoDialog* mGoto;
|
||||
XrefBrowseDialog* mXrefDlg;
|
||||
GotoDialog* mGoto = nullptr;
|
||||
XrefBrowseDialog* mXrefDlg = nullptr;
|
||||
|
||||
void addReferenceAction(QMenu* menu, duint addr, const QString & description);
|
||||
bool getHighlightedTokenValueText(QString & text);
|
||||
|
|
|
@ -284,7 +284,7 @@ void HandlesView::enableAllPrivilegesSlot()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
for(int i = 0; i < mPrivilegesTable->getRowCount(); i++)
|
||||
for(duint i = 0; i < mPrivilegesTable->getRowCount(); i++)
|
||||
if(mPrivilegesTable->getCellContent(i, 1) != tr("Unknown"))
|
||||
DbgCmdExecDirect(QString("EnablePrivilege \"%1\"").arg(mPrivilegesTable->getCellContent(i, 0)));
|
||||
enumPrivileges();
|
||||
|
@ -294,7 +294,7 @@ void HandlesView::disableAllPrivilegesSlot()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
for(int i = 0; i < mPrivilegesTable->getRowCount(); i++)
|
||||
for(duint i = 0; i < mPrivilegesTable->getRowCount(); i++)
|
||||
if(mPrivilegesTable->getCellContent(i, 1) != tr("Unknown"))
|
||||
DbgCmdExecDirect(QString("DisablePrivilege \"%1\"").arg(mPrivilegesTable->getCellContent(i, 0)));
|
||||
enumPrivileges();
|
||||
|
|
|
@ -195,7 +195,7 @@ MainWindow::MainWindow(QWidget* parent)
|
|||
mScriptView->hide();
|
||||
|
||||
// CPU view
|
||||
mCpuWidget = new CPUWidget();
|
||||
mCpuWidget = new CPUWidget(Bridge::getArchitecture());
|
||||
mCpuWidget->setWindowTitle(tr("CPU"));
|
||||
#ifdef _WIN64
|
||||
mCpuWidget->setWindowIcon(DIcon("processor64"));
|
||||
|
@ -836,7 +836,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
bExecuteThread = false;
|
||||
Sleep(100);
|
||||
mCloseThread->start();
|
||||
emit Bridge::getBridge()->shutdown();
|
||||
emit Bridge::getBridge()->close();
|
||||
}
|
||||
if(bCanClose)
|
||||
{
|
||||
|
|
|
@ -1088,7 +1088,7 @@ RegistersView::RegistersView(QWidget* parent) : QScrollArea(parent), mVScrollOff
|
|||
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(fontsUpdatedSlot()));
|
||||
// self communication for repainting (maybe some other widgets needs this information, too)
|
||||
connect(this, SIGNAL(refresh()), this, SLOT(reload()));
|
||||
connect(Bridge::getBridge(), SIGNAL(shutdown()), this, SLOT(shutdownSlot()));
|
||||
connect(Bridge::getBridge(), SIGNAL(close()), this, SLOT(shutdownSlot()));
|
||||
|
||||
InitMappings();
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ SourceView::~SourceView()
|
|||
clear();
|
||||
}
|
||||
|
||||
QString SourceView::getCellContent(int r, int c)
|
||||
QString SourceView::getCellContent(duint r, duint c)
|
||||
{
|
||||
if(!isValidIndex(r, c))
|
||||
return QString();
|
||||
|
@ -59,7 +59,7 @@ QString SourceView::getCellContent(int r, int c)
|
|||
return "INVALID";
|
||||
}
|
||||
|
||||
bool SourceView::isValidIndex(int r, int c)
|
||||
bool SourceView::isValidIndex(duint r, duint c)
|
||||
{
|
||||
if(!mFileLines)
|
||||
return false;
|
||||
|
@ -68,7 +68,7 @@ bool SourceView::isValidIndex(int r, int c)
|
|||
return r >= 0 && size_t(r) < mFileLines->size();
|
||||
}
|
||||
|
||||
void SourceView::sortRows(int column, bool ascending)
|
||||
void SourceView::sortRows(duint column, bool ascending)
|
||||
{
|
||||
Q_UNUSED(column);
|
||||
Q_UNUSED(ascending);
|
||||
|
@ -83,7 +83,7 @@ void SourceView::prepareData()
|
|||
mPrepareTableOffset = getTableOffset();
|
||||
mLines.clear();
|
||||
mLines.resize(lines);
|
||||
for(auto i = 0; i < lines; i++)
|
||||
for(duint i = 0; i < lines; i++)
|
||||
parseLine(mPrepareTableOffset + i, mLines[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ public:
|
|||
SourceView(QString path, duint addr, QWidget* parent = nullptr);
|
||||
~SourceView();
|
||||
|
||||
QString getCellContent(int r, int c) override;
|
||||
bool isValidIndex(int r, int c) override;
|
||||
void sortRows(int column, bool ascending) override;
|
||||
QString getCellContent(duint r, duint c) override;
|
||||
bool isValidIndex(duint r, duint c) override;
|
||||
void sortRows(duint column, bool ascending) override;
|
||||
void prepareData() override;
|
||||
|
||||
QString getSourcePath();
|
||||
|
|
|
@ -366,10 +366,10 @@ void ThreadView::updateThreadList()
|
|||
reloadData();
|
||||
}
|
||||
|
||||
QString ThreadView::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
QString ThreadView::paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h)
|
||||
{
|
||||
QString ret = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
duint threadId = getCellUserdata(rowBase + rowOffset, 1);
|
||||
QString ret = StdTable::paintContent(painter, row, col, x, y, w, h);
|
||||
duint threadId = getCellUserdata(row, 1);
|
||||
if(threadId == mCurrentThreadId && !col)
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("ThreadCurrentBackgroundColor")));
|
||||
|
|
|
@ -181,10 +181,9 @@ QString WatchView::getSelectedId()
|
|||
return QChar('.') + getCellContent(getInitialSelection(), ColId);
|
||||
}
|
||||
|
||||
QString WatchView::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
QString WatchView::paintContent(QPainter* painter, duint row, duint col, int x, int y, int w, int h)
|
||||
{
|
||||
QString ret = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
const dsint row = rowBase + rowOffset;
|
||||
QString ret = StdTable::paintContent(painter, row, col, x, y, w, h);
|
||||
if(row != getInitialSelection() && DbgFunctions()->WatchIsWatchdogTriggered(getCellContent(row, ColId).toUInt()))
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), mWatchTriggeredBackgroundColor);
|
||||
|
|
|
@ -10,7 +10,7 @@ class WatchView : public StdTable
|
|||
public:
|
||||
WatchView(CPUMultiDump* parent);
|
||||
|
||||
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 col, int x, int y, int w, int h) override;
|
||||
void updateColors() override;
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -56,7 +56,7 @@ ZehSymbolTable::ZehSymbolTable(QWidget* parent)
|
|||
Initialize();
|
||||
}
|
||||
|
||||
QString ZehSymbolTable::getCellContent(int r, int c)
|
||||
QString ZehSymbolTable::getCellContent(duint r, duint c)
|
||||
{
|
||||
QMutexLocker lock(&mMutex);
|
||||
if(!isValidIndex(r, c))
|
||||
|
@ -66,13 +66,13 @@ QString ZehSymbolTable::getCellContent(int r, int c)
|
|||
return symbolInfoString(info.get(), c);
|
||||
}
|
||||
|
||||
bool ZehSymbolTable::isValidIndex(int r, int c)
|
||||
bool ZehSymbolTable::isValidIndex(duint r, duint c)
|
||||
{
|
||||
QMutexLocker lock(&mMutex);
|
||||
return r >= 0 && r < (int)mData.size() && c >= 0 && c <= ColUndecorated;
|
||||
}
|
||||
|
||||
void ZehSymbolTable::sortRows(int column, bool ascending)
|
||||
void ZehSymbolTable::sortRows(duint column, bool ascending)
|
||||
{
|
||||
QMutexLocker lock(&mMutex);
|
||||
std::stable_sort(mData.begin(), mData.end(), [this, column, ascending](const SYMBOLPTR & a, const SYMBOLPTR & b)
|
||||
|
@ -119,7 +119,7 @@ void ZehSymbolTable::sortRows(int column, bool ascending)
|
|||
});
|
||||
}
|
||||
|
||||
QString ZehSymbolTable::symbolInfoString(const SYMBOLINFO* info, int c)
|
||||
QString ZehSymbolTable::symbolInfoString(const SYMBOLINFO* info, duint c)
|
||||
{
|
||||
switch(c)
|
||||
{
|
||||
|
|
|
@ -9,9 +9,9 @@ class ZehSymbolTable : public AbstractStdTable
|
|||
public:
|
||||
ZehSymbolTable(QWidget* parent = nullptr);
|
||||
|
||||
QString getCellContent(int r, int c) override;
|
||||
bool isValidIndex(int r, int c) override;
|
||||
void sortRows(int column, bool ascending) override;
|
||||
QString getCellContent(duint r, duint c) override;
|
||||
bool isValidIndex(duint r, duint c) override;
|
||||
void sortRows(duint column, bool ascending) override;
|
||||
|
||||
friend class SymbolView;
|
||||
friend class SearchListViewSymbols;
|
||||
|
@ -36,5 +36,5 @@ private:
|
|||
ColUndecorated
|
||||
};
|
||||
|
||||
QString symbolInfoString(const SYMBOLINFO* info, int c);
|
||||
QString symbolInfoString(const SYMBOLINFO* info, duint c);
|
||||
};
|
||||
|
|
|
@ -1102,7 +1102,7 @@ void TraceBrowser::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
|
||||
void TraceBrowser::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
duint index = getIndexOffsetFromY(transY(event->y())) + getTableOffset();
|
||||
auto index = getIndexOffsetFromY(transY(event->y())) + getTableOffset();
|
||||
if((event->buttons() & Qt::LeftButton) != 0 && getGuiState() == AbstractTableView::NoState && mTraceFile != nullptr && mTraceFile->Progress() == 100)
|
||||
{
|
||||
if(index < getRowCount())
|
||||
|
@ -1751,7 +1751,7 @@ void TraceBrowser::exportSlot()
|
|||
return;
|
||||
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](dsint row, dsint col)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,8 @@ TraceFileReader::TraceFileReader(QObject* parent) : QObject(parent)
|
|||
EXEPath.clear();
|
||||
|
||||
int maxModuleSize = (int)ConfigUint("Disassembler", "MaxModuleSize");
|
||||
mDisasm = new QZydis(maxModuleSize, Bridge::getArch());
|
||||
// TODO: refactor this to come from the parent TraceWidget
|
||||
mDisasm = new QZydis(maxModuleSize, Bridge::getArchitecture());
|
||||
connect(Config(), SIGNAL(tokenizerConfigUpdated()), this, SLOT(tokenizerUpdatedSlot()));
|
||||
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(tokenizerUpdatedSlot()));
|
||||
}
|
||||
|
|
|
@ -22,13 +22,27 @@ public:
|
|||
if(unicode >= 0xD800)
|
||||
{
|
||||
if(unicode >= 0xE000)
|
||||
{
|
||||
unicode -= 0xE000 - 0xD800;
|
||||
}
|
||||
else
|
||||
{
|
||||
// is lonely surrogate
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
return mFontMetrics.horizontalAdvance(ch);
|
||||
#else
|
||||
return mFontMetrics.width(ch);
|
||||
#endif // QT_VERSION
|
||||
}
|
||||
}
|
||||
if(!mWidths[unicode])
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
return mWidths[unicode] = mFontMetrics.horizontalAdvance(ch);
|
||||
#else
|
||||
return mWidths[unicode] = mFontMetrics.width(ch);
|
||||
#endif // QT_VERSION
|
||||
}
|
||||
return mWidths[unicode];
|
||||
}
|
||||
|
||||
|
@ -39,11 +53,21 @@ public:
|
|||
for(const QChar & ch : text)
|
||||
{
|
||||
if(ch.isHighSurrogate())
|
||||
{
|
||||
temp = ch;
|
||||
}
|
||||
else if(ch.isLowSurrogate())
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
result += mFontMetrics.horizontalAdvance(QString(temp) + ch);
|
||||
#else
|
||||
result += mFontMetrics.width(QString(temp) + ch);
|
||||
#endif // QT_VERSION
|
||||
}
|
||||
else
|
||||
{
|
||||
result += width(ch);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
|||
defaultColors.insert("AbstractTableViewBackgroundColor", QColor("#FFF8F0"));
|
||||
defaultColors.insert("AbstractTableViewTextColor", QColor("#000000"));
|
||||
defaultColors.insert("AbstractTableViewHeaderTextColor", QColor("#000000"));
|
||||
defaultColors.insert("AbstractTableViewHeaderBackgroundColor", QColor("#C0C0C0"));
|
||||
defaultColors.insert("AbstractTableViewSelectionColor", QColor("#C0C0C0"));
|
||||
|
||||
defaultColors.insert("DisassemblyCipColor", QColor("#FFFFFF"));
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
//TODO: fix performance (possibly use QTextLayout?)
|
||||
void RichTextPainter::paintRichText(QPainter* painter, int x, int y, int w, int h, int xinc, const List & richText, CachedFontMetrics* fontMetrics)
|
||||
{
|
||||
#ifdef Q_OS_DARWIN
|
||||
w -= 2;
|
||||
#else
|
||||
w -= 1;
|
||||
#endif // Q_OS_DARWIN
|
||||
|
||||
QPen pen;
|
||||
QPen highlightPen;
|
||||
QBrush brush(Qt::cyan);
|
||||
|
@ -41,7 +47,7 @@ void RichTextPainter::paintRichText(QPainter* painter, int x, int y, int w, int
|
|||
painter->setPen(pen);
|
||||
break;
|
||||
}
|
||||
painter->drawText(QRect(x + xinc, y, w - xinc, h), Qt::TextBypassShaping, curRichText.text);
|
||||
painter->drawText(QRect(x + xinc, y, w - xinc, h), 0, curRichText.text);
|
||||
if(curRichText.underline && curRichText.underlineColor.alpha())
|
||||
{
|
||||
highlightPen.setColor(curRichText.underlineColor);
|
||||
|
|
Loading…
Reference in New Issue