llvm-project/lldb/tools/lldb-dap/Handler/InitializeRequestHandler.cpp
John Harrison fff45ddcc0
[lldb-dap] Follow the spec more closely on 'initialize' arguments. (#170350)
Updates `InitializeRequestArguments` to correctly follow the spec, see
https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize.

This should correct which fields are tracked as optional and simplifies
some of the types to make sure they're meaningful (e.g. an
`optional<bool>` isn't anymore helpful than a `bool` since undefined and
false are basically equivalent and it requires us to handle interpreting undefined as the default value in all the places we use the `optional<bool>`).
2025-12-02 14:19:05 -08:00

30 lines
1.0 KiB
C++

//===-- InitializeRequestHandler.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 "CommandPlugins.h"
#include "DAP.h"
#include "EventHelper.h"
#include "JSONUtils.h"
#include "LLDBUtils.h"
#include "Protocol/ProtocolRequests.h"
#include "RequestHandler.h"
#include "lldb/API/SBTarget.h"
using namespace lldb_dap;
using namespace lldb_dap::protocol;
/// Initialize request; value of command field is 'initialize'.
llvm::Expected<InitializeResponse> InitializeRequestHandler::Run(
const InitializeRequestArguments &arguments) const {
// Store initialization arguments for later use in Launch/Attach.
dap.clientFeatures = arguments.supportedFeatures;
dap.sourceInitFile = arguments.lldbExtSourceInitFile;
return dap.GetCapabilities();
}