Index: include/lldb/Host/posix/PipePosix.h =================================================================== --- include/lldb/Host/posix/PipePosix.h +++ include/lldb/Host/posix/PipePosix.h @@ -29,6 +29,10 @@ PipePosix(); PipePosix(int read_fd, int write_fd); + PipePosix(const PipePosix &) = delete; + PipePosix(PipePosix &&pipe_posix); + PipePosix &operator=(const PipePosix &) = delete; + PipePosix &operator=(PipePosix &&pipe_posix); ~PipePosix() override; Index: source/Host/posix/PipePosix.cpp =================================================================== --- source/Host/posix/PipePosix.cpp +++ source/Host/posix/PipePosix.cpp @@ -129,11 +129,29 @@ } PipePosix::PipePosix() - : m_fds{PipePosix::kInvalidDescriptor, PipePosix::kInvalidDescriptor} {} + : m_fds{ + PipePosix::kInvalidDescriptor, + PipePosix::kInvalidDescriptor + } {} PipePosix::PipePosix(int read_fd, int write_fd) : m_fds{read_fd, write_fd} {} +PipePosix::PipePosix(PipePosix &&pipe_posix) + : PipeBase{std::move(pipe_posix)}, + m_fds{ + pipe_posix.ReleaseReadFileDescriptor(), + pipe_posix.ReleaseWriteFileDescriptor() + } {} + +PipePosix &PipePosix::operator=(PipePosix &&pipe_posix) +{ + PipeBase::operator=(std::move(pipe_posix)); + m_fds[READ] = pipe_posix.ReleaseReadFileDescriptor(); + m_fds[WRITE] = pipe_posix.ReleaseWriteFileDescriptor(); + return *this; +} + PipePosix::~PipePosix() { Close(); Index: tools/lldb-server/lldb-gdbserver.cpp =================================================================== --- tools/lldb-server/lldb-gdbserver.cpp +++ tools/lldb-server/lldb-gdbserver.cpp @@ -319,7 +319,7 @@ } Error -WritePortToPipe(Pipe port_pipe, const uint16_t port) +WritePortToPipe(Pipe &port_pipe, const uint16_t port) { char port_str[64]; const auto port_str_len = ::snprintf(port_str, sizeof(port_str), "%u", port);