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/Plugins | |
| 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/Plugins')
4 files changed, 11 insertions, 11 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 92f359bb889..b051cb002ec 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -89,7 +89,7 @@ DynamicLoaderMacOSXDYLD::CreateInstance (Process* process, bool force)      if (!create)      {          create = true; -        Module* exe_module = process->GetTarget().GetExecutableModule().get(); +        Module* exe_module = process->GetTarget().GetExecutableModulePointer();          if (exe_module)          {              ObjectFile *object_file = exe_module->GetObjectFile(); @@ -225,7 +225,7 @@ DynamicLoaderMacOSXDYLD::LocateDYLD()      }      // Check some default values -    Module *executable = m_process->GetTarget().GetExecutableModule().get(); +    Module *executable = m_process->GetTarget().GetExecutableModulePointer();      if (executable)      { @@ -267,7 +267,7 @@ DynamicLoaderMacOSXDYLD::FindTargetModuleForDYLDImageInfo (const DYLDImageInfo &          {              if (module_sp)              { -                if (image_info.UUIDValid()) +                if (image_info_uuid_is_valid)                  {                      if (module_sp->GetUUID() != image_info.uuid)                          module_sp.reset(); @@ -1217,7 +1217,7 @@ DynamicLoaderMacOSXDYLD::UpdateImageInfosHeaderAndLoadCommands(DYLDImageInfo::co          if (exe_module_sp)          { -            if (exe_module_sp.get() != m_process->GetTarget().GetExecutableModule().get()) +            if (exe_module_sp.get() != m_process->GetTarget().GetExecutableModulePointer())              {                  // Don't load dependent images since we are in dyld where we will know                  // and find out about all images that are loaded diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp index 847d18e4ddf..142a6f17ae6 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp @@ -52,7 +52,7 @@ DynamicLoaderMacOSXKernel::CreateInstance (Process* process, bool force)      bool create = force;      if (!create)      { -        Module* exe_module = process->GetTarget().GetExecutableModule().get(); +        Module* exe_module = process->GetTarget().GetExecutableModulePointer();          if (exe_module)          {              ObjectFile *object_file = exe_module->GetObjectFile(); diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 5d4f465e2f4..401fd9a48f9 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -59,14 +59,14 @@ bool  ProcessKDP::CanDebug(Target &target, bool plugin_specified_by_name)  {      // For now we are just making sure the file exists for a given module -    ModuleSP exe_module_sp(target.GetExecutableModule()); -    if (exe_module_sp.get()) +    Module *exe_module = target.GetExecutableModulePointer(); +    if (exe_module)      {          const llvm::Triple &triple_ref = target.GetArchitecture().GetTriple();          if (triple_ref.getOS() == llvm::Triple::Darwin &&               triple_ref.getVendor() == llvm::Triple::Apple)          { -            ObjectFile *exe_objfile = exe_module_sp->GetObjectFile(); +            ObjectFile *exe_objfile = exe_module->GetObjectFile();              if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&                   exe_objfile->GetStrata() == ObjectFile::eStrataKernel)                  return true; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 63967148cb5..558a02aeaae 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -104,9 +104,9 @@ bool  ProcessGDBRemote::CanDebug (Target &target, bool plugin_specified_by_name)  {      // For now we are just making sure the file exists for a given module -    ModuleSP exe_module_sp(target.GetExecutableModule()); -    if (exe_module_sp.get()) -        return exe_module_sp->GetFileSpec().Exists(); +    Module *exe_module = target.GetExecutableModulePointer(); +    if (exe_module) +        return exe_module->GetFileSpec().Exists();      // However, if there is no executable module, we return true since we might be preparing to attach.      return true;  }  | 

