Skip to content

Commit

Permalink
Quality of Life changes to breakpoints (#3297)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PugsyMAME committed Sep 15, 2024
1 parent 949f396 commit 792cf46
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core/cpu_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
}

Expand Down

0 comments on commit 792cf46

Please sign in to comment.