1 //===-- GDBRemoteTestUtils.h ------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #ifndef lldb_unittests_Process_gdb_remote_GDBRemoteTestUtils_h 10 #define lldb_unittests_Process_gdb_remote_GDBRemoteTestUtils_h 11 12 #include "gtest/gtest.h" 13 14 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h" 15 16 namespace lldb_private { 17 namespace process_gdb_remote { 18 19 class GDBRemoteTest : public testing::Test { 20 public: 21 static void SetUpTestCase(); 22 23 static void TearDownTestCase(); 24 }; 25 26 void Connect(GDBRemoteCommunication &client, GDBRemoteCommunication &server); 27 28 struct MockServer : public GDBRemoteCommunicationServer { 29 MockServer() 30 : GDBRemoteCommunicationServer("mock-server", "mock-server.listener") { 31 m_send_acks = false; 32 } 33 34 PacketResult SendPacket(llvm::StringRef payload) { 35 return GDBRemoteCommunicationServer::SendPacketNoLock(payload); 36 } 37 38 PacketResult GetPacket(StringExtractorGDBRemote &response) { 39 const bool sync_on_timeout = false; 40 return WaitForPacketNoLock(response, std::chrono::seconds(1), 41 sync_on_timeout); 42 } 43 44 using GDBRemoteCommunicationServer::SendOKResponse; 45 using GDBRemoteCommunicationServer::SendUnimplementedResponse; 46 }; 47 48 } // namespace process_gdb_remote 49 } // namespace lldb_private 50 51 #endif // lldb_unittests_Process_gdb_remote_GDBRemoteTestUtils_h 52