[lldb] Consider all breakpoints in breakpoint detection

Currently in some cases lldb reports stop reason as "step out" or "step over" (from thread plan completion) instead of "breakpoint", if the user breakpoint happens to be set on the same address.
The part of f08f5c9926 seems to overwrite internal breakpoint detection logic, so that only the last breakpoint for the current stop address is considered.
Together with step-out plans not clearing its breakpoint until they are destrouyed, this creates a situation when there is a user breakpoint set for address, but internal breakpoint makes lldb report a plan completion stop reason instead of breakpoint.
This patch reverts that internal breakpoint detection logic to consider all breakpoints

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D140368
This commit is contained in:
Pavel Kosov
2023-01-25 10:50:02 +03:00
parent 22cdc6a126
commit 2af0a478ea
4 changed files with 146 additions and 5 deletions

View File

@@ -256,7 +256,7 @@ protected:
if (!m_should_perform_action)
return;
m_should_perform_action = false;
bool internal_breakpoint = true;
bool all_stopping_locs_internal = true;
ThreadSP thread_sp(m_thread_wp.lock());
@@ -421,8 +421,6 @@ protected:
continue;
}
internal_breakpoint = bp_loc_sp->GetBreakpoint().IsInternal();
// First run the precondition, but since the precondition is per
// breakpoint, only run it once per breakpoint.
std::pair<std::unordered_set<break_id_t>::iterator, bool> result =
@@ -509,7 +507,7 @@ protected:
loc_desc.GetData());
// We want this stop reported, so you will know we auto-continued
// but only for external breakpoints:
if (!internal_breakpoint)
if (!bp_loc_sp->GetBreakpoint().IsInternal())
thread_sp->SetShouldReportStop(eVoteYes);
auto_continue_says_stop = false;
}
@@ -539,6 +537,9 @@ protected:
actually_said_continue = true;
}
if (m_should_stop && !bp_loc_sp->GetBreakpoint().IsInternal())
all_stopping_locs_internal = false;
// If we are going to stop for this breakpoint, then remove the
// breakpoint.
if (callback_says_stop && bp_loc_sp &&
@@ -576,7 +577,7 @@ protected:
__FUNCTION__, m_value);
}
if ((!m_should_stop || internal_breakpoint) &&
if ((!m_should_stop || all_stopping_locs_internal) &&
thread_sp->CompletedPlanOverridesBreakpoint()) {
// Override should_stop decision when we have completed step plan