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.
This commit is contained in:
PugsyMAME 2024-09-15 07:17:08 +01:00 committed by GitHub
parent 949f396e9a
commit 792cf4673d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -2113,10 +2113,13 @@ const char* CPU::GetBreakpointTypeName(BreakpointType type)
bool CPU::HasBreakpointAtAddress(BreakpointType type, VirtualMemoryAddress address) 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 true;
}
} }
return false; return false;
@ -2283,7 +2286,7 @@ ALWAYS_INLINE_RELEASE bool CPU::CheckBreakpointList(BreakpointType type, Virtual
for (size_t i = 0; i < count;) for (size_t i = 0; i < count;)
{ {
Breakpoint& bp = bplist[i]; Breakpoint& bp = bplist[i];
if (!bp.enabled || bp.address != address) if (!bp.enabled || (bp.address & 0x0FFFFFFFu) != (address & 0x0FFFFFFFu))
{ {
i++; i++;
continue; continue;
@ -2321,7 +2324,7 @@ ALWAYS_INLINE_RELEASE bool CPU::CheckBreakpointList(BreakpointType type, Virtual
else else
{ {
Host::ReportDebuggerMessage( 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++; i++;
} }