summaryrefslogtreecommitdiffstats
path: root/lldb/source/Breakpoint
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Breakpoint')
-rw-r--r--lldb/source/Breakpoint/Breakpoint.cpp41
-rw-r--r--lldb/source/Breakpoint/BreakpointList.cpp11
2 files changed, 43 insertions, 9 deletions
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp
index 62e1b248280..5d0cbd47e20 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -315,7 +315,7 @@ Breakpoint::ClearAllBreakpointSites ()
//----------------------------------------------------------------------
void
-Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
+Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_locations)
{
if (load)
{
@@ -395,11 +395,7 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
else
{
// Go through the currently set locations and if any have breakpoints in
- // the module list, then remove their breakpoint sites.
- // FIXME: Think about this... Maybe it's better to delete the locations?
- // Are we sure that on load-unload-reload the module pointer will remain
- // the same? Or do we need to do an equality on modules that is an
- // "equivalence"???
+ // the module list, then remove their breakpoint sites, and their locations if asked to.
BreakpointEventData *removed_locations_event;
if (!IsInternal())
@@ -414,7 +410,9 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
if (m_filter_sp->ModulePasses (module_sp))
{
size_t loc_idx = 0;
- while (loc_idx < m_locations.GetSize())
+ size_t num_locations = m_locations.GetSize();
+ BreakpointLocationCollection locations_to_remove;
+ for (loc_idx = 0; loc_idx < num_locations; loc_idx++)
{
BreakpointLocationSP break_loc_sp (m_locations.GetByIndex(loc_idx));
SectionSP section_sp (break_loc_sp->GetAddress().GetSection());
@@ -429,9 +427,17 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
{
removed_locations_event->GetBreakpointLocationCollection().Add(break_loc_sp);
}
- //m_locations.RemoveLocation (break_loc_sp);
+ if (delete_locations)
+ locations_to_remove.Add (break_loc_sp);
+
}
- ++loc_idx;
+ }
+
+ if (delete_locations)
+ {
+ size_t num_locations_to_remove = locations_to_remove.GetSize();
+ for (loc_idx = 0; loc_idx < num_locations_to_remove; loc_idx++)
+ m_locations.RemoveLocation (locations_to_remove.GetByIndex(loc_idx));
}
}
}
@@ -440,6 +446,23 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
}
void
+Breakpoint::ModuleReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp)
+{
+ ModuleList temp_list;
+ temp_list.Append (new_module_sp);
+ ModulesChanged (temp_list, true);
+
+ // TO DO: For now I'm just adding locations for the new module and removing the
+ // breakpoint locations that were in the old module.
+ // We should really go find the ones that are in the new module & if we can determine that they are "equivalent"
+ // carry over the options from the old location to the new.
+
+ temp_list.Clear();
+ temp_list.Append (old_module_sp);
+ ModulesChanged (temp_list, false, true);
+}
+
+void
Breakpoint::Dump (Stream *)
{
}
diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp
index e1aa2dbcb1e..6a91bd6731a 100644
--- a/lldb/source/Breakpoint/BreakpointList.cpp
+++ b/lldb/source/Breakpoint/BreakpointList.cpp
@@ -210,6 +210,17 @@ BreakpointList::UpdateBreakpoints (ModuleList& module_list, bool added)
}
void
+BreakpointList::UpdateBreakpointsWhenModuleIsReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp)
+{
+ Mutex::Locker locker(m_mutex);
+ bp_collection::iterator end = m_breakpoints.end();
+ bp_collection::iterator pos;
+ for (pos = m_breakpoints.begin(); pos != end; ++pos)
+ (*pos)->ModuleReplaced (old_module_sp, new_module_sp);
+
+}
+
+void
BreakpointList::ClearAllBreakpointSites ()
{
Mutex::Locker locker(m_mutex);
OpenPOWER on IntegriCloud