diff --git a/src/Cutter.cpp b/src/Cutter.cpp index a66f5690..b9c20490 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -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; diff --git a/src/Cutter.h b/src/Cutter.h index 7c52e956..1c90c953 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -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); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8c22c2bd..0c776a5b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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); diff --git a/src/img/icons/step_out_light.svg b/src/img/icons/step_out_light.svg new file mode 100644 index 00000000..80e0e217 --- /dev/null +++ b/src/img/icons/step_out_light.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/resources.qrc b/src/resources.qrc index 37240963..a7a55457 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -29,6 +29,7 @@ img/icons/continue_until_syscall.svg img/icons/step_light.svg img/icons/step_over_light.svg + img/icons/step_out_light.svg img/icons/cloud.svg img/icons/down.svg img/icons/down_white.svg diff --git a/src/widgets/DebugToolbar.cpp b/src/widgets/DebugToolbar.cpp index 040280f5..e881b16c 100644 --- a/src/widgets/DebugToolbar.cpp +++ b/src/widgets/DebugToolbar.cpp @@ -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); diff --git a/src/widgets/DebugToolbar.h b/src/widgets/DebugToolbar.h index 09974b8f..46c5f7ea 100644 --- a/src/widgets/DebugToolbar.h +++ b/src/widgets/DebugToolbar.h @@ -20,6 +20,7 @@ public: QAction *actionContinueUntilSyscall; QAction *actionStep; QAction *actionStepOver; + QAction *actionStepOut; private: MainWindow *main;