1//===-- DisconnectRequestHandler.cpp --------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "DAP.h"
10#include "Protocol/ProtocolRequests.h"
11#include "RequestHandler.h"
12#include "llvm/Support/Error.h"
13#include <optional>
14
15using namespace llvm;
16using namespace lldb_dap::protocol;
17
18namespace lldb_dap {
19
20/// Disconnect request; value of command field is 'disconnect'.
21Error DisconnectRequestHandler::Run(
22 const std::optional<DisconnectArguments> &arguments) const {
23 bool terminateDebuggee = !dap.is_attach;
24
25 if (arguments && arguments->terminateDebuggee)
26 terminateDebuggee = *arguments->terminateDebuggee;
27
28 if (Error error = dap.Disconnect(terminateDebuggee))
29 return error;
30
31 return Error::success();
32}
33} // namespace lldb_dap
34

source code of lldb/tools/lldb-dap/Handler/DisconnectRequestHandler.cpp