forked from qt-creator/qt-creator
DAP: Handle failed "launch" response
On Windows if the application being debugged has missing dlls it will not be able to be started by the debugger. Now the user will be informed that the application failed to start. Change-Id: I0a76a8c6cd122970b00adec371b254adc60915c0 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -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;
|
||||
|
@@ -55,6 +55,7 @@ enum class DapResponseType
|
||||
SetBreakpoints,
|
||||
SetFunctionBreakpoints,
|
||||
Attach,
|
||||
Launch,
|
||||
Unknown
|
||||
};
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user