Added the ability to remove orphaned module shared pointers from a ModuleList.
This is helping us track down some extra references to ModuleSP objects that
are causing things to get kept around for too long.
Added a module pointer accessor to target and change a lot of code to use
it where it would be more efficient.
"taret delete" can now specify "--clean=1" which will cleanup the global module
list for any orphaned module in the shared module cache which can save memory
and also help track down module reference leaks like we have now.
llvm-svn: 137294
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 18b05e6..e8a8ba9 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -148,15 +148,15 @@
collection::const_iterator pos, end = m_target_list.end();
for (pos = m_target_list.begin(); pos != end; ++pos)
{
- ModuleSP module_sp ((*pos)->GetExecutableModule());
+ Module *exe_module = (*pos)->GetExecutableModulePointer();
- if (module_sp)
+ if (exe_module)
{
- if (FileSpec::Equal (exe_file_spec, module_sp->GetFileSpec(), full_match))
+ if (FileSpec::Equal (exe_file_spec, exe_module->GetFileSpec(), full_match))
{
if (exe_arch_ptr)
{
- if (*exe_arch_ptr != module_sp->GetArchitecture())
+ if (*exe_arch_ptr != exe_module->GetArchitecture())
continue;
}
target_sp = *pos;