From 845fb463f75f6a22c1cc6d24cbc94a166939f4fb Mon Sep 17 00:00:00 2001 From: mrexodia Date: Wed, 25 May 2016 08:50:59 +0200 Subject: [PATCH] GUI: more icons + add stack comments when the dump is in stack range --- src/gui/Src/Gui/CPUDisassembly.cpp | 10 +++++----- src/gui/Src/Gui/CPUDump.cpp | 31 +++++++++++++++++++++++++---- src/gui/Src/Gui/CPUStack.cpp | 2 +- src/gui/images/bottom.png | Bin 0 -> 494 bytes src/gui/images/fileoffset.png | Bin 0 -> 621 bytes src/gui/images/top.png | Bin 0 -> 503 bytes src/gui/resource.qrc | 3 +++ 7 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 src/gui/images/bottom.png create mode 100644 src/gui/images/fileoffset.png create mode 100644 src/gui/images/top.png diff --git a/src/gui/Src/Gui/CPUDisassembly.cpp b/src/gui/Src/Gui/CPUDisassembly.cpp index 4373a209..3b0bb6a2 100644 --- a/src/gui/Src/Gui/CPUDisassembly.cpp +++ b/src/gui/Src/Gui/CPUDisassembly.cpp @@ -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(); diff --git a/src/gui/Src/Gui/CPUDump.cpp b/src/gui/Src/Gui/CPUDump.cpp index 88f1df8a..a48cd1fe 100644 --- a/src/gui/Src/Gui/CPUDump.cpp +++ b/src/gui/Src/Gui/CPUDump.cpp @@ -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 { diff --git a/src/gui/Src/Gui/CPUStack.cpp b/src/gui/Src/Gui/CPUStack.cpp index 1886febb..b45059e0 100644 --- a/src/gui/Src/Gui/CPUStack.cpp +++ b/src/gui/Src/Gui/CPUStack.cpp @@ -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())); diff --git a/src/gui/images/bottom.png b/src/gui/images/bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..377400ec010f3d04def4f878c2f9500f5438f4cc GIT binary patch literal 494 zcmVOLsC_HzG=GPc>s=OeeZQT_??O-Fq+LEIjJat z-)OyqlNWic@9_POw0V|zD&6J~Vjzsmi zf&>r{pjEm#8cvz$BHDHd6DUou(FZ*0J*xG<2X%FcjwS$J&aO1P-qOHELU6>ZezH zs3{2vbSA+Yk3n3P;3;3!L`>v_F(ll|>iiZ;XAqlN-^TrevArG2G2A#l6@Sk1yUT)A zy?`*Lj{uXzB(7jYUfACtle4>lvU>G|l@E)!6nEJ6L!c;vaU3ZeF*3b87Z5z&RJtjm k*PjvNMH2kWYy1#k0H{mNoPU~0AOHXW07*qoM6N<$f(obHF#rGn literal 0 HcmV?d00001 diff --git a/src/gui/images/fileoffset.png b/src/gui/images/fileoffset.png new file mode 100644 index 0000000000000000000000000000000000000000..bd581031ac2092772ea3c4e6810952367b677681 GIT binary patch literal 621 zcmV-z0+RiSP)KDo&R`p z5UiD-RGw7+VK;zZub#HP%X5u=eJK@AF{#t?$c^;G^`n=gkUb5z7C$3j_BwGwxqIO- z9?flCl0v*y06}?^a}Hlh1VPXRSlOuH)cIko|4<|P&D?SY7#mLwEIi3xQviLYDTDx5 z&5cH*3osNj@FJb*#D-y@Ha3dvorN!6zjLpx!18@x1H2x<^x1=5@x|NA@YAnwV0H5y z_B!)SNG;hS>0GJk1@u~Se;Y{p`BOZ_I zVtUtmDy=R6?TqTP^#Wz&Q*6q@{n_bIika~IbszR$*sewHZ6l|L6?s{Cw=Nmx0y*8nc zjqdsac)^CD?rlve#i9nf-hf)I0=ZlXHkQT}y6XgKD*+u6G}h!rCQJI_Tuk9yz=dDVT>jGrSOgn4zO_`To-KH&S*jg2LTOT2hRCClO&o<|0X)N4Z5azazze-!@vVD zP>)2T{Qv`n34Z|k-3i$5 zd6dq3kC7a-+hZ_s^K2%0OfuP8!GjlR(k(y5thZdDnr!_^R0{>P(NcXPzfh}woSFYM t;)v)NL5}uVaO&j;#<*Pp{zG2^3;>jd);5G>Pci@i002ovPDHLkV1j}N(*ytj literal 0 HcmV?d00001 diff --git a/src/gui/resource.qrc b/src/gui/resource.qrc index 6f736792..0d3ff615 100644 --- a/src/gui/resource.qrc +++ b/src/gui/resource.qrc @@ -89,5 +89,8 @@ images/cbp.png images/next.png images/previous.png + images/bottom.png + images/top.png + images/fileoffset.png