[llvm-branch-commits] [lldb] [lldb] Implement delayed breakpoints (PR #192971)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 28 10:04:22 PDT 2026
jimingham wrote:
> > The rationale for eager deletion is: if we're updating `m_breakpoint_site_list`, then perform the operation immediately. It isn't clear to me that we can always update the site list but delay the action, but I can try again
>
> Ah, another thing that would potentially be dangerous: the destructor of BreakpointSite iterates over all constituents and clears the site. Can we delay this? .... but also BreakpointLocation stores a shared pointer to the site. So if a `BreakpointSite` is being destructed, then it implies no BreakpointLocation contains that site. This feels wrong, it sounds like the destructor of BreakpointSite should be empty.
I think I'm missing something but physically inserting and removing the server-side implementation of a breakpoint site - which is what you are doing here - is orthogonal to adding or removing breakpoint sites from the breakpoint site list. After all, when you step a thread over a breakpoint site it has hit, you don't delete the BreakpointSite, you just don't physically insert it.
So there shouldn't be any reason why you can't insert a new site in the breakpoint site list, but not immediately send the packet to insert the site in the process.
BreakpointSite's lifecycle management is a bit odd. OTOH, they track how many owners they have, and when the number of locations goes to 0, they should delete themselves. In that case, changes in the breakpoint list are causing the destruction of the site, and as you say, the site will only go away when the owners do.
But when the process goes away, the Breakpoints and BreakpointLocations don't change. They stay in place for the next run. But they do need to know that their BreakpointSites are no longer valid. We implement that by deleting the BreakpointSiteList and its sites, then going through the BreakpointLocations and deleting their sites. But instead, we get the BreakpointSite as it is going away to tell all the Locations that it is doing so. The Locations then reset their BreakpointSiteSP and mark themselves as "pending".
The BreakpointSite destructor implements that part of the destruction process.
https://github.com/llvm/llvm-project/pull/192971
More information about the llvm-branch-commits
mailing list