summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/StopInfo.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2013-04-11 22:53:47 +0000
committerJim Ingham <jingham@apple.com>2013-04-11 22:53:47 +0000
commitdbd3c4da5cc153497277dfbf8f41ffd1c3f12bbd (patch)
treeafcd4186c596111cab47f95881f3859b2ddf284e /lldb/source/Target/StopInfo.cpp
parentc7a90202beeab8191ee866f573f96a4231e29bd4 (diff)
downloadbcm5719-llvm-dbd3c4da5cc153497277dfbf8f41ffd1c3f12bbd.tar.gz
bcm5719-llvm-dbd3c4da5cc153497277dfbf8f41ffd1c3f12bbd.zip
Save away the locations at the site we hit and iterate over that collection. Otherwise the action of one location
could delete the other locations, and that would leave us iterating over a reduced size collection and crash. <rdar://problem/13592544> llvm-svn: 179332
Diffstat (limited to 'lldb/source/Target/StopInfo.cpp')
-rw-r--r--lldb/source/Target/StopInfo.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 33ade1eef1a..299c303588a 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -363,13 +363,29 @@ protected:
}
StoppointCallbackContext context (event_ptr, exe_ctx, false);
+
+ // Let's copy the breakpoint locations out of the site and store them in a local list. That way if
+ // one of the breakpoint actions changes the site, then we won't be operating on a bad list.
+
+ BreakpointLocationCollection site_locations;
+ for (size_t j = 0; j < num_owners; j++)
+ site_locations.Add(bp_site_sp->GetOwnerAtIndex(j));
for (size_t j = 0; j < num_owners; j++)
{
- lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j);
+ lldb::BreakpointLocationSP bp_loc_sp = site_locations.GetByIndex(j);
+
+ // If another action disabled this breakpoint or its location, then don't run the actions.
+ if (!bp_loc_sp->IsEnabled() || !bp_loc_sp->GetBreakpoint().IsEnabled())
+ continue;
+
+ // The breakpoint site may have many locations associated with it, not all of them valid for
+ // this thread. Skip the ones that aren't:
+ if (!bp_loc_sp->ValidForThisThread(&m_thread))
+ continue;
// First run the condition for the breakpoint. If that says we should stop, then we'll run
- // the callback for the breakpoint. If the callback says we shouldn't stop that will win.
+ // the callback for the breakpoint. If the callback says we shouldn't stop that will win.
bool condition_says_stop = true;
if (bp_loc_sp->GetConditionText() != NULL)
OpenPOWER on IntegriCloud