Merge pull request #10330 from aldelaro5/gdb-stub-add-hostinfo

GDB Stub: add support for lldb's qHostInfo
This commit is contained in:
Léo Lam 2022-01-03 12:43:57 +01:00 committed by GitHub
commit 04a25818b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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+");