diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 656b4d9c0dc..7f306bb8a59 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -920,6 +920,11 @@ QString DebuggerEngine::stateName(int s) # undef SN } +void DebuggerEngine::notifyExitCode(int code) +{ + d->m_runParameters.exitCode = code; +} + void DebuggerEngine::showStatusMessage(const QString &msg, int timeout) const { showMessage(msg, StatusBar, timeout); diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 50162002fde..59b0c26c059 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -197,6 +197,8 @@ public: Utils::MacroExpander *macroExpander = nullptr; + Utils::optional exitCode = {}; + // For Debugger testing. int testCase = 0; @@ -381,6 +383,7 @@ public: static QString stateName(int s); + void notifyExitCode(int code); void notifyInferiorPid(const Utils::ProcessHandle &pid); qint64 inferiorPid() const; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index d10e13938a6..c350651acf4 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -738,7 +738,8 @@ void DebuggerRunTool::start() } } - appendMessage(tr("Debugging starts"), NormalMessageFormat); + appendMessage(tr("Debugging %1 ...").arg(m_runParameters.inferior.commandLine().toUserOutput()), + NormalMessageFormat); QString debuggerName = m_engine->objectName(); if (m_engine2) debuggerName += ' ' + m_engine2->objectName(); @@ -782,7 +783,12 @@ void DebuggerRunTool::handleEngineFinished(DebuggerEngine *engine) { engine->prepareForRestart(); if (--d->engineStopsNeeded == 0) { - appendMessage(tr("Debugging has finished"), NormalMessageFormat); + QString cmd = m_runParameters.inferior.commandLine().toUserOutput(); + QString msg = engine->runParameters().exitCode // Main engine. + ? tr("Debugging of %1 has finished with exit code %2.") + .arg(cmd).arg(engine->runParameters().exitCode.value()) + : tr("Debugging of %1 has finished.").arg(cmd); + appendMessage(msg, NormalMessageFormat); reportStopped(); } } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 3d5c6c07188..df2d6511aa2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1134,8 +1134,9 @@ void GdbEngine::handleStopResponse(const GdbMi &data) // qDebug() << state()); QString msg; if (reason == "exited") { - msg = tr("Application exited with exit code %1") - .arg(data["exit-code"].toString()); + const int exitCode = data["exit-code"].toInt(); + notifyExitCode(exitCode); + msg = tr("Application exited with exit code %1").arg(exitCode); } else if (reason == "exited-signalled" || reason == "signal-received") { msg = tr("Application exited after receiving signal %1") .arg(data["signal-name"].toString()); @@ -1712,6 +1713,8 @@ void GdbEngine::handleThreadGroupExited(const GdbMi &result) { QString groupId = result["id"].data(); if (threadsHandler()->notifyGroupExited(groupId)) { + const int exitCode = result["exit-code"].toInt(); + notifyExitCode(exitCode); if (m_rerunPending) m_rerunPending = false; else