[lldb] [gdb-remote] Use Communication::WriteAll() over Write()
authorMichał Górny <mgorny@moritz.systems>
Mon, 22 Aug 2022 16:59:08 +0000 (18:59 +0200)
committerMichał Górny <mgorny@moritz.systems>
Tue, 23 Aug 2022 13:49:16 +0000 (15:49 +0200)
commit03b8f79048bfc32ade0404df3d3931266a06dc92
tree2b7be3e8b76ec8c7903201d862ef1350ed9fcd14
parent0c9b32e7dd2d3488156234cfc4278e7119635378
[lldb] [gdb-remote] Use Communication::WriteAll() over Write()

Replace the uses of Communication::Write() with WriteAll() to avoid
partial writes.  None of the call sites actually accounted for that
possibility and even if it is unlikely to actually happen, there doesn't
seem to be any real harm from using WriteAll() instead.

Ideally, we'd remove Write() from the public API.  However, that would
change the API of SBCommunication.  The alternative would be to alias it
to WriteAll().

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D132395
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp