llvm-project/lldb/tools/lldb-dap/Handler/ConfigurationDoneRequestHandler.cpp
Jonas Devlieghere aeeb9a3c09
[lldb-dap] Change the launch sequence (#138219) (reland)
This PR changes how we treat the launch sequence in lldb-dap.

 - Send the initialized event after we finish handling the initialize
   request, rather than after we finish attaching or launching.
 - Delay handling the launch and attach request until we have handled
   the configurationDone request. The latter is now largely a NO-OP and
   only exists to signal lldb-dap that it can handle the launch and
   attach requests.
 - Delay handling the initial threads requests until we have handled
   the launch or attach request.
 - Make all attaching and launching synchronous, including when we have
   attach or launch commands. This removes the need to synchronize
   between the request and event thread.

Background:
https://discourse.llvm.org/t/reliability-of-the-lldb-dap-tests/86125
2025-05-07 16:20:47 -07:00

58 lines
2.0 KiB
C++

//===-- ConfigurationDoneRequestHandler..cpp ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "DAP.h"
#include "EventHelper.h"
#include "JSONUtils.h"
#include "RequestHandler.h"
namespace lldb_dap {
// "ConfigurationDoneRequest": {
// "allOf": [ { "$ref": "#/definitions/Request" }, {
// "type": "object",
// "description": "ConfigurationDone request; value of command field
// is 'configurationDone'.\nThe client of the debug protocol must
// send this request at the end of the sequence of configuration
// requests (which was started by the InitializedEvent).",
// "properties": {
// "command": {
// "type": "string",
// "enum": [ "configurationDone" ]
// },
// "arguments": {
// "$ref": "#/definitions/ConfigurationDoneArguments"
// }
// },
// "required": [ "command" ]
// }]
// },
// "ConfigurationDoneArguments": {
// "type": "object",
// "description": "Arguments for 'configurationDone' request.\nThe
// configurationDone request has no standardized attributes."
// },
// "ConfigurationDoneResponse": {
// "allOf": [ { "$ref": "#/definitions/Response" }, {
// "type": "object",
// "description": "Response to 'configurationDone' request. This is
// just an acknowledgement, so no body field is required."
// }]
// },
void ConfigurationDoneRequestHandler::operator()(
const llvm::json::Object &request) const {
dap.SetConfigurationDone();
llvm::json::Object response;
FillResponse(request, response);
dap.SendJSON(llvm::json::Value(std::move(response)));
}
} // namespace lldb_dap