From 792cf4673d60887b2ecbc217941c128988cc536f Mon Sep 17 00:00:00 2001 From: PugsyMAME <18102600+PugsyMAME@users.noreply.github.com> Date: Sun, 15 Sep 2024 07:17:08 +0100 Subject: [PATCH] Quality of Life changes to breakpoints (#3297) 1. Made it so that breakpoints are checked for a match on 28 bits rather than the full 32 bits. It's much simpler to use 12345 rather than 80012345 and risk getting the number of zeros wrong and also handles the mirror code/memory accesses using 00??????, 80?????? & A0??????. 2. Added bp.hit_count update to execution breakpoints. 3. Changed the Hit breakpoint message at the bottom of the debugger screen to include the hit count [see notes later]. 4. Added bp.enabled check to the execution breakpoint (it uses it in the r/w breakpoints code already) [see notes later]. Notes: 3. I've added the hit count to the message as it's quicker to spot but it's also a partial workaround as the Hit Count in the Breakpoints tab doesn't seem to get refreshed. 4. I thought the checkbox in the Breakpoints tab would set the bp.enabled but it seems it has no affect on any type of breakpoint. The only way to stop a breakpoint is to delete it. --- src/core/cpu_core.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index ca1c5b590..4c0152bc6 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -2113,10 +2113,13 @@ const char* CPU::GetBreakpointTypeName(BreakpointType type) bool CPU::HasBreakpointAtAddress(BreakpointType type, VirtualMemoryAddress address) { - for (const Breakpoint& bp : GetBreakpointList(type)) + for (Breakpoint& bp : GetBreakpointList(type)) { - if (bp.address == address) + if (bp.enabled && (bp.address & 0x0FFFFFFFu) == (address & 0x0FFFFFFFu)) + { + bp.hit_count++; return true; + } } return false; @@ -2283,7 +2286,7 @@ ALWAYS_INLINE_RELEASE bool CPU::CheckBreakpointList(BreakpointType type, Virtual for (size_t i = 0; i < count;) { Breakpoint& bp = bplist[i]; - if (!bp.enabled || bp.address != address) + if (!bp.enabled || (bp.address & 0x0FFFFFFFu) != (address & 0x0FFFFFFFu)) { i++; continue; @@ -2321,7 +2324,7 @@ ALWAYS_INLINE_RELEASE bool CPU::CheckBreakpointList(BreakpointType type, Virtual else { Host::ReportDebuggerMessage( - fmt::format("Hit {} breakpoint {} at 0x{:08X}.", GetBreakpointTypeName(type), bp.number, address)); + fmt::format("Hit {} breakpoint {} at 0x{:08X}, Hit Count {}.", GetBreakpointTypeName(type), bp.number, address, bp.hit_count)); i++; }