1
0
Fork 0

Merge pull request #547 from blaquee/stackview_dump_at

Stackview dump at Implementation
This commit is contained in:
Duncan Ogilvie 2016-02-19 04:28:42 +01:00
commit 4626351c6a
3 changed files with 46 additions and 3 deletions

View File

@ -1,17 +1,20 @@
#include "CPUStack.h"
#include "CPUDump.h"
#include <QClipboard>
#include "Configuration.h"
#include "Bridge.h"
#include "HexEditDialog.h"
#include "WordEditDialog.h"
#include "CPUMultiDump.h"
CPUStack::CPUStack(QWidget* parent) : HexDump(parent)
CPUStack::CPUStack(CPUMultiDump* multiDump, QWidget* parent) : HexDump(parent)
{
setShowHeader(false);
int charwidth = getCharWidth();
ColumnDescriptor_t wColDesc;
DataDescriptor_t dDesc;
bStackFrozen = false;
mMultiDump = multiDump;
mForceColumn = 1;
@ -153,6 +156,21 @@ void CPUStack::setupContextMenu()
mFollowDump = new QAction("Follow in &Dump", this);
connect(mFollowDump, SIGNAL(triggered()), this, SLOT(followDumpSlot()));
#ifdef _WIN64
mFollowInDumpMenu = new QMenu("&Follow QWORD in Dump", this);
#else //x86
mFollowInDumpMenu = new QMenu("&Follow DWORD in Dump", this);
#endif //_WIN64
int maxDumps = mMultiDump->getMaxCPUTabs();
for(int i = 0; i < maxDumps; i++)
{
QAction* action = new QAction(QString("Dump %1)").arg(i+1), this);
connect(action, SIGNAL(triggered()), this, SLOT(followinDumpNSlot()));
mFollowInDumpMenu->addAction(action);
mFollowInDumpActions.push_back(action);
}
mFollowStack = new QAction("Follow in &Stack", this);
connect(mFollowStack, SIGNAL(triggered()), this, SLOT(followStackSlot()));
@ -363,6 +381,7 @@ void CPUStack::contextMenuEvent(QContextMenuEvent* event)
else
wMenu->addAction(mFollowDisasm);
wMenu->addAction(mFollowDump);
wMenu->addMenu(mFollowInDumpMenu);
}
wMenu->addSeparator();
@ -490,6 +509,23 @@ void CPUStack::followDumpSlot()
}
}
void CPUStack::followinDumpNSlot()
{
duint selectedData = rvaToVa(getInitialSelection());
if(DbgMemIsValidReadPtr(selectedData))
{
for(int i = 0; i < mFollowInDumpActions.length(); i++)
{
if(mFollowInDumpActions[i] == sender())
{
QString addrText = QString("%1").arg(ToPtrString(selectedData));
DbgCmdExec(QString("dump [%1], %2").arg(addrText.toUtf8().constData()).arg(i).toUtf8().constData());
}
}
}
}
void CPUStack::followStackSlot()
{
duint selectedData;

View File

@ -4,11 +4,14 @@
#include "HexDump.h"
#include "GotoDialog.h"
//forward declaration
class CPUMultiDump;
class CPUStack : public HexDump
{
Q_OBJECT
public:
explicit CPUStack(QWidget* parent = 0);
explicit CPUStack(CPUMultiDump* multiDump, QWidget* parent = 0);
// Configuration
virtual void updateColors();
@ -33,6 +36,7 @@ public slots:
void selectionSet(const SELECTIONDATA* selection);
void followDisasmSlot();
void followDumpSlot();
void followinDumpNSlot();
void followStackSlot();
void binaryEditSlot();
void binaryFillSlot();
@ -66,8 +70,11 @@ private:
QAction* mFollowDump;
QAction* mFollowStack;
QMenu* mPluginMenu;
QMenu* mFollowInDumpMenu;
QList<QAction*> mFollowInDumpActions;
GotoDialog* mGoto;
CPUMultiDump* mMultiDump;
};
#endif // CPUSTACK_H

View File

@ -52,7 +52,7 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
mDump = new CPUMultiDump(mDisas, 5, 0); //dump widget
ui->mBotLeftFrameLayout->addWidget(mDump);
mStack = new CPUStack(0); //stack widget
mStack = new CPUStack(mDump,0); //stack widget
ui->mBotRightFrameLayout->addWidget(mStack);
}