From ccb0fff878b0730d73a1a2067796c0f007b6cd9a Mon Sep 17 00:00:00 2001 From: AzuLX Date: Sat, 27 Dec 2025 15:36:46 +0000 Subject: [PATCH 1/2] Fix conditional breakpoint evaluation when stepping onto a breakpoint (LLDB) --- core/debuggercontroller.cpp | 12 +++++++++++- core/debuggercontroller.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/debuggercontroller.cpp b/core/debuggercontroller.cpp index bc1ccd5a..6aa2f800 100644 --- a/core/debuggercontroller.cpp +++ b/core/debuggercontroller.cpp @@ -2014,7 +2014,15 @@ void DebuggerController::DebuggerMainThread() AddRegisterValuesToExpressionParser(); AddModuleValuesToExpressionParser(); - if (uint64_t ip = m_state->IP(); m_state->GetBreakpoints()->ContainsAbsolute(ip)) + bool isStepOperation = (m_lastOperation == DebugAdapterStepInto) + || (m_lastOperation == DebugAdapterStepOver) + || (m_lastOperation == DebugAdapterStepReturn) + || (m_lastOperation == DebugAdapterStepIntoReverse) + || (m_lastOperation == DebugAdapterStepOverReverse) + || (m_lastOperation == DebugAdapterStepReturnReverse); + + if (uint64_t ip = m_state->IP(); + !isStepOperation && m_state->GetBreakpoints()->ContainsAbsolute(ip)) { if (!EvaluateBreakpointCondition(ip)) { @@ -2654,6 +2662,8 @@ DebugStopReason DebuggerController::ExecuteAdapterAndWait(const DebugAdapterOper }, "WaitForAdapterStop"); + m_lastOperation = operation; + bool resumeOK = false; bool operationRequested = false; switch (operation) diff --git a/core/debuggercontroller.h b/core/debuggercontroller.h index 6f7a2b24..7992fa86 100644 --- a/core/debuggercontroller.h +++ b/core/debuggercontroller.h @@ -114,6 +114,7 @@ namespace BinaryNinjaDebugger { uint32_t m_exitCode = 0; bool m_userRequestedBreak = false; + DebugAdapterOperation m_lastOperation = DebugAdapterGo; bool m_lastAdapterStopEventConsumed = true; From b666f2e7155b6859bd84b3272ae2faf6844d0252 Mon Sep 17 00:00:00 2001 From: AzuLX Date: Sat, 27 Dec 2025 15:43:19 +0000 Subject: [PATCH 2/2] explanatory comment for rationale for other developers --- core/debuggercontroller.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/debuggercontroller.cpp b/core/debuggercontroller.cpp index 6aa2f800..469ab81a 100644 --- a/core/debuggercontroller.cpp +++ b/core/debuggercontroller.cpp @@ -2014,6 +2014,8 @@ void DebuggerController::DebuggerMainThread() AddRegisterValuesToExpressionParser(); AddModuleValuesToExpressionParser(); + // skip conditional breakpoint evaluation for step operations - when the user explicitly + // steps onto a breakpoint, they expect to stop there regardless of the condition. bool isStepOperation = (m_lastOperation == DebugAdapterStepInto) || (m_lastOperation == DebugAdapterStepOver) || (m_lastOperation == DebugAdapterStepReturn)