mgorny created this revision. mgorny added reviewers: labath, krytarowski, emaste, jingham. Herald added a subscriber: arichardson. Herald added a project: All. mgorny requested review of this revision.
Move the broadcasting support from GDBRemoteCommunication to GDBRemoteClientBase since this is where it is actually used. Remove GDBRemoteCommunication and subclass constructor arguments left over after Communication cleanup. Sponsored by: The FreeBSD Foundation https://reviews.llvm.org/D133427 Files: lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h
Index: lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h =================================================================== --- lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h +++ lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h @@ -53,8 +53,7 @@ class MockServer : public GDBRemoteCommunicationServer { public: - MockServer() - : GDBRemoteCommunicationServer("mock-server", "mock-server.listener") { + MockServer() : GDBRemoteCommunicationServer() { m_send_acks = false; m_send_error_strings = true; } Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp =================================================================== --- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp +++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp @@ -17,8 +17,7 @@ class TestClient : public GDBRemoteCommunication { public: - TestClient() - : GDBRemoteCommunication("test.client", "test.client.listener") {} + TestClient() : GDBRemoteCommunication() {} PacketResult ReadPacket(StringExtractorGDBRemote &response) { return GDBRemoteCommunication::ReadPacket(response, std::chrono::seconds(1), Index: lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp =================================================================== --- lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp +++ lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp @@ -39,7 +39,7 @@ }; struct TestClient : public GDBRemoteClientBase { - TestClient() : GDBRemoteClientBase("test.client", "test.client.listener") { + TestClient() : GDBRemoteClientBase("test.client") { m_send_acks = false; } }; Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1168,7 +1168,7 @@ ListenerSP listener_sp( Listener::MakeListener("gdb-remote.resume-packet-sent")); if (listener_sp->StartListeningForEvents( - &m_gdb_comm, GDBRemoteCommunication::eBroadcastBitRunPacketSent)) { + &m_gdb_comm, GDBRemoteClientBase::eBroadcastBitRunPacketSent)) { listener_sp->StartListeningForEvents( &m_async_broadcaster, ProcessGDBRemote::eBroadcastBitAsyncThreadDidExit); Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -109,8 +109,7 @@ // GDBRemoteCommunicationServerPlatform constructor GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform( const Socket::SocketProtocol socket_protocol, const char *socket_scheme) - : GDBRemoteCommunicationServerCommon("gdb-remote.server", - "gdb-remote.server.rx_packet"), + : GDBRemoteCommunicationServerCommon(), m_socket_protocol(socket_protocol), m_socket_scheme(socket_scheme), m_spawned_pids_mutex(), m_port_map(), m_port_offset(0) { m_pending_gdb_server.pid = LLDB_INVALID_PROCESS_ID; Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -70,11 +70,9 @@ // GDBRemoteCommunicationServerLLGS constructor GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS( MainLoop &mainloop, const NativeProcessProtocol::Factory &process_factory) - : GDBRemoteCommunicationServerCommon("gdb-remote.server", - "gdb-remote.server.rx_packet"), - m_mainloop(mainloop), m_process_factory(process_factory), - m_current_process(nullptr), m_continue_process(nullptr), - m_stdio_communication() { + : GDBRemoteCommunicationServerCommon(), m_mainloop(mainloop), + m_process_factory(process_factory), m_current_process(nullptr), + m_continue_process(nullptr), m_stdio_communication() { RegisterPacketHandlers(); } Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h @@ -25,8 +25,7 @@ class GDBRemoteCommunicationServerCommon : public GDBRemoteCommunicationServer { public: - GDBRemoteCommunicationServerCommon(const char *comm_name, - const char *listener_name); + GDBRemoteCommunicationServerCommon(); ~GDBRemoteCommunicationServerCommon() override; Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -57,11 +57,9 @@ #endif // GDBRemoteCommunicationServerCommon constructor -GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon( - const char *comm_name, const char *listener_name) - : GDBRemoteCommunicationServer(comm_name, listener_name), - m_process_launch_info(), m_process_launch_error(), m_proc_infos(), - m_proc_infos_index(0) { +GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon() + : GDBRemoteCommunicationServer(), m_process_launch_info(), + m_process_launch_error(), m_proc_infos(), m_proc_infos_index(0) { RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_A, &GDBRemoteCommunicationServerCommon::Handle_A); RegisterMemberFunctionHandler( Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h @@ -31,8 +31,7 @@ std::function<PacketResult(StringExtractorGDBRemote &packet, Status &error, bool &interrupt, bool &quit)>; - GDBRemoteCommunicationServer(const char *comm_name, - const char *listener_name); + GDBRemoteCommunicationServer(); ~GDBRemoteCommunicationServer() override; Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -24,9 +24,8 @@ using namespace lldb_private::process_gdb_remote; using namespace llvm; -GDBRemoteCommunicationServer::GDBRemoteCommunicationServer( - const char *comm_name, const char *listener_name) - : GDBRemoteCommunication(comm_name, listener_name), m_exit_now(false) { +GDBRemoteCommunicationServer::GDBRemoteCommunicationServer() + : GDBRemoteCommunication(), m_exit_now(false) { RegisterPacketHandler( StringExtractorGDBRemote::eServerPacketType_QEnableErrorStrings, [this](StringExtractorGDBRemote packet, Status &error, bool &interrupt, Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -55,7 +55,7 @@ // GDBRemoteCommunicationClient constructor GDBRemoteCommunicationClient::GDBRemoteCommunicationClient() - : GDBRemoteClientBase("gdb-remote.client", "gdb-remote.client.rx_packet"), + : GDBRemoteClientBase("gdb-remote.client"), m_supports_qProcessInfoPID(true), m_supports_qfProcessInfo(true), m_supports_qUserName(true), m_supports_qGroupName(true), Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -80,12 +80,8 @@ class ProcessGDBRemote; -class GDBRemoteCommunication : public Communication, public Broadcaster { +class GDBRemoteCommunication : public Communication { public: - enum { - eBroadcastBitRunPacketSent = (1u << 0), - }; - enum class PacketType { Invalid = 0, Standard, Notify }; enum class PacketResult { @@ -120,7 +116,7 @@ bool m_timeout_modified; }; - GDBRemoteCommunication(const char *comm_name, const char *listener_name); + GDBRemoteCommunication(); ~GDBRemoteCommunication() override; Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -58,9 +58,8 @@ using namespace lldb_private::process_gdb_remote; // GDBRemoteCommunication constructor -GDBRemoteCommunication::GDBRemoteCommunication(const char *comm_name, - const char *listener_name) - : Communication(), Broadcaster(nullptr, comm_name), +GDBRemoteCommunication::GDBRemoteCommunication() + : Communication(), #ifdef LLDB_CONFIGURATION_DEBUG m_packet_timeout(1000), #else Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h @@ -16,8 +16,12 @@ namespace lldb_private { namespace process_gdb_remote { -class GDBRemoteClientBase : public GDBRemoteCommunication { +class GDBRemoteClientBase : public GDBRemoteCommunication, public Broadcaster { public: + enum { + eBroadcastBitRunPacketSent = (1u << 0), + }; + struct ContinueDelegate { virtual ~ContinueDelegate(); virtual void HandleAsyncStdout(llvm::StringRef out) = 0; @@ -31,7 +35,7 @@ virtual void HandleAsyncStructuredDataPacket(llvm::StringRef data) = 0; }; - GDBRemoteClientBase(const char *comm_name, const char *listener_name); + GDBRemoteClientBase(const char *comm_name); bool SendAsyncSignal(int signo, std::chrono::seconds interrupt_timeout); Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -31,10 +31,9 @@ GDBRemoteClientBase::ContinueDelegate::~ContinueDelegate() = default; -GDBRemoteClientBase::GDBRemoteClientBase(const char *comm_name, - const char *listener_name) - : GDBRemoteCommunication(comm_name, listener_name), m_async_count(0), - m_is_running(false), m_should_stop(false) {} +GDBRemoteClientBase::GDBRemoteClientBase(const char *comm_name) + : GDBRemoteCommunication(), Broadcaster(nullptr, comm_name), + m_async_count(0), m_is_running(false), m_should_stop(false) {} StateType GDBRemoteClientBase::SendContinuePacketAndWaitForResponse( ContinueDelegate &delegate, const UnixSignals &signals,
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits