Use an icon to represent user/system party to reduce column width
This commit is contained in:
parent
7ade354b04
commit
0c9c2c0fd0
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "StdTable.h"
|
#include "StdTable.h"
|
||||||
|
|
||||||
|
// StdIconTable extends StdTable by adding icons to one of the columns
|
||||||
class StdIconTable : public StdTable
|
class StdIconTable : public StdTable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -9,9 +10,9 @@ public:
|
||||||
explicit StdIconTable(QWidget* parent = 0) : StdTable(parent), mIconColumn(0) {};
|
explicit StdIconTable(QWidget* parent = 0) : StdTable(parent), mIconColumn(0) {};
|
||||||
|
|
||||||
// Data Management
|
// Data Management
|
||||||
void setRowIcon(int r, const QIcon & icon);
|
void setRowIcon(int r, const QIcon & icon); // set the icon for a row
|
||||||
QIcon getRowIcon(int r) const;
|
QIcon getRowIcon(int r) const;
|
||||||
void setIconColumn(int c);
|
void setIconColumn(int c); // set in which column the icons appear
|
||||||
int getIconColumn() const;
|
int getIconColumn() const;
|
||||||
void setRowCount(dsint count) override;
|
void setRowCount(dsint count) override;
|
||||||
void sortRows(int column, bool ascending) override;
|
void sortRows(int column, bool ascending) override;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "CommonActions.h"
|
#include "CommonActions.h"
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
|
|
||||||
CallStackView::CallStackView(StdTable* parent) : StdTable(parent)
|
CallStackView::CallStackView(StdTable* parent) : StdIconTable(parent)
|
||||||
{
|
{
|
||||||
int charwidth = getCharWidth();
|
int charwidth = getCharWidth();
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@ CallStackView::CallStackView(StdTable* parent) : StdTable(parent)
|
||||||
addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("To"), false); //return to
|
addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("To"), false); //return to
|
||||||
addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("From"), false); //return from
|
addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("From"), false); //return from
|
||||||
addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("Size"), false); //size
|
addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("Size"), false); //size
|
||||||
|
addColumnAt(2 * charwidth, tr("Party"), false); //party
|
||||||
addColumnAt(50 * charwidth, tr("Comment"), false);
|
addColumnAt(50 * charwidth, tr("Comment"), false);
|
||||||
addColumnAt(8 * charwidth, tr("Party"), false); //party
|
setIconColumn(ColParty);
|
||||||
loadColumnFromConfig("CallStack");
|
loadColumnFromConfig("CallStack");
|
||||||
|
|
||||||
connect(Bridge::getBridge(), SIGNAL(updateCallStack()), this, SLOT(updateCallStack()));
|
connect(Bridge::getBridge(), SIGNAL(updateCallStack()), this, SLOT(updateCallStack()));
|
||||||
|
@ -74,28 +75,28 @@ void CallStackView::setupContextMenu()
|
||||||
|
|
||||||
QString CallStackView::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
QString CallStackView::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
QString ret = getCellContent(rowBase + rowOffset, col);
|
|
||||||
|
|
||||||
if(isSelected(rowBase, rowOffset))
|
if(isSelected(rowBase, rowOffset))
|
||||||
painter->fillRect(QRect(x, y, w, h), QBrush(mSelectionColor));
|
painter->fillRect(QRect(x, y, w, h), QBrush(mSelectionColor));
|
||||||
|
|
||||||
bool isSpaceRow = !getCellContent(rowBase + rowOffset, ColThread).isEmpty();
|
bool isSpaceRow = !getCellContent(rowBase + rowOffset, ColThread).isEmpty();
|
||||||
|
|
||||||
if(!col && !(rowBase + rowOffset) && !ret.isEmpty())
|
if(col == ColThread && !(rowBase + rowOffset))
|
||||||
|
{
|
||||||
|
QString ret = getCellContent(rowBase + rowOffset, col);
|
||||||
|
if(!ret.isEmpty())
|
||||||
{
|
{
|
||||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("ThreadCurrentBackgroundColor")));
|
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("ThreadCurrentBackgroundColor")));
|
||||||
painter->setPen(QPen(ConfigColor("ThreadCurrentColor")));
|
painter->setPen(QPen(ConfigColor("ThreadCurrentColor")));
|
||||||
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, ret);
|
painter->drawText(QRect(x + 4, y, w - 4, h), Qt::AlignVCenter | Qt::AlignLeft, ret);
|
||||||
ret = "";
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
else if(col > ColThread && isSpaceRow)
|
else if(col > ColThread && isSpaceRow)
|
||||||
{
|
{
|
||||||
auto mid = h / 2.0;
|
auto mid = h / 2.0;
|
||||||
painter->drawLine(QPointF(x, y + mid), QPointF(x + w, y + mid));
|
painter->drawLine(QPointF(x, y + mid), QPointF(x + w, y + mid));
|
||||||
}
|
}
|
||||||
|
return StdIconTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallStackView::updateCallStack()
|
void CallStackView::updateCallStack()
|
||||||
|
@ -149,12 +150,15 @@ void CallStackView::updateCallStack()
|
||||||
{
|
{
|
||||||
case mod_user:
|
case mod_user:
|
||||||
setCellContent(currentRow, ColParty, tr("User"));
|
setCellContent(currentRow, ColParty, tr("User"));
|
||||||
|
setRowIcon(currentRow, DIcon("markasuser"));
|
||||||
break;
|
break;
|
||||||
case mod_system:
|
case mod_system:
|
||||||
setCellContent(currentRow, ColParty, tr("System"));
|
setCellContent(currentRow, ColParty, tr("System"));
|
||||||
|
setRowIcon(currentRow, DIcon("markassystem"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
setCellContent(currentRow, ColParty, QString::number(party));
|
setCellContent(currentRow, ColParty, QString::number(party));
|
||||||
|
setRowIcon(currentRow, DIcon("markasparty"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "StdTable.h"
|
#include "StdIconTable.h"
|
||||||
class CommonActions;
|
class CommonActions;
|
||||||
|
|
||||||
class CallStackView : public StdTable
|
class CallStackView : public StdIconTable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -30,8 +30,8 @@ private:
|
||||||
ColTo,
|
ColTo,
|
||||||
ColFrom,
|
ColFrom,
|
||||||
ColSize,
|
ColSize,
|
||||||
ColComment,
|
ColParty,
|
||||||
ColParty
|
ColComment
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuBuilder* mMenuBuilder;
|
MenuBuilder* mMenuBuilder;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "RichTextPainter.h"
|
#include "RichTextPainter.h"
|
||||||
|
|
||||||
MemoryMapView::MemoryMapView(StdTable* parent)
|
MemoryMapView::MemoryMapView(StdTable* parent)
|
||||||
: StdTable(parent),
|
: StdIconTable(parent),
|
||||||
mCipBase(0)
|
mCipBase(0)
|
||||||
{
|
{
|
||||||
setDrawDebugOnly(true);
|
setDrawDebugOnly(true);
|
||||||
|
@ -25,12 +25,14 @@ MemoryMapView::MemoryMapView(StdTable* parent)
|
||||||
|
|
||||||
addColumnAt(8 + charwidth * 2 * sizeof(duint), tr("Address"), true, tr("Address")); //addr
|
addColumnAt(8 + charwidth * 2 * sizeof(duint), tr("Address"), true, tr("Address")); //addr
|
||||||
addColumnAt(8 + charwidth * 2 * sizeof(duint), tr("Size"), false, tr("Size")); //size
|
addColumnAt(8 + charwidth * 2 * sizeof(duint), tr("Size"), false, tr("Size")); //size
|
||||||
|
addColumnAt(charwidth * 2, tr("Party"), false); // party
|
||||||
addColumnAt(8 + charwidth * 32, tr("Info"), false, tr("Page Information")); //page information
|
addColumnAt(8 + charwidth * 32, tr("Info"), false, tr("Page Information")); //page information
|
||||||
addColumnAt(8 + charwidth * 28, tr("Content"), false, tr("Content of section")); //content of section
|
addColumnAt(8 + charwidth * 28, tr("Content"), false, tr("Content of section")); //content of section
|
||||||
addColumnAt(8 + charwidth * 5, tr("Type"), true, tr("Allocation Type")); //allocation type
|
addColumnAt(8 + charwidth * 5, tr("Type"), true, tr("Allocation Type")); //allocation type
|
||||||
addColumnAt(8 + charwidth * 11, tr("Protection"), true, tr("Current Protection")); //current protection
|
addColumnAt(8 + charwidth * 11, tr("Protection"), true, tr("Current Protection")); //current protection
|
||||||
addColumnAt(8 + charwidth * 8, tr("Initial"), true, tr("Allocation Protection")); //allocation protection
|
addColumnAt(8 + charwidth * 8, tr("Initial"), true, tr("Allocation Protection")); //allocation protection
|
||||||
loadColumnFromConfig("MemoryMap");
|
loadColumnFromConfig("MemoryMap");
|
||||||
|
setIconColumn(ColParty);
|
||||||
|
|
||||||
connect(Bridge::getBridge(), SIGNAL(updateMemory()), this, SLOT(refreshMap()));
|
connect(Bridge::getBridge(), SIGNAL(updateMemory()), this, SLOT(refreshMap()));
|
||||||
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(stateChangedSlot(DBGSTATE)));
|
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(stateChangedSlot(DBGSTATE)));
|
||||||
|
@ -211,7 +213,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
|
||||||
if(!DbgIsDebugging())
|
if(!DbgIsDebugging())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
duint selectedAddr = getCellUserdata(getInitialSelection(), 0);
|
duint selectedAddr = getSelAddr();
|
||||||
|
|
||||||
QMenu wMenu(this); //create context menu
|
QMenu wMenu(this); //create context menu
|
||||||
wMenu.addAction(mFollowDisassembly);
|
wMenu.addAction(mFollowDisassembly);
|
||||||
|
@ -269,7 +271,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
|
||||||
wMenu.exec(mapToGlobal(pos)); //execute context menu
|
wMenu.exec(mapToGlobal(pos)); //execute context menu
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MemoryMapView::getProtectionString(DWORD Protect)
|
static QString getProtectionString(DWORD Protect)
|
||||||
{
|
{
|
||||||
#define RIGHTS_STRING (sizeof("ERWCG") + 1)
|
#define RIGHTS_STRING (sizeof("ERWCG") + 1)
|
||||||
char rights[RIGHTS_STRING];
|
char rights[RIGHTS_STRING];
|
||||||
|
@ -285,11 +287,7 @@ QString MemoryMapView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
||||||
if(col == 0) //address
|
if(col == 0) //address
|
||||||
{
|
{
|
||||||
QString wStr = getCellContent(rowBase + rowOffset, col);
|
QString wStr = getCellContent(rowBase + rowOffset, col);
|
||||||
#ifdef _WIN64
|
duint addr = getSelAddr();
|
||||||
duint addr = wStr.toULongLong(0, 16);
|
|
||||||
#else //x86
|
|
||||||
duint addr = wStr.toULong(0, 16);
|
|
||||||
#endif //_WIN64
|
|
||||||
QColor color = mTextColor;
|
QColor color = mTextColor;
|
||||||
QColor backgroundColor = Qt::transparent;
|
QColor backgroundColor = Qt::transparent;
|
||||||
bool isBp = (DbgGetBpxTypeAt(addr) & bp_memory) == bp_memory;
|
bool isBp = (DbgGetBpxTypeAt(addr) & bp_memory) == bp_memory;
|
||||||
|
@ -318,10 +316,10 @@ QString MemoryMapView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
||||||
painter->drawText(QRect(x + 4, y, getColumnWidth(col) - 4, getRowHeight()), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
painter->drawText(QRect(x + 4, y, getColumnWidth(col) - 4, getRowHeight()), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
else if(col == 2) //info
|
else if(col == ColPageInfo) //info
|
||||||
{
|
{
|
||||||
QString wStr = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
QString wStr = StdIconTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||||
auto addr = getCellUserdata(rowBase + rowOffset, 0);
|
auto addr = getCellUserdata(rowBase + rowOffset, ColAddress);
|
||||||
if(wStr.contains(" \""))
|
if(wStr.contains(" \""))
|
||||||
{
|
{
|
||||||
auto idx = wStr.indexOf(" \"");
|
auto idx = wStr.indexOf(" \"");
|
||||||
|
@ -350,9 +348,9 @@ QString MemoryMapView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(col == 4) //CPROT
|
else if(col == ColCurProtect) //CPROT
|
||||||
{
|
{
|
||||||
QString wStr = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);;
|
QString wStr = StdIconTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);;
|
||||||
if(!ConfigBool("Engine", "ListAllPages"))
|
if(!ConfigBool("Engine", "ListAllPages"))
|
||||||
{
|
{
|
||||||
painter->setPen(ConfigColor("MemoryMapSectionTextColor"));
|
painter->setPen(ConfigColor("MemoryMapSectionTextColor"));
|
||||||
|
@ -360,7 +358,7 @@ QString MemoryMapView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
return StdIconTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* MemoryMapView::makeCommandAction(QAction* action, const QString & command)
|
QAction* MemoryMapView::makeCommandAction(QAction* action, const QString & command)
|
||||||
|
@ -384,7 +382,7 @@ void MemoryMapView::ExecCommand()
|
||||||
for(int i : getSelection())
|
for(int i : getSelection())
|
||||||
{
|
{
|
||||||
QString specializedCommand = command;
|
QString specializedCommand = command;
|
||||||
specializedCommand.replace(QChar('$'), ToHexString(getCellUserdata(i, 0))); // $ -> Base address
|
specializedCommand.replace(QChar('$'), ToHexString(getCellUserdata(i, ColAddress))); // $ -> Base address
|
||||||
DbgCmdExec(specializedCommand);
|
DbgCmdExec(specializedCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,16 +409,34 @@ void MemoryMapView::refreshMap()
|
||||||
wMbi = (wMemMapStruct.page)[wI].mbi;
|
wMbi = (wMemMapStruct.page)[wI].mbi;
|
||||||
|
|
||||||
// Base address
|
// Base address
|
||||||
setCellContent(wI, 0, ToPtrString((duint)wMbi.BaseAddress));
|
setCellContent(wI, ColAddress, ToPtrString((duint)wMbi.BaseAddress));
|
||||||
setCellUserdata(wI, 0, (duint)wMbi.BaseAddress);
|
setCellUserdata(wI, ColAddress, (duint)wMbi.BaseAddress);
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
setCellContent(wI, 1, ToPtrString((duint)wMbi.RegionSize));
|
setCellContent(wI, ColSize, ToPtrString((duint)wMbi.RegionSize));
|
||||||
setCellUserdata(wI, 1, (duint)wMbi.RegionSize);
|
setCellUserdata(wI, ColSize, (duint)wMbi.RegionSize);
|
||||||
|
|
||||||
|
// Party
|
||||||
|
int party = DbgFunctions()->ModGetParty((duint)wMbi.BaseAddress);
|
||||||
|
switch(party)
|
||||||
|
{
|
||||||
|
case mod_user:
|
||||||
|
setCellContent(wI, ColParty, tr("User"));
|
||||||
|
setRowIcon(wI, DIcon("markasuser"));
|
||||||
|
break;
|
||||||
|
case mod_system:
|
||||||
|
setCellContent(wI, ColParty, tr("System"));
|
||||||
|
setRowIcon(wI, DIcon("markassystem"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
setCellContent(wI, ColParty, QString::number(party));
|
||||||
|
setRowIcon(wI, DIcon("markasparty"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Information
|
// Information
|
||||||
wS = QString((wMemMapStruct.page)[wI].info);
|
wS = QString((wMemMapStruct.page)[wI].info);
|
||||||
setCellContent(wI, 2, wS);
|
setCellContent(wI, ColPageInfo, wS);
|
||||||
|
|
||||||
// Content, TODO: proper section content analysis in dbg/memory.cpp:MemUpdateMap
|
// Content, TODO: proper section content analysis in dbg/memory.cpp:MemUpdateMap
|
||||||
char comment_text[MAX_COMMENT_SIZE];
|
char comment_text[MAX_COMMENT_SIZE];
|
||||||
|
@ -450,7 +466,7 @@ void MemoryMapView::refreshMap()
|
||||||
wS = tr("Exception information");
|
wS = tr("Exception information");
|
||||||
else
|
else
|
||||||
wS = QString("");
|
wS = QString("");
|
||||||
setCellContent(wI, 3, std::move(wS));
|
setCellContent(wI, ColContent, std::move(wS));
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
const char* type = "";
|
const char* type = "";
|
||||||
|
@ -469,13 +485,13 @@ void MemoryMapView::refreshMap()
|
||||||
type = "N/A";
|
type = "N/A";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
setCellContent(wI, 4, type);
|
setCellContent(wI, ColAllocation, type);
|
||||||
|
|
||||||
// current access protection
|
// current access protection
|
||||||
setCellContent(wI, 5, getProtectionString(wMbi.Protect));
|
setCellContent(wI, ColCurProtect, getProtectionString(wMbi.Protect));
|
||||||
|
|
||||||
// allocation protection
|
// allocation protection
|
||||||
setCellContent(wI, 6, getProtectionString(wMbi.AllocationProtect));
|
setCellContent(wI, ColAllocProtect, getProtectionString(wMbi.AllocationProtect));
|
||||||
|
|
||||||
}
|
}
|
||||||
if(wMemMapStruct.page != 0)
|
if(wMemMapStruct.page != 0)
|
||||||
|
@ -491,22 +507,22 @@ void MemoryMapView::stateChangedSlot(DBGSTATE state)
|
||||||
|
|
||||||
void MemoryMapView::followDumpSlot()
|
void MemoryMapView::followDumpSlot()
|
||||||
{
|
{
|
||||||
DbgCmdExecDirect(QString("dump %1").arg(getCellContent(getInitialSelection(), 0)));
|
DbgCmdExecDirect(QString("dump %1").arg(getSelText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::followDisassemblerSlot()
|
void MemoryMapView::followDisassemblerSlot()
|
||||||
{
|
{
|
||||||
DbgCmdExec(QString("disasm %1").arg(getCellContent(getInitialSelection(), 0)));
|
DbgCmdExec(QString("disasm %1").arg(getSelText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::followSymbolsSlot()
|
void MemoryMapView::followSymbolsSlot()
|
||||||
{
|
{
|
||||||
DbgCmdExec(QString("symfollow %1").arg(getCellContent(getInitialSelection(), 0)));
|
DbgCmdExec(QString("symfollow %1").arg(getSelText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::doubleClickedSlot()
|
void MemoryMapView::doubleClickedSlot()
|
||||||
{
|
{
|
||||||
auto addr = DbgValFromString(getCellContent(getInitialSelection(), 0).toUtf8().constData());
|
auto addr = DbgValFromString(getSelText().toUtf8().constData());
|
||||||
if(!addr)
|
if(!addr)
|
||||||
return;
|
return;
|
||||||
if(DbgFunctions()->MemIsCodePage(addr, false))
|
if(DbgFunctions()->MemIsCodePage(addr, false))
|
||||||
|
@ -522,12 +538,8 @@ void MemoryMapView::memoryExecuteSingleshootToggleSlot()
|
||||||
{
|
{
|
||||||
for(int i : getSelection())
|
for(int i : getSelection())
|
||||||
{
|
{
|
||||||
QString addr_text = getCellContent(i, 0);
|
QString addr_text = getCellContent(i, ColAddress);
|
||||||
#ifdef _WIN64
|
duint selectedAddr = getSelAddr();
|
||||||
duint selectedAddr = addr_text.toULongLong(0, 16);
|
|
||||||
#else //x86
|
|
||||||
duint selectedAddr = addr_text.toULong(0, 16);
|
|
||||||
#endif //_WIN64
|
|
||||||
if((DbgGetBpxTypeAt(selectedAddr) & bp_memory) == bp_memory) //memory breakpoint set
|
if((DbgGetBpxTypeAt(selectedAddr) & bp_memory) == bp_memory) //memory breakpoint set
|
||||||
DbgCmdExec(QString("bpmc ") + addr_text);
|
DbgCmdExec(QString("bpmc ") + addr_text);
|
||||||
else
|
else
|
||||||
|
@ -539,9 +551,9 @@ void MemoryMapView::pageMemoryRights()
|
||||||
{
|
{
|
||||||
PageMemoryRights PageMemoryRightsDialog(this);
|
PageMemoryRights PageMemoryRightsDialog(this);
|
||||||
connect(&PageMemoryRightsDialog, SIGNAL(refreshMemoryMap()), this, SLOT(refreshMap()));
|
connect(&PageMemoryRightsDialog, SIGNAL(refreshMemoryMap()), this, SLOT(refreshMap()));
|
||||||
duint addr = getCellUserdata(getInitialSelection(), 0);
|
duint addr = getSelAddr();
|
||||||
duint size = getCellUserdata(getInitialSelection(), 1);
|
duint size = getCellUserdata(getInitialSelection(), ColSize);
|
||||||
PageMemoryRightsDialog.RunAddrSize(addr, size, getCellContent(getInitialSelection(), 3));
|
PageMemoryRightsDialog.RunAddrSize(addr, size, getCellContent(getInitialSelection(), ColCurProtect));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::switchView()
|
void MemoryMapView::switchView()
|
||||||
|
@ -562,12 +574,12 @@ void MemoryMapView::memoryAllocateSlot()
|
||||||
if(mLineEdit.exec() == QDialog::Accepted)
|
if(mLineEdit.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
duint memsize = mLineEdit.getVal();
|
duint memsize = mLineEdit.getVal();
|
||||||
if(memsize == 0) // 1GB
|
if(memsize == 0)
|
||||||
{
|
{
|
||||||
SimpleWarningBox(this, tr("Warning"), tr("You're trying to allocate a zero-sized buffer just now."));
|
SimpleWarningBox(this, tr("Warning"), tr("You're trying to allocate a zero-sized buffer just now."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(memsize > 1024 * 1024 * 1024)
|
if(memsize > 1024 * 1024 * 1024) // 1GB
|
||||||
{
|
{
|
||||||
SimpleErrorBox(this, tr("Error"), tr("The size of buffer you're trying to allocate exceeds 1GB. Please check your expression to ensure nothing is wrong."));
|
SimpleErrorBox(this, tr("Error"), tr("The size of buffer you're trying to allocate exceeds 1GB. Please check your expression to ensure nothing is wrong."));
|
||||||
return;
|
return;
|
||||||
|
@ -593,7 +605,7 @@ void MemoryMapView::findPatternSlot()
|
||||||
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
duint addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16);
|
duint addr = getSelAddr();
|
||||||
entireBlockEnabled = hexEdit.entireBlock();
|
entireBlockEnabled = hexEdit.entireBlock();
|
||||||
BridgeSettingSetUint("Gui", "MemoryMapEntireBlock", entireBlockEnabled);
|
BridgeSettingSetUint("Gui", "MemoryMapEntireBlock", entireBlockEnabled);
|
||||||
if(entireBlockEnabled)
|
if(entireBlockEnabled)
|
||||||
|
@ -608,8 +620,8 @@ void MemoryMapView::dumpMemory()
|
||||||
duint end = 0;
|
duint end = 0;
|
||||||
for(auto row : getSelection())
|
for(auto row : getSelection())
|
||||||
{
|
{
|
||||||
auto base = getCellUserdata(row, 0);
|
auto base = getCellUserdata(row, ColAddress);
|
||||||
auto size = getCellUserdata(row, 1);
|
auto size = getCellUserdata(row, ColSize);
|
||||||
if(end == 0)
|
if(end == 0)
|
||||||
{
|
{
|
||||||
start = base;
|
start = base;
|
||||||
|
@ -625,7 +637,7 @@ void MemoryMapView::dumpMemory()
|
||||||
auto modname = mainModuleName();
|
auto modname = mainModuleName();
|
||||||
if(!modname.isEmpty())
|
if(!modname.isEmpty())
|
||||||
modname += '_';
|
modname += '_';
|
||||||
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, getCellContent(getInitialSelection(), 0));
|
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, getSelText());
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
||||||
|
|
||||||
if(fileName.length())
|
if(fileName.length())
|
||||||
|
@ -640,7 +652,7 @@ void MemoryMapView::loadMemory()
|
||||||
auto modname = mainModuleName();
|
auto modname = mainModuleName();
|
||||||
if(!modname.isEmpty())
|
if(!modname.isEmpty())
|
||||||
modname += '_';
|
modname += '_';
|
||||||
auto addr = getCellContent(getInitialSelection(), 0);
|
auto addr = getSelText();
|
||||||
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, addr);
|
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, addr);
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Load Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Load Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
||||||
|
|
||||||
|
@ -648,7 +660,7 @@ void MemoryMapView::loadMemory()
|
||||||
{
|
{
|
||||||
fileName = QDir::toNativeSeparators(fileName);
|
fileName = QDir::toNativeSeparators(fileName);
|
||||||
//TODO: loaddata command (Does ODbgScript support that?)
|
//TODO: loaddata command (Does ODbgScript support that?)
|
||||||
DbgCmdExec(QString("savedata \"%1\",%2,%3").arg(fileName, addr, getCellContent(getInitialSelection(), 1)));
|
DbgCmdExec(QString("savedata \"%1\",%2,%3").arg(fileName, addr, getCellContent(getInitialSelection(), ColSize)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,10 +669,9 @@ void MemoryMapView::selectAddress(duint va)
|
||||||
auto base = DbgMemFindBaseAddr(va, nullptr);
|
auto base = DbgMemFindBaseAddr(va, nullptr);
|
||||||
if(base)
|
if(base)
|
||||||
{
|
{
|
||||||
auto baseText = ToPtrString(base);
|
|
||||||
auto rows = getRowCount();
|
auto rows = getRowCount();
|
||||||
for(dsint row = 0; row < rows; row++)
|
for(dsint row = 0; row < rows; row++)
|
||||||
if(getCellContent(row, 0) == baseText)
|
if(getCellUserdata(row, ColAddress) == base)
|
||||||
{
|
{
|
||||||
scrollSelect(row);
|
scrollSelect(row);
|
||||||
reloadData();
|
reloadData();
|
||||||
|
@ -680,7 +691,7 @@ void MemoryMapView::gotoExpressionSlot()
|
||||||
if(!mGoto)
|
if(!mGoto)
|
||||||
mGoto = new GotoDialog(this);
|
mGoto = new GotoDialog(this);
|
||||||
mGoto->setWindowTitle(tr("Enter the address to find..."));
|
mGoto->setWindowTitle(tr("Enter the address to find..."));
|
||||||
mGoto->setInitialExpression(ToPtrString(duint(getCellContent(getInitialSelection(), 0).toULongLong(nullptr, 16))));
|
mGoto->setInitialExpression(ToPtrString(getSelAddr()));
|
||||||
if(mGoto->exec() == QDialog::Accepted)
|
if(mGoto->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
selectAddress(DbgValFromString(mGoto->expressionText.toUtf8().constData()));
|
selectAddress(DbgValFromString(mGoto->expressionText.toUtf8().constData()));
|
||||||
|
@ -689,8 +700,8 @@ void MemoryMapView::gotoExpressionSlot()
|
||||||
|
|
||||||
void MemoryMapView::addVirtualModSlot()
|
void MemoryMapView::addVirtualModSlot()
|
||||||
{
|
{
|
||||||
auto base = getCellUserdata(getInitialSelection(), 0);
|
auto base = getSelAddr();
|
||||||
auto size = getCellUserdata(getInitialSelection(), 1);
|
auto size = getCellUserdata(getInitialSelection(), ColSize);
|
||||||
VirtualModDialog mDialog(this);
|
VirtualModDialog mDialog(this);
|
||||||
mDialog.setData("", base, size);
|
mDialog.setData("", base, size);
|
||||||
if(mDialog.exec() != QDialog::Accepted)
|
if(mDialog.exec() != QDialog::Accepted)
|
||||||
|
@ -703,8 +714,8 @@ void MemoryMapView::addVirtualModSlot()
|
||||||
|
|
||||||
void MemoryMapView::findReferencesSlot()
|
void MemoryMapView::findReferencesSlot()
|
||||||
{
|
{
|
||||||
auto base = getCellUserdata(getInitialSelection(), 0);
|
auto base = getSelAddr();
|
||||||
auto size = getCellUserdata(getInitialSelection(), 1);
|
auto size = getCellUserdata(getInitialSelection(), ColSize);
|
||||||
DbgCmdExec(QString("reffindrange %1, %2, dis.sel()").arg(ToPtrString(base)).arg(ToPtrString(base + size)));
|
DbgCmdExec(QString("reffindrange %1, %2, dis.sel()").arg(ToPtrString(base)).arg(ToPtrString(base + size)));
|
||||||
emit showReferences();
|
emit showReferences();
|
||||||
}
|
}
|
||||||
|
@ -712,8 +723,8 @@ void MemoryMapView::findReferencesSlot()
|
||||||
void MemoryMapView::selectionGetSlot(SELECTIONDATA* selection)
|
void MemoryMapView::selectionGetSlot(SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
auto sel = getSelection();
|
auto sel = getSelection();
|
||||||
selection->start = getCellUserdata(sel.front(), 0);
|
selection->start = getCellUserdata(sel.front(), ColAddress);
|
||||||
selection->end = getCellUserdata(sel.back(), 0) + getCellUserdata(sel.back(), 1) - 1;
|
selection->end = getCellUserdata(sel.back(), ColAddress) + getCellUserdata(sel.back(), ColSize) - 1;
|
||||||
Bridge::getBridge()->setResult(BridgeResult::SelectionGet, 1);
|
Bridge::getBridge()->setResult(BridgeResult::SelectionGet, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,7 +736,7 @@ void MemoryMapView::disassembleAtSlot(dsint va, dsint cip)
|
||||||
|
|
||||||
void MemoryMapView::commentSlot()
|
void MemoryMapView::commentSlot()
|
||||||
{
|
{
|
||||||
duint wVA = getCellUserdata(getInitialSelection(), 0);
|
duint wVA = getSelAddr();
|
||||||
LineEditDialog mLineEdit(this);
|
LineEditDialog mLineEdit(this);
|
||||||
QString addr_text = ToPtrString(wVA);
|
QString addr_text = ToPtrString(wVA);
|
||||||
char comment_text[MAX_COMMENT_SIZE] = "";
|
char comment_text[MAX_COMMENT_SIZE] = "";
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "StdTable.h"
|
#include "StdIconTable.h"
|
||||||
|
|
||||||
class GotoDialog;
|
class GotoDialog;
|
||||||
|
|
||||||
class MemoryMapView : public StdTable
|
class MemoryMapView : public StdIconTable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -42,7 +42,25 @@ public slots:
|
||||||
void disassembleAtSlot(dsint va, dsint cip);
|
void disassembleAtSlot(dsint va, dsint cip);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getProtectionString(DWORD Protect);
|
enum
|
||||||
|
{
|
||||||
|
ColAddress = 0,
|
||||||
|
ColSize,
|
||||||
|
ColParty,
|
||||||
|
ColPageInfo,
|
||||||
|
ColContent,
|
||||||
|
ColAllocation,
|
||||||
|
ColCurProtect,
|
||||||
|
ColAllocProtect
|
||||||
|
};
|
||||||
|
inline duint getSelAddr()
|
||||||
|
{
|
||||||
|
return getCellUserdata(getInitialSelection(), ColAddress);
|
||||||
|
}
|
||||||
|
inline QString getSelText()
|
||||||
|
{
|
||||||
|
return getCellContent(getInitialSelection(), ColAddress);
|
||||||
|
}
|
||||||
QAction* makeCommandAction(QAction* action, const QString & command);
|
QAction* makeCommandAction(QAction* action, const QString & command);
|
||||||
|
|
||||||
GotoDialog* mGoto = nullptr;
|
GotoDialog* mGoto = nullptr;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
#include "BrowseDialog.h"
|
#include "BrowseDialog.h"
|
||||||
#include "StdSearchListView.h"
|
#include "StdIconSearchListView.h"
|
||||||
#include "ZehSymbolTable.h"
|
#include "ZehSymbolTable.h"
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
@ -20,17 +20,18 @@ enum
|
||||||
ColStatus,
|
ColStatus,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModuleStdTable final : public StdTable
|
class ModuleStdTable final : public StdIconTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ModuleStdTable()
|
ModuleStdTable()
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
|
setIconColumn(ColParty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateColors() override
|
void updateColors() override
|
||||||
{
|
{
|
||||||
StdTable::updateColors();
|
StdIconTable::updateColors();
|
||||||
mSymbolUnloadedTextColor = ConfigColor("SymbolUnloadedTextColor");
|
mSymbolUnloadedTextColor = ConfigColor("SymbolUnloadedTextColor");
|
||||||
mSymbolLoadingTextColor = ConfigColor("SymbolLoadingTextColor");
|
mSymbolLoadingTextColor = ConfigColor("SymbolLoadingTextColor");
|
||||||
mSymbolLoadedTextColor = ConfigColor("SymbolLoadedTextColor");
|
mSymbolLoadedTextColor = ConfigColor("SymbolLoadedTextColor");
|
||||||
|
@ -174,7 +175,7 @@ SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView
|
||||||
mSymbolList->mSearchStartCol = 1;
|
mSymbolList->mSearchStartCol = 1;
|
||||||
|
|
||||||
// Create module list
|
// Create module list
|
||||||
mModuleList = new StdSearchListView(this, true, false, new StdTableSearchList(new ModuleStdTable(), new ModuleStdTable()));
|
mModuleList = new StdIconSearchListView(this, true, false, new StdTableSearchList(new ModuleStdTable(), new ModuleStdTable()));
|
||||||
mModuleList->setSearchStartCol(ColBase);
|
mModuleList->setSearchStartCol(ColBase);
|
||||||
mModuleList->enableMultiSelection(true);
|
mModuleList->enableMultiSelection(true);
|
||||||
mModuleList->setAddressColumn(ColBase, true);
|
mModuleList->setAddressColumn(ColBase, true);
|
||||||
|
@ -182,7 +183,7 @@ SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView
|
||||||
int charwidth = mModuleList->getCharWidth();
|
int charwidth = mModuleList->getCharWidth();
|
||||||
mModuleList->addColumnAt(8 + charwidth * 2 * sizeof(dsint), tr("Base"), true);
|
mModuleList->addColumnAt(8 + charwidth * 2 * sizeof(dsint), tr("Base"), true);
|
||||||
mModuleList->addColumnAt(300, tr("Module"), true);
|
mModuleList->addColumnAt(300, tr("Module"), true);
|
||||||
mModuleList->addColumnAt(8 + charwidth * 8, tr("Party"), true);
|
mModuleList->addColumnAt(charwidth * 2, tr("Party"), true); // with icon
|
||||||
mModuleList->addColumnAt(8 + charwidth * 60, tr("Path"), true);
|
mModuleList->addColumnAt(8 + charwidth * 60, tr("Path"), true);
|
||||||
mModuleList->addColumnAt(8 + charwidth * 8, tr("Status"), true);
|
mModuleList->addColumnAt(8 + charwidth * 8, tr("Status"), true);
|
||||||
mModuleList->loadColumnFromConfig("Module");
|
mModuleList->loadColumnFromConfig("Module");
|
||||||
|
@ -489,12 +490,15 @@ void SymbolView::updateSymbolList(int module_count, SYMBOLMODULEINFO* modules)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
mModuleList->stdList()->setCellContent(i, ColParty, tr("User"));
|
mModuleList->stdList()->setCellContent(i, ColParty, tr("User"));
|
||||||
|
mModuleList->setRowIcon(i, DIcon("markasuser"));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
mModuleList->stdList()->setCellContent(i, ColParty, tr("System"));
|
mModuleList->stdList()->setCellContent(i, ColParty, tr("System"));
|
||||||
|
mModuleList->setRowIcon(i, DIcon("markassystem"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mModuleList->stdList()->setCellContent(i, ColParty, tr("Party: %1").arg(party));
|
mModuleList->stdList()->setCellContent(i, ColParty, tr("Party: %1").arg(party));
|
||||||
|
mModuleList->setRowIcon(i, DIcon("markasparty"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
char szModPath[MAX_PATH] = "";
|
char szModPath[MAX_PATH] = "";
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class StdSearchListView;
|
class StdSearchListView;
|
||||||
|
class StdIconSearchListView;
|
||||||
class SearchListView;
|
class SearchListView;
|
||||||
class SymbolSearchList;
|
class SymbolSearchList;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
@ -68,7 +69,7 @@ private:
|
||||||
QVBoxLayout* mSymbolLayout;
|
QVBoxLayout* mSymbolLayout;
|
||||||
QWidget* mSymbolPlaceHolder;
|
QWidget* mSymbolPlaceHolder;
|
||||||
SearchListView* mSymbolList;
|
SearchListView* mSymbolList;
|
||||||
StdSearchListView* mModuleList;
|
StdIconSearchListView* mModuleList;
|
||||||
SymbolSearchList* mSymbolSearchList;
|
SymbolSearchList* mSymbolSearchList;
|
||||||
QMap<QString, duint> mModuleBaseList;
|
QMap<QString, duint> mModuleBaseList;
|
||||||
QAction* mFollowSymbolAction;
|
QAction* mFollowSymbolAction;
|
||||||
|
|
Loading…
Reference in New Issue