From cd413ab6596484c855a6a3c4739f6d9698c5ea1e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 8 Aug 2014 08:53:44 -0700 Subject: [PATCH] Correctly break when disabled and temp bps overlap. Only affects debugging, not usual gameplay. Fixes #6700. --- Core/Debugger/Breakpoints.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index a27711bdaa..5f2683df83 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -102,13 +102,21 @@ void MemCheck::JitCleanup() size_t CBreakPoints::FindBreakpoint(u32 addr, bool matchTemp, bool temp) { + size_t found = INVALID_BREAKPOINT; for (size_t i = 0; i < breakPoints_.size(); ++i) { - if (breakPoints_[i].addr == addr && (!matchTemp || breakPoints_[i].temporary == temp)) - return i; + const auto &bp = breakPoints_[i]; + if (bp.addr == addr && (!matchTemp || bp.temporary == temp)) + { + if (bp.enabled) + return i; + // Hold out until the first enabled one. + if (found == INVALID_BREAKPOINT) + found = i; + } } - return INVALID_BREAKPOINT; + return found; } size_t CBreakPoints::FindMemCheck(u32 start, u32 end)