1
0
Fork 0

GUI: more icons + add stack comments when the dump is in stack range

This commit is contained in:
mrexodia 2016-05-25 08:50:59 +02:00
parent 53bc89f515
commit 845fb463f7
7 changed files with 36 additions and 10 deletions

View File

@ -384,7 +384,7 @@ void CPUDisassembly::setupRightClickContextMenu()
mMenuBuilder->addAction(makeShortcutAction(QIcon(":/icons/images/neworigin.png"), tr("Set New Origin Here"), SLOT(setNewOriginHereActionSlot()), "ActionSetNewOriginHere"));
MenuBuilder* gotoMenu = new MenuBuilder(this);
gotoMenu->addAction(makeShortcutAction(tr("Origin"), SLOT(gotoOriginSlot()), "ActionGotoOrigin"));
gotoMenu->addAction(makeShortcutAction(QIcon(":/icons/images/cbp.png"), tr("Origin"), SLOT(gotoOriginSlot()), "ActionGotoOrigin"));
gotoMenu->addAction(makeShortcutAction(QIcon(":/icons/images/previous.png"), tr("Previous"), SLOT(gotoPreviousSlot()), "ActionGotoPrevious"), [this](QMenu*)
{
return historyHasPrevious();
@ -393,14 +393,14 @@ void CPUDisassembly::setupRightClickContextMenu()
{
return historyHasNext();
});
gotoMenu->addAction(makeShortcutAction(tr("Expression"), SLOT(gotoExpressionSlot()), "ActionGotoExpression"));
gotoMenu->addAction(makeShortcutAction(tr("File Offset"), SLOT(gotoFileOffsetSlot()), "ActionGotoFileOffset"), [this](QMenu*)
gotoMenu->addAction(makeShortcutAction(QIcon(":/icons/images/geolocation-goto.png"), tr("Expression"), SLOT(gotoExpressionSlot()), "ActionGotoExpression"));
gotoMenu->addAction(makeShortcutAction(QIcon(":/icons/images/fileoffset.png"), tr("File Offset"), SLOT(gotoFileOffsetSlot()), "ActionGotoFileOffset"), [this](QMenu*)
{
char modname[MAX_MODULE_SIZE] = "";
return DbgGetModuleAt(rvaToVa(getInitialSelection()), modname);
});
gotoMenu->addAction(makeShortcutAction(tr("Start of Page"), SLOT(gotoStartSlot()), "ActionGotoStart"));
gotoMenu->addAction(makeShortcutAction(tr("End of Page"), SLOT(gotoEndSlot()), "ActionGotoEnd"));
gotoMenu->addAction(makeShortcutAction(QIcon(":/icons/images/top.png"), tr("Start of Page"), SLOT(gotoStartSlot()), "ActionGotoStart"));
gotoMenu->addAction(makeShortcutAction(QIcon(":/icons/images/bottom.png"), tr("End of Page"), SLOT(gotoEndSlot()), "ActionGotoEnd"));
mMenuBuilder->addMenu(makeMenu(QIcon(":/icons/images/goto.png"), tr("Go to")), gotoMenu);
mMenuBuilder->addSeparator();

View File

@ -317,28 +317,28 @@ void CPUDump::setupContextMenu()
mGotoMenu->setIcon(QIcon(":/icons/images/goto.png"));
//Goto->Expression
mGotoExpression = new QAction(tr("&Expression"), this);
mGotoExpression = new QAction(QIcon(":/icons/images/geolocation-goto.png"), tr("&Expression"), this);
mGotoExpression->setShortcutContext(Qt::WidgetShortcut);
this->addAction(mGotoExpression);
connect(mGotoExpression, SIGNAL(triggered()), this, SLOT(gotoExpressionSlot()));
mGotoMenu->addAction(mGotoExpression);
// Goto->File offset
mGotoFileOffset = new QAction(tr("File Offset"), this);
mGotoFileOffset = new QAction(QIcon(":/icons/images/fileoffset.png"), tr("File Offset"), this);
mGotoFileOffset->setShortcutContext(Qt::WidgetShortcut);
this->addAction(mGotoFileOffset);
connect(mGotoFileOffset, SIGNAL(triggered()), this, SLOT(gotoFileOffsetSlot()));
mGotoMenu->addAction(mGotoFileOffset);
// Goto->Start of page
mGotoStart = new QAction(tr("Start of Page"), this);
mGotoStart = new QAction(QIcon(":/icons/images/top.png"), tr("Start of Page"), this);
mGotoStart->setShortcutContext(Qt::WidgetShortcut);
this->addAction(mGotoStart);
connect(mGotoStart, SIGNAL(triggered()), this, SLOT(gotoStartSlot()));
mGotoMenu->addAction(mGotoStart);
// Goto->End of page
mGotoEnd = new QAction(tr("End of Page"), this);
mGotoEnd = new QAction(QIcon(":/icons/images/bottom.png"), tr("End of Page"), this);
mGotoEnd->setShortcutContext(Qt::WidgetShortcut);
this->addAction(mGotoEnd);
connect(mGotoEnd, SIGNAL(triggered()), this, SLOT(gotoEndSlot()));
@ -578,6 +578,29 @@ QString CPUDump::paintContent(QPainter* painter, dsint rowBase, int rowOffset, i
char label_text[MAX_LABEL_SIZE] = "";
if(DbgGetLabelAt(data, SEG_DEFAULT, label_text))
wStr = QString(modname) + "." + QString(label_text);
if(!wStr.length()) //stack comments
{
auto va = rvaToVa(wRva);
duint stackSize;
duint csp = DbgValFromString("csp");
duint stackBase = DbgMemFindBaseAddr(csp, &stackSize);
STACK_COMMENT comment;
if(va >= stackBase && va < stackBase + stackSize && DbgStackCommentGet(rvaToVa(wRva), &comment))
{
painter->save();
if(va >= csp) //active stack
{
if(*comment.color)
painter->setPen(QPen(QColor(QString(comment.color))));
else
painter->setPen(QPen(textColor));
}
else
painter->setPen(QPen(ConfigColor("StackInactiveTextColor")));
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, comment.comment);
painter->restore();
}
}
}
else //data
{

View File

@ -220,7 +220,7 @@ void CPUStack::setupContextMenu()
connect(mFindPatternAction, SIGNAL(triggered()), this, SLOT(findPattern()));
//Go to Expression
mGotoExpression = new QAction(QIcon(":/icons/images/goto.png"), tr("Go to &Expression"), this);
mGotoExpression = new QAction(QIcon(":/icons/images/geolocation-goto.png"), tr("Go to &Expression"), this);
mGotoExpression->setShortcutContext(Qt::WidgetShortcut);
this->addAction(mGotoExpression);
connect(mGotoExpression, SIGNAL(triggered()), this, SLOT(gotoExpressionSlot()));

BIN
src/gui/images/bottom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

BIN
src/gui/images/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

View File

@ -89,5 +89,8 @@
<file>images/cbp.png</file>
<file>images/next.png</file>
<file>images/previous.png</file>
<file>images/bottom.png</file>
<file>images/top.png</file>
<file>images/fileoffset.png</file>
</qresource>
</RCC>