Run to selection+Breakpoint in call stack view
This commit is contained in:
parent
42f9370076
commit
8235ffe6a2
|
@ -1,4 +1,5 @@
|
|||
#include "CallStackView.h"
|
||||
#include "CommonActions.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
CallStackView::CallStackView(StdTable* parent) : StdTable(parent)
|
||||
|
@ -27,6 +28,10 @@ void CallStackView::setupContextMenu()
|
|||
{
|
||||
return DbgIsDebugging();
|
||||
});
|
||||
mCommonActions = new CommonActions(this, getActionHelperFuncs(), [this]()
|
||||
{
|
||||
return getSelectionVa();
|
||||
});
|
||||
QIcon icon = DIcon(ArchValue("processor32.png", "processor64.png"));
|
||||
mMenuBuilder->addAction(makeAction(icon, tr("Follow &Address"), SLOT(followAddress())), [this](QMenu*)
|
||||
{
|
||||
|
@ -43,6 +48,9 @@ void CallStackView::setupContextMenu()
|
|||
mFollowFrom->setShortcutContext(Qt::WidgetShortcut);
|
||||
mFollowFrom->setShortcut(QKeySequence("enter"));
|
||||
connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followFrom()));
|
||||
// Breakpoint menu
|
||||
// TODO: Is Label/Comment/Bookmark useful?
|
||||
mCommonActions->build(mMenuBuilder, CommonActions::ActionBreakpoint);
|
||||
mMenuBuilder->addSeparator();
|
||||
QAction* wShowSuspectedCallStack = makeAction(tr("Show Suspected Call Stack Frame"), SLOT(showSuspectedCallStack()));
|
||||
mMenuBuilder->addAction(wShowSuspectedCallStack, [wShowSuspectedCallStack](QMenu*)
|
||||
|
@ -130,6 +138,7 @@ void CallStackView::updateCallStack()
|
|||
addrText = ToPtrString(callstack.entries[i].from);
|
||||
setCellContent(currentRow, ColFrom, addrText);
|
||||
}
|
||||
setCellUserdata(currentRow, ColFrom, callstack.entries[i].from);
|
||||
if(i != callstack.total - 1)
|
||||
setCellContent(currentRow, ColSize, ToHexString(callstack.entries[i + 1].addr - callstack.entries[i].addr));
|
||||
else
|
||||
|
@ -202,3 +211,12 @@ bool CallStackView::isSelectionValid()
|
|||
{
|
||||
return getCellContent(getInitialSelection(), ColThread).isEmpty();
|
||||
}
|
||||
|
||||
// For breakpoint/run to selection
|
||||
duint CallStackView::getSelectionVa()
|
||||
{
|
||||
if(isSelectionValid())
|
||||
return getCellUserdata(getInitialSelection(), ColFrom);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define CALLSTACKVIEW_H
|
||||
|
||||
#include "StdTable.h"
|
||||
class CommonActions;
|
||||
|
||||
class CallStackView : public StdTable
|
||||
{
|
||||
|
@ -9,6 +10,7 @@ class CallStackView : public StdTable
|
|||
public:
|
||||
explicit CallStackView(StdTable* parent = 0);
|
||||
void setupContextMenu();
|
||||
duint getSelectionVa();
|
||||
|
||||
protected:
|
||||
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h) override;
|
||||
|
@ -34,6 +36,7 @@ private:
|
|||
};
|
||||
|
||||
MenuBuilder* mMenuBuilder;
|
||||
CommonActions* mCommonActions;
|
||||
bool isSelectionValid();
|
||||
};
|
||||
|
||||
|
|
|
@ -1549,7 +1549,15 @@ void MainWindow::setNameMenu(int hMenu, QString name)
|
|||
void MainWindow::runSelection()
|
||||
{
|
||||
if(DbgIsDebugging())
|
||||
DbgCmdExec(("run " + ToPtrString(mCpuWidget->getSelectionVa())));
|
||||
{
|
||||
duint addr = 0;
|
||||
if(mTabWidget->currentWidget() == mCpuWidget || (mCpuWidget->window() != this && mCpuWidget->isActiveWindow()))
|
||||
addr = mCpuWidget->getSelectionVa();
|
||||
else if(mTabWidget->currentWidget() == mCallStackView || (mCallStackView->window() != this && mCallStackView->isActiveWindow()))
|
||||
addr = mCallStackView->getSelectionVa();
|
||||
if(addr)
|
||||
DbgCmdExec("run " + ToPtrString(addr));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::runExpression()
|
||||
|
|
Loading…
Reference in New Issue