Adds step out funcionality (#598)

* Added step out functionality to toolbar and its shortcut
* Remove step out button when emulating
This commit is contained in:
fcasal 2018-07-30 07:55:39 +01:00 committed by xarkes
parent be4144babe
commit 08245a8694
7 changed files with 28 additions and 0 deletions

View File

@ -1028,6 +1028,16 @@ void CutterCore::stepOverDebug()
}
}
void CutterCore::stepOutDebug()
{
if (currentlyDebugging) {
cmd("dsf");
QString programCounterValue = cmd("dr?`drn PC`").trimmed();
seek(programCounterValue);
emit registersChanged();
}
}
QStringList CutterCore::getDebugPlugins()
{
QStringList plugins;

View File

@ -514,6 +514,7 @@ public:
void continueUntilDebug(QString offset);
void stepDebug();
void stepOverDebug();
void stepOutDebug();
void toggleBreakpoint(RVA addr);
void toggleBreakpoint(QString addr);
void delBreakpoint(RVA addr);

View File

@ -138,6 +138,7 @@ void MainWindow::initUI()
ui->menuDebug->addSeparator();
ui->menuDebug->addAction(debugToolbar->actionStep);
ui->menuDebug->addAction(debugToolbar->actionStepOver);
ui->menuDebug->addAction(debugToolbar->actionStepOut);
ui->menuDebug->addSeparator();
// ui->menuDebug->addAction(debugToolbar->actionContinue);
// ui->menuDebug->addAction(debugToolbar->actionContinueUntilCall);

View File

@ -0,0 +1,7 @@
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg style="enable-background:new 0 0 24 32" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="32px" width="24px" version="1.1" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 32">
<g fill="#aaacaf">
<rect width="24" height="4.6"/>
<polygon points="8 14 8 32 16 32 16 14 20 14 12 4.6 4 14"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 452 B

View File

@ -29,6 +29,7 @@
<file>img/icons/continue_until_syscall.svg</file>
<file>img/icons/step_light.svg</file>
<file>img/icons/step_over_light.svg</file>
<file>img/icons/step_out_light.svg</file>
<file>img/icons/cloud.svg</file>
<file>img/icons/down.svg</file>
<file>img/icons/down_white.svg</file>

View File

@ -23,6 +23,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
QIcon continueUntilSyscallIcon = QIcon(":/img/icons/continue_until_syscall.svg");
QIcon stepIcon = QIcon(":/img/icons/step_light.svg");
QIcon stepOverIcon = QIcon(":/img/icons/step_over_light.svg");
QIcon stepOutIcon = QIcon(":/img/icons/step_out_light.svg");
actionStart = new QAction(startDebugIcon, tr("Start debug"), parent);
actionStart->setShortcut(QKeySequence(Qt::Key_F9));
@ -39,6 +40,8 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
actionStep->setShortcut(QKeySequence(Qt::Key_F7));
actionStepOver = new QAction(stepOverIcon, tr("Step over"), parent);
actionStepOver->setShortcut(QKeySequence(Qt::Key_F8));
actionStepOut = new QAction(stepOutIcon, tr("Step out"), parent);
actionStepOut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F8));
QToolButton *startButton = new QToolButton;
startButton->setPopupMode(QToolButton::MenuButtonPopup);
@ -68,6 +71,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
addWidget(continueUntilButton);
addAction(actionStep);
addAction(actionStepOver);
addAction(actionStepOut);
connect(actionStop, &QAction::triggered, Core(), &CutterCore::stopDebug);
connect(actionStop, &QAction::triggered, [ = ]() {
@ -76,6 +80,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
actionStartEmul->setVisible(true);
actionAttach->setVisible(true);
actionContinueUntilMain->setVisible(true);
actionStepOut->setVisible(true);
this->colorToolbar(false);
});
connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug);
@ -100,10 +105,12 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
actionStart->setVisible(false);
actionAttach->setVisible(false);
actionContinueUntilMain->setVisible(false);
actionStepOut->setVisible(false);
continueUntilButton->setDefaultAction(actionContinueUntilSyscall);
this->colorToolbar(true);
});
connect(actionStepOver, &QAction::triggered, Core(), &CutterCore::stepOverDebug);
connect(actionStepOut, &QAction::triggered, Core(), &CutterCore::stepOutDebug);
connect(actionContinue, &QAction::triggered, Core(), &CutterCore::continueDebug);
connect(actionContinueUntilMain, &QAction::triggered, this, &DebugToolbar::continueUntilMain);
connect(actionContinueUntilCall, &QAction::triggered, Core(), &CutterCore::continueUntilCall);

View File

@ -20,6 +20,7 @@ public:
QAction *actionContinueUntilSyscall;
QAction *actionStep;
QAction *actionStepOver;
QAction *actionStepOut;
private:
MainWindow *main;