Skip to content
Permalink
Browse files
Merge pull request #10330 from aldelaro5/gdb-stub-add-hostinfo
GDB Stub: add support for lldb's qHostInfo
  • Loading branch information
leoetlino committed Jan 3, 2022
2 parents 953eb49 + d705a5f commit 04a2581
Showing 1 changed file with 14 additions and 0 deletions.
@@ -28,6 +28,7 @@ typedef SSIZE_T ssize_t;
#include "Common/Event.h"
#include "Common/Logging/Log.h"
#include "Common/SocketContext.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "Core/HW/CPU.h"
#include "Core/HW/Memmap.h"
@@ -60,6 +61,9 @@ enum class BreakpointType

constexpr u32 NUM_BREAKPOINT_TYPES = 4;

constexpr int MACH_O_POWERPC = 18;
constexpr int MACH_O_POWERPC_750 = 9;

const s64 GDB_UPDATE_CYCLES = 100000;

static bool s_has_control = false;
@@ -308,6 +312,14 @@ static void SendReply(const char* reply)
}
}

static void WriteHostInfo()
{
return SendReply(
fmt::format("cputype:{};cpusubtype:{};ostype:unknown;vendor:unknown;endian:big;ptrsize:4",
MACH_O_POWERPC, MACH_O_POWERPC_750)
.c_str());
}

static void HandleQuery()
{
DEBUG_LOG_FMT(GDB_STUB, "gdb: query '{}'", CommandBufferAsString());
@@ -322,6 +334,8 @@ static void HandleQuery()
return SendReply("l");
else if (!strncmp((const char*)(s_cmd_bfr), "qThreadExtraInfo", strlen("qThreadExtraInfo")))
return SendReply("00");
else if (!strncmp((const char*)(s_cmd_bfr), "qHostInfo", strlen("qHostInfo")))
return WriteHostInfo();
else if (!strncmp((const char*)(s_cmd_bfr), "qSupported", strlen("qSupported")))
return SendReply("swbreak+;hwbreak+");

0 comments on commit 04a2581

Please sign in to comment.