[lldb] Remove GDBRemoteCommunication::ConnectLocally (#145293)
Originally added for reproducers, it is now only used for test code. While we could make it a test helper, I think that after #145015 it is simple enough to not be needed. Also squeeze in a change to make ConnectionFileDescriptor accept a unique_ptr<Socket>.
This commit is contained in:
@@ -72,9 +72,11 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
|
||||
OpenCommandPipe();
|
||||
}
|
||||
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(Socket *socket)
|
||||
: Connection(), m_pipe(), m_mutex(), m_shutting_down(false) {
|
||||
InitializeSocket(socket);
|
||||
ConnectionFileDescriptor::ConnectionFileDescriptor(
|
||||
std::unique_ptr<Socket> socket_up)
|
||||
: m_shutting_down(false) {
|
||||
m_uri = socket_up->GetRemoteConnectionURI();
|
||||
m_io_sp = std::move(socket_up);
|
||||
}
|
||||
|
||||
ConnectionFileDescriptor::~ConnectionFileDescriptor() {
|
||||
@@ -796,8 +798,3 @@ ConnectionStatus ConnectionFileDescriptor::ConnectSerialPort(
|
||||
#endif // LLDB_ENABLE_POSIX
|
||||
llvm_unreachable("this function should be only called w/ LLDB_ENABLE_POSIX");
|
||||
}
|
||||
|
||||
void ConnectionFileDescriptor::InitializeSocket(Socket *socket) {
|
||||
m_io_sp.reset(socket);
|
||||
m_uri = socket->GetRemoteConnectionURI();
|
||||
}
|
||||
|
||||
@@ -1128,8 +1128,8 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
|
||||
Socket *accepted_socket = nullptr;
|
||||
error = sock_up->Accept(/*timeout=*/std::nullopt, accepted_socket);
|
||||
if (accepted_socket) {
|
||||
SetConnection(
|
||||
std::make_unique<ConnectionFileDescriptor>(accepted_socket));
|
||||
SetConnection(std::make_unique<ConnectionFileDescriptor>(
|
||||
std::unique_ptr<Socket>(accepted_socket)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,20 +1138,6 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
|
||||
|
||||
void GDBRemoteCommunication::DumpHistory(Stream &strm) { m_history.Dump(strm); }
|
||||
|
||||
llvm::Error
|
||||
GDBRemoteCommunication::ConnectLocally(GDBRemoteCommunication &client,
|
||||
GDBRemoteCommunication &server) {
|
||||
llvm::Expected<Socket::Pair> pair = Socket::CreatePair();
|
||||
if (!pair)
|
||||
return pair.takeError();
|
||||
|
||||
client.SetConnection(
|
||||
std::make_unique<ConnectionFileDescriptor>(pair->first.release()));
|
||||
server.SetConnection(
|
||||
std::make_unique<ConnectionFileDescriptor>(pair->second.release()));
|
||||
return llvm::Error::success();
|
||||
}
|
||||
|
||||
GDBRemoteCommunication::ScopedTimeout::ScopedTimeout(
|
||||
GDBRemoteCommunication &gdb_comm, std::chrono::seconds timeout)
|
||||
: m_gdb_comm(gdb_comm), m_saved_timeout(0), m_timeout_modified(false) {
|
||||
|
||||
@@ -149,9 +149,6 @@ public:
|
||||
|
||||
void DumpHistory(Stream &strm);
|
||||
|
||||
static llvm::Error ConnectLocally(GDBRemoteCommunication &client,
|
||||
GDBRemoteCommunication &server);
|
||||
|
||||
/// Expand GDB run-length encoding.
|
||||
static std::optional<std::string> ExpandRLE(std::string);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user