#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
#include "GDBRemoteTestUtils.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/XML.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Testing/Support/Error.h"
#include "gmock/gmock.h"
#include <future>
#include <limits>
#include <optional>
usingnamespacelldb_private::process_gdb_remote;
usingnamespacelldb_private;
usingnamespacelldb;
usingnamespacellvm;
namespace {
PacketResult;
struct TestClient : public GDBRemoteCommunicationClient { … };
void Handle_QThreadSuffixSupported(MockServer &server, bool supported) { … }
void HandlePacket(MockServer &server,
const testing::Matcher<const std::string &> &expected,
StringRef response) { … }
uint8_t all_registers[] = …;
std::string all_registers_hex = …;
uint8_t one_register[] = …;
std::string one_register_hex = …;
}
class GDBRemoteCommunicationClientTest : public GDBRemoteTest { … };
TEST_F(GDBRemoteCommunicationClientTest, WriteRegister) { … }
TEST_F(GDBRemoteCommunicationClientTest, WriteRegisterNoSuffix) { … }
TEST_F(GDBRemoteCommunicationClientTest, ReadRegister) { … }
TEST_F(GDBRemoteCommunicationClientTest, SaveRestoreRegistersNoSuffix) { … }
TEST_F(GDBRemoteCommunicationClientTest, SyncThreadState) { … }
TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) { … }
TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) { … }
TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) { … }
TEST_F(GDBRemoteCommunicationClientTest, TestPacketSpeedJSON) { … }
TEST_F(GDBRemoteCommunicationClientTest, SendSignalsToIgnore) { … }
TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) { … }
TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) { … }
TEST_F(GDBRemoteCommunicationClientTest, SendTraceSupportedPacket) { … }
TEST_F(GDBRemoteCommunicationClientTest, GetQOffsets) { … }
static void
check_qmemtags(TestClient &client, MockServer &server, size_t read_len,
int32_t type, const char *packet, llvm::StringRef response,
std::optional<std::vector<uint8_t>> expected_tag_data) { … }
TEST_F(GDBRemoteCommunicationClientTest, ReadMemoryTags) { … }
static void check_Qmemtags(TestClient &client, MockServer &server,
lldb::addr_t addr, size_t len, int32_t type,
const std::vector<uint8_t> &tags, const char *packet,
llvm::StringRef response, bool should_succeed) { … }
TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) { … }
#if !defined(_MSC_VER) || _MSC_VER >= 1932
TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) { … }
#endif