[Lldb-commits] [lldb] [lldb] Implement delayed breakpoints (PR #192971)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 30 00:05:10 PDT 2026


================
@@ -1648,6 +1710,34 @@ static addr_t ComputeConstituentLoadAddress(BreakpointLocation &constituent,
   return resolved_address.GetOpcodeLoadAddress(&target);
 }
 
+llvm::Error Process::FlushDelayedBreakpoints() {
+  std::unique_lock<std::recursive_mutex> guard(m_delayed_breakpoints_mutex);
+
+  // Clear the cache in m_delayed_breakpoints so it can't affect the actual
+  // enabling of breakpoints. For example, if `EnableSoftwareBreakpoint` is
+  // called outside of FlushDelayedBreakpoints, it needs to check the delayed
+  // breakpoints and possibly early return. However, when called from
+  // FlushDelayedBreakpoints, the queue better be empty so that no early returns
+  // take place.
+  auto site_to_action = std::move(m_delayed_breakpoints.m_site_to_action);
+  m_delayed_breakpoints.m_site_to_action.clear();
+
+  guard.unlock();
+  return UpdateBreakpointSites(site_to_action);
+}
+
+llvm::Error Process::UpdateBreakpointSites(
+    const BreakpointSiteToActionMap &site_to_action) {
+  llvm::Error error = llvm::Error::success();
----------------
felipepiovezan wrote:

There were already some comments in `llvm::Error Process::FlushDelayedBreakpoints()`, but I added an extra line about iteration.

https://github.com/llvm/llvm-project/pull/192971


More information about the lldb-commits mailing list