GDB Stub: properly check for wrong breakpoint type

Fix dolphin erroring out on requests to remove access watchpoints.
This commit is contained in:
aldelaro5 2021-12-27 21:08:18 -05:00
parent c2160578a1
commit 70b7e16d6c
1 changed files with 4 additions and 2 deletions

View File

@ -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;