From 70b7e16d6cf8c50bf22ec44e9b5cee4047a1c6b5 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Mon, 27 Dec 2021 21:08:18 -0500 Subject: [PATCH 1/2] GDB Stub: properly check for wrong breakpoint type Fix dolphin erroring out on requests to remove access watchpoints. --- Source/Core/Core/PowerPC/GDBStub.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index 530c9cdecb..3aff4b31c2 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -58,6 +58,8 @@ enum class BreakpointType Access, }; +constexpr u32 NUM_BREAKPOINT_TYPES = 4; + const s64 GDB_UPDATE_CYCLES = 100000; static bool s_has_control = false; @@ -857,7 +859,7 @@ static void HandleAddBreakpoint() u32 i, addr = 0, len = 0; type = Hex2char(s_cmd_bfr[1]); - if (type > 4) + if (type > NUM_BREAKPOINT_TYPES) return SendReply("E01"); i = 3; @@ -878,7 +880,7 @@ static void HandleRemoveBreakpoint() u32 type, addr, len, i; type = Hex2char(s_cmd_bfr[1]); - if (type >= 4) + if (type > NUM_BREAKPOINT_TYPES) return SendReply("E01"); addr = 0; From 9c784ca8ab47e564b3a60ac9d5a10ff361197c2e Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Mon, 27 Dec 2021 21:08:51 -0500 Subject: [PATCH 2/2] GDB Stub: correctly define the breakpoint type values Read only and Write only were reversed, now they are properly defined. --- Source/Core/Core/PowerPC/GDBStub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index 3aff4b31c2..9af312c6fa 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -53,8 +53,8 @@ enum class BreakpointType { ExecuteSoft = 0, ExecuteHard, - Read, Write, + Read, Access, };