Skip to content

Commit f579dcf

Browse files
authored
[lldb] Fixed an invalid error message in the DAP disconnect response (#92345)
The `disconnect` response contains the `error` message with invalid characters (a junk data). To reproduce this issue it is enough to run the `TestDAP_commands` test on Windows host and Linux target. The test will fail to run ELF file on Windows and dap_server will be disconnected unexpectedly. Note dap_server hangs if read_packet() cannot decode JSON with invalid characters. read_packet() must return None in this case instead of an exception. But dap_server does not require any fix after this patch.
1 parent d94582e commit f579dcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/tools/lldb-dap/lldb-dap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object &request) {
977977
g_dap.debugger.SetAsync(false);
978978
lldb::SBError error = terminateDebuggee ? process.Kill() : process.Detach();
979979
if (!error.Success())
980-
response.try_emplace("error", error.GetCString());
980+
EmplaceSafeString(response, "error", error.GetCString());
981981
g_dap.debugger.SetAsync(true);
982982
break;
983983
}

0 commit comments

Comments
 (0)