Skip to content

Commit 4d42c8e

Browse files
authored
[lldb-dap] Correct the disconnect helper on server shutdown. (llvm#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.
1 parent 20ca895 commit 4d42c8e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lldb/test/API/tools/lldb-dap/server/TestDAP_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_server_interrupt(self):
102102
process.send_signal(signal.SIGINT)
103103

104104
self.dap_server.wait_for_terminated()
105-
self.assertIsNone(
105+
self.assertIsNotNone(
106106
self.dap_server.exit_status,
107107
"Process exited before interrupting lldb-dap server",
108108
)

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ void DAP::SendTerminatedEvent() {
820820
});
821821
}
822822

823-
llvm::Error DAP::Disconnect() { return Disconnect(is_attach); }
823+
llvm::Error DAP::Disconnect() { return Disconnect(!is_attach); }
824824

825825
llvm::Error DAP::Disconnect(bool terminateDebuggee) {
826826
lldb::SBError error;

lldb/tools/lldb-dap/Handler/DisconnectRequestHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace lldb_dap {
2020
/// Disconnect request; value of command field is 'disconnect'.
2121
Error DisconnectRequestHandler::Run(
2222
const std::optional<DisconnectArguments> &arguments) const {
23-
bool terminateDebuggee = dap.is_attach ? false : true;
23+
bool terminateDebuggee = !dap.is_attach;
2424

2525
if (arguments && arguments->terminateDebuggee)
2626
terminateDebuggee = *arguments->terminateDebuggee;

0 commit comments

Comments
 (0)