
Previously, we incorrectly handled the disconnect operation if we signal lldb-dap running in server mode. Updated to correctly disconnect the attach vs launch behavior on server shutdown.
34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
//===-- DisconnectRequestHandler.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 "Protocol/ProtocolRequests.h"
|
|
#include "RequestHandler.h"
|
|
#include "llvm/Support/Error.h"
|
|
#include <optional>
|
|
|
|
using namespace llvm;
|
|
using namespace lldb_dap::protocol;
|
|
|
|
namespace lldb_dap {
|
|
|
|
/// Disconnect request; value of command field is 'disconnect'.
|
|
Error DisconnectRequestHandler::Run(
|
|
const std::optional<DisconnectArguments> &arguments) const {
|
|
bool terminateDebuggee = !dap.is_attach;
|
|
|
|
if (arguments && arguments->terminateDebuggee)
|
|
terminateDebuggee = *arguments->terminateDebuggee;
|
|
|
|
if (Error error = dap.Disconnect(terminateDebuggee))
|
|
return error;
|
|
|
|
return Error::success();
|
|
}
|
|
} // namespace lldb_dap
|