diff options
author | Greg Clayton <gclayton@apple.com> | 2011-08-11 02:48:45 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-08-11 02:48:45 +0000 |
commit | aa149cbd863d1722f8e5263cac26b9c9f4461f57 (patch) | |
tree | 03b9bb36184a893d7fd5f3c44deb48f4046a28f9 /lldb/source/Target/Process.cpp | |
parent | 8e4c74bb7c515099d97a330c24a48126c3222a6d (diff) | |
download | bcm5719-llvm-aa149cbd863d1722f8e5263cac26b9c9f4461f57.tar.gz bcm5719-llvm-aa149cbd863d1722f8e5263cac26b9c9f4461f57.zip |
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
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index a81b68b158f..9876d72f8d7 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -2019,7 +2019,7 @@ Process::Launch m_dyld_ap.reset(); m_process_input_reader.reset(); - Module *exe_module = m_target.GetExecutableModule().get(); + Module *exe_module = m_target.GetExecutableModulePointer(); if (exe_module) { char local_exec_file_path[PATH_MAX]; @@ -2327,8 +2327,7 @@ Process::CompleteAttach () ModuleSP module_sp (modules.GetModuleAtIndex(i)); if (module_sp && module_sp->IsExecutable()) { - ModuleSP target_exe_module_sp (m_target.GetExecutableModule()); - if (target_exe_module_sp != module_sp) + if (m_target.GetExecutableModulePointer() != module_sp.get()) m_target.SetExecutableModule (module_sp, false); break; } @@ -3319,11 +3318,11 @@ Process::GetSettingsController () void Process::UpdateInstanceName () { - ModuleSP module_sp = GetTarget().GetExecutableModule(); - if (module_sp) + Module *module = GetTarget().GetExecutableModulePointer(); + if (module) { StreamString sstr; - sstr.Printf ("%s", module_sp->GetFileSpec().GetFilename().AsCString()); + sstr.Printf ("%s", module->GetFileSpec().GetFilename().AsCString()); GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), sstr.GetData()); |