diff --git a/src/plugins/debugger/dap/dapclient.cpp b/src/plugins/debugger/dap/dapclient.cpp index b67d7ec4754..c7839d55822 100644 --- a/src/plugins/debugger/dap/dapclient.cpp +++ b/src/plugins/debugger/dap/dapclient.cpp @@ -239,6 +239,8 @@ void DapClient::emitSignals(const QJsonDocument &doc) type = DapResponseType::SetFunctionBreakpoints; } else if (command == "attach") { type = DapResponseType::Attach; + } else if (command == "launch") { + type = DapResponseType::Launch; } emit responseReady(type, ob); return; diff --git a/src/plugins/debugger/dap/dapclient.h b/src/plugins/debugger/dap/dapclient.h index f4c3df2ef3a..268e1e1f37f 100644 --- a/src/plugins/debugger/dap/dapclient.h +++ b/src/plugins/debugger/dap/dapclient.h @@ -55,6 +55,7 @@ enum class DapResponseType SetBreakpoints, SetFunctionBreakpoints, Attach, + Launch, Unknown }; diff --git a/src/plugins/debugger/dap/dapengine.cpp b/src/plugins/debugger/dap/dapengine.cpp index e311bb36822..da659921c2e 100644 --- a/src/plugins/debugger/dap/dapengine.cpp +++ b/src/plugins/debugger/dap/dapengine.cpp @@ -645,6 +645,7 @@ void DapEngine::readDapStandardError() void DapEngine::handleResponse(DapResponseType type, const QJsonObject &response) { const QString command = response.value("command").toString(); + const bool success = response.value("success").toBool(); switch (type) { case DapResponseType::Initialize: @@ -675,7 +676,7 @@ void DapEngine::handleResponse(DapResponseType type, const QJsonObject &response case DapResponseType::StepIn: case DapResponseType::StepOut: case DapResponseType::StepOver: - if (response.value("success").toBool()) { + if (success) { showMessage(command, LogDebug); notifyInferiorRunOk(); } else { @@ -692,11 +693,21 @@ void DapEngine::handleResponse(DapResponseType type, const QJsonObject &response case DapResponseType::SetBreakpoints: handleBreakpointResponse(response); break; + case DapResponseType::Launch: + if (!success) { + notifyEngineRunFailed(); + AsynchronousMessageBox::critical( + Tr::tr("Failed to Start Application"), + Tr::tr("\"%1\" could not be started. Error message: %2") + .arg(runParameters().inferior.command.toUserOutput()) + .arg(response.value("message").toString())); + } + break; default: showMessage("UNKNOWN RESPONSE:" + command); }; - if (response.contains("success") && !response.value("success").toBool()) { + if (!success) { showMessage(QString("DAP COMMAND FAILED: %1").arg(command)); qCDebug(logCategory()) << "DAP COMMAND FAILED:" << command; return;