[lldb-dap] Correct the disconnect helper on server shutdown. (#142508)

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.
This commit is contained in:
John Harrison 2025-06-03 09:40:40 -07:00 committed by GitHub
parent 20ca895860
commit 4d42c8e184
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -102,7 +102,7 @@ class TestDAP_server(lldbdap_testcase.DAPTestCaseBase):
process.send_signal(signal.SIGINT)
self.dap_server.wait_for_terminated()
self.assertIsNone(
self.assertIsNotNone(
self.dap_server.exit_status,
"Process exited before interrupting lldb-dap server",
)

View File

@ -820,7 +820,7 @@ void DAP::SendTerminatedEvent() {
});
}
llvm::Error DAP::Disconnect() { return Disconnect(is_attach); }
llvm::Error DAP::Disconnect() { return Disconnect(!is_attach); }
llvm::Error DAP::Disconnect(bool terminateDebuggee) {
lldb::SBError error;

View File

@ -20,7 +20,7 @@ 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 ? false : true;
bool terminateDebuggee = !dap.is_attach;
if (arguments && arguments->terminateDebuggee)
terminateDebuggee = *arguments->terminateDebuggee;