Copy the breakpoint site owner's collection so we can drop


Copy the breakpoint site owner's collection so we can drop
the collection lock before we iterate over the owners calling ShouldStop.

BreakpointSite::ShouldStop can do a lot of work, and might by chance hit the same breakpoint
site again on another thread. So instead of holding the site's owners lock
while iterating over them calling ShouldStop, I make a local copy of the list, drop the lock
and then iterate over the copy calling BreakpointLocation::ShouldStop.

It's actually quite difficult to make this cause problems because usually all the
action happens on the private state thread, and the lock is recursive.

I have a report where some code hit the ASAN error breakpoint, went to
compile the ASAN error gathering expression, in the course of compiling
that we went to fetch the ObjC runtime data, but the state of the program
was such that the ObjC runtime grubbing function triggered an ASAN error and
we were executing that function on another thread.

I couldn't figure out a way to reproduce that situation in a test. But this is an
NFC change anyway, it just makes the locking strategy more narrowly focused.



jinghamMar 27 2019, 6:51 PM
rL357140: Inline a trivial function. NFC.