diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 9e26339..b9f5cec 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -749,6 +749,20 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () { handleGdbCommand(QString("-target-select core %1").arg(executableCoreFilename())); } +void SeerGdbWidget::handleGdbShutdown () { + + if (isGdbRuning() == false) { + return; + } + + // Give the gdb and 'exit' command. + // This should handle detaching from an attached pid. + handleGdbExit(); + + // Kill the gdb. + killGdb(); +} + void SeerGdbWidget::handleGdbRunToLine (QString fullname, int lineno) { if (executableLaunchMode() == "") { diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index ac4c6cf..6b3eb6e 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -111,6 +111,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void handleGdbAttachExecutable (); void handleGdbConnectExecutable (); void handleGdbCoreFileExecutable (); + void handleGdbShutdown (); void handleGdbRunToLine (QString fullname, int lineno); void handleGdbNext (); void handleGdbStep (); diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index c163c12..b5fe72f 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -106,6 +106,8 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { QObject::connect(runStatus, &SeerRunStatusIndicator::statusChanged, this, &SeerMainWindow::handleRunStatusChanged); + QObject::connect(qApp, &QApplication::aboutToQuit, gdbWidget, &SeerGdbWidget::handleGdbShutdown); + // Restore window settings. readSettings();