2018-12-21 20:36:40 +00:00
|
|
|
#include "DebugActions.h"
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/MainWindow.h"
|
2018-07-06 07:55:50 +00:00
|
|
|
#include "dialogs/AttachProcDialog.h"
|
2019-12-11 11:26:54 +00:00
|
|
|
#include "dialogs/NativeDebugDialog.h"
|
2019-12-07 14:15:09 +00:00
|
|
|
#include "common/Configuration.h"
|
|
|
|
#include "common/Helpers.h"
|
2018-06-12 08:43:14 +00:00
|
|
|
|
|
|
|
#include <QPainter>
|
2018-06-13 23:02:16 +00:00
|
|
|
#include <QMenu>
|
2018-10-03 11:30:12 +00:00
|
|
|
#include <QList>
|
2018-07-25 08:59:40 +00:00
|
|
|
#include <QFileInfo>
|
2018-12-21 20:36:40 +00:00
|
|
|
#include <QToolBar>
|
2019-02-07 16:19:05 +00:00
|
|
|
#include <QToolButton>
|
2018-06-12 08:43:14 +00:00
|
|
|
|
2018-12-21 20:36:40 +00:00
|
|
|
DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
|
|
|
|
QObject(main),
|
2018-06-12 08:43:14 +00:00
|
|
|
main(main)
|
|
|
|
{
|
2018-12-21 20:36:40 +00:00
|
|
|
setObjectName("DebugActions");
|
|
|
|
// setIconSize(QSize(16, 16));
|
2018-10-03 11:30:12 +00:00
|
|
|
|
|
|
|
// define icons
|
2018-07-01 21:29:38 +00:00
|
|
|
QIcon startEmulIcon = QIcon(":/img/icons/play_light_emul.svg");
|
|
|
|
QIcon startAttachIcon = QIcon(":/img/icons/play_light_attach.svg");
|
2019-11-20 08:50:07 +00:00
|
|
|
QIcon startRemoteIcon = QIcon(":/img/icons/play_light_remote.svg");
|
2019-12-07 13:28:05 +00:00
|
|
|
stopIcon = QIcon(":/img/icons/media-stop_light.svg");
|
2019-12-11 11:26:54 +00:00
|
|
|
restartIcon = QIcon(":/img/icons/spin_light.svg");
|
2019-12-07 13:28:05 +00:00
|
|
|
detachIcon = QIcon(":/img/icons/detach_debugger.svg");
|
2019-12-11 11:26:54 +00:00
|
|
|
startDebugIcon = QIcon(":/img/icons/play_light_debug.svg");
|
2019-10-31 09:50:08 +00:00
|
|
|
continueIcon = QIcon(":/img/icons/media-skip-forward_light.svg");
|
|
|
|
suspendIcon = QIcon(":/img/icons/media-suspend_light.svg");
|
2018-06-12 08:43:14 +00:00
|
|
|
|
2018-10-04 06:15:27 +00:00
|
|
|
// define action labels
|
|
|
|
QString startEmulLabel = tr("Start emulation");
|
|
|
|
QString startAttachLabel = tr("Attach to process");
|
2019-11-20 08:50:07 +00:00
|
|
|
QString startRemoteLabel = tr("Connect to a remote debugger");
|
2018-10-04 06:15:27 +00:00
|
|
|
QString stopDebugLabel = tr("Stop debug");
|
|
|
|
QString stopEmulLabel = tr("Stop emulation");
|
|
|
|
QString restartEmulLabel = tr("Restart emulation");
|
|
|
|
QString continueUMLabel = tr("Continue until main");
|
|
|
|
QString continueUCLabel = tr("Continue until call");
|
|
|
|
QString continueUSLabel = tr("Continue until syscall");
|
|
|
|
QString stepLabel = tr("Step");
|
|
|
|
QString stepOverLabel = tr("Step over");
|
|
|
|
QString stepOutLabel = tr("Step out");
|
2019-12-11 11:26:54 +00:00
|
|
|
suspendLabel = tr("Suspend the process");
|
2019-10-31 09:50:08 +00:00
|
|
|
continueLabel = tr("Continue");
|
2019-12-11 11:26:54 +00:00
|
|
|
restartDebugLabel = tr("Restart program");
|
|
|
|
startDebugLabel = tr("Start debug");
|
2018-10-04 06:15:27 +00:00
|
|
|
|
2018-10-03 11:30:12 +00:00
|
|
|
// define actions
|
2018-12-21 20:36:40 +00:00
|
|
|
actionStart = new QAction(startDebugIcon, startDebugLabel, this);
|
2018-07-17 07:26:20 +00:00
|
|
|
actionStart->setShortcut(QKeySequence(Qt::Key_F9));
|
2018-12-21 20:36:40 +00:00
|
|
|
actionStartEmul = new QAction(startEmulIcon, startEmulLabel, this);
|
|
|
|
actionAttach = new QAction(startAttachIcon, startAttachLabel, this);
|
2019-11-20 08:50:07 +00:00
|
|
|
actionStartRemote = new QAction(startRemoteIcon, startRemoteLabel, this);
|
2018-12-21 20:36:40 +00:00
|
|
|
actionStop = new QAction(stopIcon, stopDebugLabel, this);
|
|
|
|
actionContinue = new QAction(continueIcon, continueLabel, this);
|
2018-07-17 07:26:20 +00:00
|
|
|
actionContinue->setShortcut(QKeySequence(Qt::Key_F5));
|
2019-12-07 14:15:09 +00:00
|
|
|
actionContinueUntilMain = new QAction(continueUMLabel, this);
|
|
|
|
actionContinueUntilCall = new QAction(continueUCLabel, this);
|
|
|
|
actionContinueUntilSyscall = new QAction(continueUSLabel, this);
|
|
|
|
actionStep = new QAction(stepLabel, this);
|
2018-07-17 07:26:20 +00:00
|
|
|
actionStep->setShortcut(QKeySequence(Qt::Key_F7));
|
2019-12-07 14:15:09 +00:00
|
|
|
actionStepOver = new QAction(stepOverLabel, this);
|
2018-07-17 07:26:20 +00:00
|
|
|
actionStepOver->setShortcut(QKeySequence(Qt::Key_F8));
|
2019-12-07 14:15:09 +00:00
|
|
|
actionStepOut = new QAction(stepOutLabel, this);
|
2018-07-30 06:55:39 +00:00
|
|
|
actionStepOut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F8));
|
2018-06-13 23:02:16 +00:00
|
|
|
|
2018-07-01 21:29:38 +00:00
|
|
|
QToolButton *startButton = new QToolButton;
|
|
|
|
startButton->setPopupMode(QToolButton::MenuButtonPopup);
|
|
|
|
connect(startButton, &QToolButton::triggered, startButton, &QToolButton::setDefaultAction);
|
2019-05-26 10:12:23 +00:00
|
|
|
QMenu *startMenu = new QMenu(startButton);
|
2018-10-03 11:30:12 +00:00
|
|
|
|
|
|
|
// only emulation is currently allowed
|
2018-10-03 21:41:52 +00:00
|
|
|
startMenu->addAction(actionStart);
|
2018-10-03 11:30:12 +00:00
|
|
|
startMenu->addAction(actionStartEmul);
|
2018-10-03 21:41:52 +00:00
|
|
|
startMenu->addAction(actionAttach);
|
2019-11-20 08:50:07 +00:00
|
|
|
startMenu->addAction(actionStartRemote);
|
2018-10-03 21:41:52 +00:00
|
|
|
startButton->setDefaultAction(actionStart);
|
2018-07-01 21:29:38 +00:00
|
|
|
startButton->setMenu(startMenu);
|
|
|
|
|
2019-01-12 23:36:23 +00:00
|
|
|
continueUntilButton = new QToolButton;
|
2018-06-13 23:02:16 +00:00
|
|
|
continueUntilButton->setPopupMode(QToolButton::MenuButtonPopup);
|
2018-09-30 20:00:53 +00:00
|
|
|
connect(continueUntilButton, &QToolButton::triggered, continueUntilButton,
|
|
|
|
&QToolButton::setDefaultAction);
|
2019-05-26 10:12:23 +00:00
|
|
|
QMenu *continueUntilMenu = new QMenu(continueUntilButton);
|
2018-06-13 23:02:16 +00:00
|
|
|
continueUntilMenu->addAction(actionContinueUntilMain);
|
|
|
|
continueUntilMenu->addAction(actionContinueUntilCall);
|
|
|
|
continueUntilMenu->addAction(actionContinueUntilSyscall);
|
|
|
|
continueUntilButton->setMenu(continueUntilMenu);
|
|
|
|
continueUntilButton->setDefaultAction(actionContinueUntilMain);
|
|
|
|
|
2018-10-03 11:30:12 +00:00
|
|
|
// define toolbar widgets and actions
|
2018-12-21 20:36:40 +00:00
|
|
|
toolBar->addWidget(startButton);
|
|
|
|
toolBar->addAction(actionContinue);
|
|
|
|
toolBar->addAction(actionStop);
|
|
|
|
actionAllContinues = toolBar->addWidget(continueUntilButton);
|
|
|
|
toolBar->addAction(actionStepOver);
|
2019-12-07 13:28:05 +00:00
|
|
|
toolBar->addAction(actionStep);
|
2018-12-21 20:36:40 +00:00
|
|
|
toolBar->addAction(actionStepOut);
|
2018-06-12 08:43:14 +00:00
|
|
|
|
2018-10-03 11:30:12 +00:00
|
|
|
allActions = {actionStop, actionAllContinues, actionContinue, actionContinueUntilCall, actionContinueUntilMain, actionContinueUntilSyscall, actionStep, actionStepOut, actionStepOver};
|
|
|
|
// hide allactions
|
|
|
|
setAllActionsVisible(false);
|
|
|
|
|
2019-10-31 09:50:08 +00:00
|
|
|
// Toggle all buttons except restart, suspend(=continue) and stop since those are
|
|
|
|
// necessary to avoid staying stuck
|
2019-12-07 14:15:09 +00:00
|
|
|
toggleActions = {actionStepOver, actionStep, actionStepOut, actionContinueUntilMain,
|
2019-10-31 09:50:08 +00:00
|
|
|
actionContinueUntilCall, actionContinueUntilSyscall};
|
2019-12-13 18:43:50 +00:00
|
|
|
toggleConnectionActions = {actionAttach, actionStartRemote};
|
2019-10-31 09:50:08 +00:00
|
|
|
|
2019-12-20 15:41:48 +00:00
|
|
|
connect(Core(), &CutterCore::debugProcessFinished, this, [ = ](int pid) {
|
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("Debugged process exited (") + QString::number(pid) + ")");
|
|
|
|
msgBox.exec();
|
|
|
|
});
|
|
|
|
|
2019-10-31 09:50:08 +00:00
|
|
|
connect(Core(), &CutterCore::debugTaskStateChanged, this, [ = ]() {
|
2019-11-20 08:50:07 +00:00
|
|
|
bool disableToolbar = Core()->isDebugTaskInProgress();
|
|
|
|
if (Core()->currentlyDebugging) {
|
|
|
|
for (QAction *a : toggleActions) {
|
|
|
|
a->setDisabled(disableToolbar);
|
|
|
|
}
|
|
|
|
// Suspend should only be available when other icons are disabled
|
|
|
|
if (disableToolbar) {
|
|
|
|
actionContinue->setText(suspendLabel);
|
|
|
|
actionContinue->setIcon(suspendIcon);
|
|
|
|
} else {
|
|
|
|
actionContinue->setText(continueLabel);
|
|
|
|
actionContinue->setIcon(continueIcon);
|
|
|
|
}
|
2019-10-31 09:50:08 +00:00
|
|
|
} else {
|
2019-11-20 08:50:07 +00:00
|
|
|
for (QAction *a : toggleConnectionActions) {
|
|
|
|
a->setDisabled(disableToolbar);
|
|
|
|
}
|
2019-10-31 09:50:08 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-17 07:26:20 +00:00
|
|
|
connect(actionStop, &QAction::triggered, Core(), &CutterCore::stopDebug);
|
2018-09-30 20:00:53 +00:00
|
|
|
connect(actionStop, &QAction::triggered, [ = ]() {
|
2018-07-17 07:26:20 +00:00
|
|
|
actionStart->setVisible(true);
|
|
|
|
actionStartEmul->setVisible(true);
|
|
|
|
actionAttach->setVisible(true);
|
2019-11-20 08:50:07 +00:00
|
|
|
actionStartRemote->setVisible(true);
|
2018-10-04 06:15:27 +00:00
|
|
|
actionStop->setText(stopDebugLabel);
|
2019-12-07 13:28:05 +00:00
|
|
|
actionStop->setIcon(stopIcon);
|
2018-10-04 06:15:27 +00:00
|
|
|
actionStart->setText(startDebugLabel);
|
2018-10-03 11:30:12 +00:00
|
|
|
actionStart->setIcon(startDebugIcon);
|
2018-10-04 06:15:27 +00:00
|
|
|
actionStartEmul->setText(startEmulLabel);
|
2018-10-03 11:30:12 +00:00
|
|
|
actionStartEmul->setIcon(startEmulIcon);
|
2019-01-12 23:36:23 +00:00
|
|
|
continueUntilButton->setDefaultAction(actionContinueUntilMain);
|
2018-10-03 11:30:12 +00:00
|
|
|
setAllActionsVisible(false);
|
2018-07-17 07:26:20 +00:00
|
|
|
});
|
|
|
|
connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug);
|
2019-12-11 11:26:54 +00:00
|
|
|
connect(actionStart, &QAction::triggered, this, &DebugActions::startDebug);
|
2018-10-03 11:30:12 +00:00
|
|
|
|
2018-12-21 20:36:40 +00:00
|
|
|
connect(actionAttach, &QAction::triggered, this, &DebugActions::attachProcessDialog);
|
2019-11-20 08:50:07 +00:00
|
|
|
connect(actionStartRemote, &QAction::triggered, this, &DebugActions::attachRemoteDialog);
|
|
|
|
connect(Core(), &CutterCore::attachedRemote, this, &DebugActions::onAttachedRemoteDebugger);
|
2018-07-17 07:26:20 +00:00
|
|
|
connect(actionStartEmul, &QAction::triggered, Core(), &CutterCore::startEmulation);
|
2018-09-30 20:00:53 +00:00
|
|
|
connect(actionStartEmul, &QAction::triggered, [ = ]() {
|
2018-10-03 11:30:12 +00:00
|
|
|
setAllActionsVisible(true);
|
2018-07-17 07:26:20 +00:00
|
|
|
actionStart->setVisible(false);
|
|
|
|
actionAttach->setVisible(false);
|
2019-11-20 08:50:07 +00:00
|
|
|
actionStartRemote->setVisible(false);
|
2018-07-17 07:26:20 +00:00
|
|
|
actionContinueUntilMain->setVisible(false);
|
2018-07-30 06:55:39 +00:00
|
|
|
actionStepOut->setVisible(false);
|
2018-07-17 07:26:20 +00:00
|
|
|
continueUntilButton->setDefaultAction(actionContinueUntilSyscall);
|
2018-10-04 06:15:27 +00:00
|
|
|
actionStartEmul->setText(restartEmulLabel);
|
2018-10-03 11:30:12 +00:00
|
|
|
actionStartEmul->setIcon(restartIcon);
|
2018-10-04 06:15:27 +00:00
|
|
|
actionStop->setText(stopEmulLabel);
|
2018-07-17 07:26:20 +00:00
|
|
|
});
|
|
|
|
connect(actionStepOver, &QAction::triggered, Core(), &CutterCore::stepOverDebug);
|
2018-07-30 06:55:39 +00:00
|
|
|
connect(actionStepOut, &QAction::triggered, Core(), &CutterCore::stepOutDebug);
|
2018-12-21 20:36:40 +00:00
|
|
|
connect(actionContinueUntilMain, &QAction::triggered, this, &DebugActions::continueUntilMain);
|
2018-06-13 23:02:16 +00:00
|
|
|
connect(actionContinueUntilCall, &QAction::triggered, Core(), &CutterCore::continueUntilCall);
|
2018-07-17 07:26:20 +00:00
|
|
|
connect(actionContinueUntilSyscall, &QAction::triggered, Core(), &CutterCore::continueUntilSyscall);
|
2019-10-31 09:50:08 +00:00
|
|
|
connect(actionContinue, &QAction::triggered, Core(), [=]() {
|
|
|
|
// Switch between continue and suspend depending on the debugger's state
|
|
|
|
if (Core()->isDebugTaskInProgress()) {
|
|
|
|
Core()->suspendDebug();
|
|
|
|
} else {
|
|
|
|
Core()->continueDebug();
|
|
|
|
}
|
|
|
|
});
|
2019-12-07 14:15:09 +00:00
|
|
|
|
|
|
|
connect(Config(), &Configuration::interfaceThemeChanged, this, &DebugActions::chooseThemeIcons);
|
|
|
|
chooseThemeIcons();
|
2018-06-12 08:43:14 +00:00
|
|
|
}
|
|
|
|
|
2019-01-12 23:36:23 +00:00
|
|
|
void DebugActions::setButtonVisibleIfMainExists()
|
|
|
|
{
|
2019-01-15 21:37:02 +00:00
|
|
|
int mainExists = Core()->cmd("f?sym.main; ??").toInt();
|
2019-01-12 23:36:23 +00:00
|
|
|
// if main is not a flag we hide the continue until main button
|
|
|
|
if (!mainExists) {
|
|
|
|
actionContinueUntilMain->setVisible(false);
|
|
|
|
continueUntilButton->setDefaultAction(actionContinueUntilCall);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-11 11:26:54 +00:00
|
|
|
void DebugActions::showDebugWarning()
|
|
|
|
{
|
|
|
|
if (!acceptedDebugWarning) {
|
|
|
|
acceptedDebugWarning = true;
|
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
|
|
|
|
msgBox.setText(tr("Debug is currently in beta.\n") +
|
|
|
|
tr("If you encounter any problems or have suggestions, please submit an issue to https://github.com/radareorg/cutter/issues"));
|
|
|
|
msgBox.exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:36:40 +00:00
|
|
|
void DebugActions::continueUntilMain()
|
2018-06-12 08:43:14 +00:00
|
|
|
{
|
2019-01-15 21:37:02 +00:00
|
|
|
QString mainAddr = Core()->cmd("?v sym.main");
|
|
|
|
Core()->continueUntilDebug(mainAddr);
|
2018-07-01 21:29:38 +00:00
|
|
|
}
|
|
|
|
|
2019-11-20 08:50:07 +00:00
|
|
|
void DebugActions::attachRemoteDebugger()
|
|
|
|
{
|
|
|
|
QString stopAttachLabel = tr("Detach from process");
|
|
|
|
// Hide unwanted buttons
|
|
|
|
setAllActionsVisible(true);
|
|
|
|
actionStart->setVisible(false);
|
|
|
|
actionStartRemote->setVisible(false);
|
|
|
|
actionStartEmul->setVisible(false);
|
|
|
|
actionStop->setText(stopAttachLabel);
|
|
|
|
}
|
|
|
|
|
2019-12-11 11:26:54 +00:00
|
|
|
void DebugActions::onAttachedRemoteDebugger(bool successfully)
|
|
|
|
{
|
2019-11-20 08:50:07 +00:00
|
|
|
if (!successfully) {
|
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("Error connecting."));
|
|
|
|
msgBox.exec();
|
|
|
|
attachRemoteDialog();
|
|
|
|
} else {
|
|
|
|
delete remoteDialog;
|
2019-12-20 12:20:41 +00:00
|
|
|
remoteDialog = nullptr;
|
2019-11-20 08:50:07 +00:00
|
|
|
attachRemoteDebugger();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugActions::attachRemoteDialog()
|
|
|
|
{
|
2019-12-11 11:26:54 +00:00
|
|
|
showDebugWarning();
|
|
|
|
|
2019-11-20 08:50:07 +00:00
|
|
|
if (!remoteDialog) {
|
|
|
|
remoteDialog = new RemoteDebugDialog(main);
|
|
|
|
}
|
|
|
|
QMessageBox msgBox;
|
|
|
|
bool success = false;
|
|
|
|
while (!success) {
|
|
|
|
success = true;
|
|
|
|
if (remoteDialog->exec()) {
|
|
|
|
if (!remoteDialog->validate()) {
|
|
|
|
success = false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
Core()->attachRemote(remoteDialog->getUri());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:36:40 +00:00
|
|
|
void DebugActions::attachProcessDialog()
|
2018-07-01 21:29:38 +00:00
|
|
|
{
|
2019-12-11 11:26:54 +00:00
|
|
|
showDebugWarning();
|
|
|
|
|
2019-03-23 06:32:31 +00:00
|
|
|
AttachProcDialog dialog(main);
|
2018-07-31 17:16:05 +00:00
|
|
|
bool success = false;
|
|
|
|
while (!success) {
|
|
|
|
success = true;
|
2019-03-23 06:32:31 +00:00
|
|
|
if (dialog.exec()) {
|
|
|
|
int pid = dialog.getPID();
|
2018-07-31 17:16:05 +00:00
|
|
|
if (pid >= 0) {
|
|
|
|
attachProcess(pid);
|
|
|
|
} else {
|
|
|
|
success = false;
|
|
|
|
QMessageBox msgBox;
|
2018-10-04 06:15:27 +00:00
|
|
|
msgBox.setText(tr("Error attaching. No process selected!"));
|
2018-07-31 17:16:05 +00:00
|
|
|
msgBox.exec();
|
|
|
|
}
|
|
|
|
}
|
2018-07-01 21:29:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:36:40 +00:00
|
|
|
void DebugActions::attachProcess(int pid)
|
2018-07-01 21:29:38 +00:00
|
|
|
{
|
2018-10-04 06:15:27 +00:00
|
|
|
QString stopAttachLabel = tr("Detach from process");
|
2018-07-01 21:29:38 +00:00
|
|
|
// hide unwanted buttons
|
2018-10-03 11:30:12 +00:00
|
|
|
setAllActionsVisible(true);
|
2018-07-31 17:16:05 +00:00
|
|
|
actionStart->setVisible(false);
|
2019-11-20 08:50:07 +00:00
|
|
|
actionStartRemote->setVisible(false);
|
2018-07-31 17:16:05 +00:00
|
|
|
actionStartEmul->setVisible(false);
|
2018-10-04 06:15:27 +00:00
|
|
|
actionStop->setText(stopAttachLabel);
|
2019-12-07 13:28:05 +00:00
|
|
|
actionStop->setIcon(detachIcon);
|
2018-07-01 21:29:38 +00:00
|
|
|
// attach
|
|
|
|
Core()->attachDebug(pid);
|
2018-10-03 11:30:12 +00:00
|
|
|
}
|
|
|
|
|
2019-12-11 11:26:54 +00:00
|
|
|
void DebugActions::startDebug()
|
|
|
|
{
|
|
|
|
// check if file is executable before starting debug
|
|
|
|
QString filename = Core()->getConfig("file.path").section(QLatin1Char(' '), 0, 0);
|
|
|
|
|
|
|
|
QFileInfo info(filename);
|
|
|
|
if (!Core()->currentlyDebugging && !info.isExecutable()) {
|
|
|
|
QMessageBox msgBox;
|
|
|
|
msgBox.setText(tr("File '%1' does not have executable permissions.").arg(filename));
|
|
|
|
msgBox.exec();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
showDebugWarning();
|
|
|
|
|
|
|
|
NativeDebugDialog dialog(main);
|
|
|
|
dialog.setArgs(Core()->getConfig("dbg.args"));
|
|
|
|
QString args;
|
|
|
|
if (dialog.exec()) {
|
|
|
|
args = dialog.getArgs();
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update dbg.args with the new args
|
|
|
|
Core()->setConfig("dbg.args", args);
|
|
|
|
|
|
|
|
setAllActionsVisible(true);
|
|
|
|
actionAttach->setVisible(false);
|
|
|
|
actionStartRemote->setVisible(false);
|
|
|
|
actionStartEmul->setVisible(false);
|
|
|
|
actionStart->setText(restartDebugLabel);
|
|
|
|
actionStart->setIcon(restartIcon);
|
|
|
|
setButtonVisibleIfMainExists();
|
|
|
|
|
|
|
|
Core()->startDebug();
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:36:40 +00:00
|
|
|
void DebugActions::setAllActionsVisible(bool visible)
|
2018-10-03 11:30:12 +00:00
|
|
|
{
|
|
|
|
for (QAction *action : allActions) {
|
|
|
|
action->setVisible(visible);
|
|
|
|
}
|
2018-10-04 13:37:12 +00:00
|
|
|
}
|
2019-12-07 14:15:09 +00:00
|
|
|
|
|
|
|
/**
|
2019-12-08 07:19:58 +00:00
|
|
|
* @brief When theme changed, change icons which have a special version for the theme.
|
2019-12-07 14:15:09 +00:00
|
|
|
*/
|
|
|
|
void DebugActions::chooseThemeIcons()
|
|
|
|
{
|
|
|
|
// List of QActions which have alternative icons in different themes
|
|
|
|
const QList<QPair<void*, QString>> kSupportedIconsNames {
|
|
|
|
{ actionStep, QStringLiteral("step_into.svg") },
|
|
|
|
{ actionStepOver, QStringLiteral("step_over.svg") },
|
|
|
|
{ actionStepOut, QStringLiteral("step_out.svg") },
|
|
|
|
{ actionContinueUntilMain, QStringLiteral("continue_until_main.svg") },
|
|
|
|
{ actionContinueUntilCall, QStringLiteral("continue_until_call.svg") },
|
|
|
|
{ actionContinueUntilSyscall, QStringLiteral("continue_until_syscall.svg") },
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Set the correct icon for the QAction
|
|
|
|
qhelpers::setThemeIcons(kSupportedIconsNames, [](void *obj, const QIcon &icon) {
|
|
|
|
static_cast<QAction*>(obj)->setIcon(icon);
|
|
|
|
});
|
2019-12-11 11:26:54 +00:00
|
|
|
}
|