Skip to content

Commit

Permalink
[lldb] Fixed an invalid error message in the DAP disconnect response (l…
Browse files Browse the repository at this point in the history
…lvm#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.
  • Loading branch information
slydiman committed May 16, 2024
1 parent d94582e commit f579dcf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lldb/tools/lldb-dap/lldb-dap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object &request) {
g_dap.debugger.SetAsync(false);
lldb::SBError error = terminateDebuggee ? process.Kill() : process.Detach();
if (!error.Success())
response.try_emplace("error", error.GetCString());
EmplaceSafeString(response, "error", error.GetCString());
g_dap.debugger.SetAsync(true);
break;
}
Expand Down

0 comments on commit f579dcf

Please sign in to comment.