[Lldb-commits] [lldb] [lldb] Clean up GDBRemoteCommunication::StartDebugserverProcess (PR #145021)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 24 03:55:13 PDT 2025
================
@@ -1084,55 +1052,30 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
if (socket_pipe.CanWrite())
socket_pipe.CloseWriteFileDescriptor();
- if (socket_pipe.CanRead()) {
- // Read port from pipe with 10 second timeout.
- std::string port_str;
- while (error.Success()) {
- char buf[10];
- if (llvm::Expected<size_t> num_bytes =
- socket_pipe.Read(buf, std::size(buf), std::chrono::seconds(10))) {
- if (*num_bytes == 0)
- break;
- port_str.append(buf, *num_bytes);
- } else {
- error = Status::FromError(num_bytes.takeError());
- }
- }
- if (error.Success() && (port != nullptr)) {
- // NB: Deliberately using .c_str() to stop at embedded '\0's
- llvm::StringRef port_ref = port_str.c_str();
- uint16_t child_port = 0;
- // FIXME: improve error handling
- llvm::to_integer(port_ref, child_port);
- if (*port == 0 || *port == child_port) {
- *port = child_port;
- LLDB_LOG(log, "debugserver listens on port {0}", *port);
- } else {
- LLDB_LOG(log,
- "debugserver listening on port {0} but requested port was {1}",
- child_port, (*port));
- }
+ assert(socket_pipe.CanRead());
+
+ // Read port from the pipe -- and ignore it (see comment above).
----------------
labath wrote:
Done.
https://github.com/llvm/llvm-project/pull/145021
More information about the lldb-commits
mailing list