summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Breakpoint/BreakpointList.h10
-rw-r--r--lldb/include/lldb/Target/Target.h5
-rw-r--r--lldb/source/Breakpoint/BreakpointList.cpp4
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp2
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp2
-rw-r--r--lldb/source/Target/Process.cpp8
-rw-r--r--lldb/source/Target/Target.cpp36
-rw-r--r--lldb/test/functionalities/exec/TestExec.py2
8 files changed, 39 insertions, 30 deletions
diff --git a/lldb/include/lldb/Breakpoint/BreakpointList.h b/lldb/include/lldb/Breakpoint/BreakpointList.h
index 97eb2b46bc0..c6708db118d 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointList.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointList.h
@@ -149,11 +149,17 @@ public:
/// @param[in] module_list
/// The module list that has changed.
///
- /// @param[in] added
+ /// @param[in] load
/// \b true if the modules are loaded, \b false if unloaded.
+ ///
+ /// @param[in] delete_locations
+ /// If \a load is \b false, then delete breakpoint locations when
+ /// when updating breakpoints.
//------------------------------------------------------------------
void
- UpdateBreakpoints (ModuleList &module_list, bool added);
+ UpdateBreakpoints (ModuleList &module_list,
+ bool load,
+ bool delete_locations);
void
UpdateBreakpointsWhenModuleIsReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp);
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index c20225c093d..1c90ea6f15e 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -735,11 +735,14 @@ public:
ModulesDidLoad (ModuleList &module_list);
void
- ModulesDidUnload (ModuleList &module_list);
+ ModulesDidUnload (ModuleList &module_list, bool delete_locations);
void
SymbolsDidLoad (ModuleList &module_list);
+ void
+ ClearModules();
+
//------------------------------------------------------------------
/// Gets the module for the main executable.
///
diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp
index 5926663af7b..c6030d60ca0 100644
--- a/lldb/source/Breakpoint/BreakpointList.cpp
+++ b/lldb/source/Breakpoint/BreakpointList.cpp
@@ -204,13 +204,13 @@ BreakpointList::GetBreakpointAtIndex (size_t i) const
}
void
-BreakpointList::UpdateBreakpoints (ModuleList& module_list, bool added)
+BreakpointList::UpdateBreakpoints (ModuleList& module_list, bool added, bool delete_locations)
{
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)->ModulesChanged (module_list, added);
+ (*pos)->ModulesChanged (module_list, added, delete_locations);
}
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 1b2a1f6b7bb..3403da43fd5 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -1335,7 +1335,7 @@ DynamicLoaderDarwinKernel::ParseKextSummaries (const Address &kext_summary_addr,
// the to_be_removed bool vector; leaving it in place once Cleared() is relatively harmless.
}
}
- m_process->GetTarget().ModulesDidUnload (unloaded_module_list);
+ m_process->GetTarget().ModulesDidUnload (unloaded_module_list, false);
}
}
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 8e8314feb7d..4284558c440 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -370,7 +370,7 @@ DynamicLoaderPOSIXDYLD::RefreshModules()
}
}
loaded_modules.Remove(old_modules);
- m_process->GetTarget().ModulesDidUnload(old_modules);
+ m_process->GetTarget().ModulesDidUnload(old_modules, false);
}
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index d5d1456d2a5..700afdb7981 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5633,9 +5633,7 @@ Process::DidExec ()
{
Target &target = GetTarget();
target.CleanupProcess ();
- ModuleList unloaded_modules (target.GetImages());
- target.ModulesDidUnload (unloaded_modules);
- target.GetSectionLoadList().Clear();
+ target.ClearModules();
m_dynamic_checkers_ap.reset();
m_abi_sp.reset();
m_system_runtime_ap.reset();
@@ -5648,4 +5646,8 @@ Process::DidExec ()
m_memory_cache.Clear(true);
DoDidExec();
CompleteAttach ();
+ // Flush the process (threads and all stack frames) after running CompleteAttach()
+ // in case the dynamic loader loaded things in new locations.
+ Flush();
}
+
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index c512a05279c..18efd8cb724 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -192,7 +192,7 @@ Target::Destroy()
DeleteCurrentProcess ();
m_platform_sp.reset();
m_arch.Clear();
- m_images.Clear();
+ ClearModules();
m_section_load_list.Clear();
const bool notify = false;
m_breakpoint_list.RemoveAll(notify);
@@ -201,9 +201,6 @@ Target::Destroy()
m_last_created_watchpoint.reset();
m_search_filter_sp.reset();
m_image_search_paths.Clear(notify);
- m_scratch_ast_context_ap.reset();
- m_scratch_ast_source_ap.reset();
- m_ast_importer_ap.reset();
m_persistent_variables.Clear();
m_stop_hooks.clear();
m_stop_hook_next_id = 0;
@@ -1017,13 +1014,21 @@ LoadScriptingResourceForModule (const ModuleSP &module_sp, Target *target)
}
void
-Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
+Target::ClearModules()
{
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
+ ModulesDidUnload (m_images, true);
+ GetSectionLoadList().Clear();
m_images.Clear();
m_scratch_ast_context_ap.reset();
m_scratch_ast_source_ap.reset();
m_ast_importer_ap.reset();
+}
+
+void
+Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
+ ClearModules();
if (executable_sp.get())
{
@@ -1092,10 +1097,8 @@ Target::SetArchitecture (const ArchSpec &arch_spec)
log->Printf ("Target::SetArchitecture changing architecture to %s (%s)", arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str());
m_arch = arch_spec;
ModuleSP executable_sp = GetExecutableModule ();
- m_images.Clear();
- m_scratch_ast_context_ap.reset();
- m_scratch_ast_source_ap.reset();
- m_ast_importer_ap.reset();
+
+ ClearModules();
// Need to do something about unsetting breakpoints.
if (executable_sp)
@@ -1140,7 +1143,7 @@ Target::ModuleRemoved (const ModuleList& module_list, const ModuleSP &module_sp)
// A module is being added to this target for the first time
ModuleList my_module_list;
my_module_list.Append(module_sp);
- ModulesDidUnload (my_module_list);
+ ModulesDidUnload (my_module_list, false);
}
void
@@ -1155,7 +1158,7 @@ Target::ModulesDidLoad (ModuleList &module_list)
{
if (module_list.GetSize())
{
- m_breakpoint_list.UpdateBreakpoints (module_list, true);
+ m_breakpoint_list.UpdateBreakpoints (module_list, true, false);
if (m_process_sp)
{
SystemRuntime *sys_runtime = m_process_sp->GetSystemRuntime();
@@ -1184,17 +1187,17 @@ Target::SymbolsDidLoad (ModuleList &module_list)
}
}
- m_breakpoint_list.UpdateBreakpoints (module_list, true);
+ m_breakpoint_list.UpdateBreakpoints (module_list, true, false);
BroadcastEvent(eBroadcastBitSymbolsLoaded, NULL);
}
}
void
-Target::ModulesDidUnload (ModuleList &module_list)
+Target::ModulesDidUnload (ModuleList &module_list, bool delete_locations)
{
if (module_list.GetSize())
{
- m_breakpoint_list.UpdateBreakpoints (module_list, false);
+ m_breakpoint_list.UpdateBreakpoints (module_list, false, delete_locations);
// TODO: make event data that packages up the module_list
BroadcastEvent (eBroadcastBitModulesUnloaded, NULL);
}
@@ -1737,10 +1740,7 @@ Target::ImageSearchPathsChanged
Target *target = (Target *)baton;
ModuleSP exe_module_sp (target->GetExecutableModule());
if (exe_module_sp)
- {
- target->m_images.Clear();
target->SetExecutableModule (exe_module_sp, true);
- }
}
ClangASTContext *
diff --git a/lldb/test/functionalities/exec/TestExec.py b/lldb/test/functionalities/exec/TestExec.py
index 6b5a07a5aa1..e9a0dca7446 100644
--- a/lldb/test/functionalities/exec/TestExec.py
+++ b/lldb/test/functionalities/exec/TestExec.py
@@ -24,7 +24,6 @@ class ExecTestCase(TestBase):
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@dsym_test
- @unittest2.expectedFailure("rdar://15367122")
def test_with_dsym (self):
if self.getArchitecture() == 'x86_64':
source = os.path.join (os.getcwd(), "main.cpp")
@@ -38,7 +37,6 @@ class ExecTestCase(TestBase):
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@dwarf_test
- @unittest2.expectedFailure("rdar://15367122")
def test_with_dwarf (self):
if self.getArchitecture() == 'x86_64':
source = os.path.join (os.getcwd(), "main.cpp")
OpenPOWER on IntegriCloud