summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-12-10 17:08:23 +0000
committerTamas Berghammer <tberghammer@google.com>2015-12-10 17:08:23 +0000
commit257e13ae9a2bc62369b2ed5fc3370ebf8cd2cf47 (patch)
tree7f5b8cdfd214f313203ea3b9ace840f5b13b51a6 /lldb
parent9f2ff9c669e9d4c3350ec34a2b981e6bc952b47c (diff)
downloadbcm5719-llvm-257e13ae9a2bc62369b2ed5fc3370ebf8cd2cf47.tar.gz
bcm5719-llvm-257e13ae9a2bc62369b2ed5fc3370ebf8cd2cf47.zip
Add modules downloaded by ModuleCache to the global ModuleList
Adding the modules to the global module list eleminate issues in the case when a module is unloaded from the target but some object (e.g. breakpoint) still referencing them with weak pointers. It also speeds up the case when we load, unload, load the same shared library because the global module cache will keep the parsed debug info around between the 2 load (this scenario happens for some code on android). Differential revision: http://reviews.llvm.org/D15415 llvm-svn: 255260
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Utility/ModuleCache.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lldb/source/Utility/ModuleCache.cpp b/lldb/source/Utility/ModuleCache.cpp
index b1cb2f27f31..7c57d0baecc 100644
--- a/lldb/source/Utility/ModuleCache.cpp
+++ b/lldb/source/Utility/ModuleCache.cpp
@@ -11,6 +11,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/File.h"
#include "lldb/Host/FileSystem.h"
@@ -234,7 +235,7 @@ ModuleCache::Get (const FileSpec &root_dir_spec,
return Error ("Module %s has invalid file size", module_file_path.GetPath ().c_str ());
// We may have already cached module but downloaded from an another host - in this case let's create a link to it.
- const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, module_spec.GetFileSpec(), module_file_path, false);
+ auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, module_spec.GetFileSpec(), module_file_path, false);
if (error.Fail ())
return Error ("Failed to create link to %s: %s", module_file_path.GetPath().c_str(), error.AsCString());
@@ -242,15 +243,20 @@ ModuleCache::Get (const FileSpec &root_dir_spec,
cached_module_spec.GetUUID ().Clear (); // Clear UUID since it may contain md5 content hash instead of real UUID.
cached_module_spec.GetFileSpec () = module_file_path;
cached_module_spec.GetPlatformFileSpec () = module_spec.GetFileSpec ();
- cached_module_sp.reset (new Module (cached_module_spec));
+
+ error = ModuleList::GetSharedModule(cached_module_spec,
+ cached_module_sp,
+ nullptr,
+ nullptr,
+ did_create_ptr,
+ false);
+ if (error.Fail())
+ return error;
FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec ());
if (symfile_spec.Exists ())
cached_module_sp->SetSymbolFileFileSpec (symfile_spec);
- if (did_create_ptr)
- *did_create_ptr = true;
-
m_loaded_modules.insert (std::make_pair (module_spec.GetUUID ().GetAsString (), cached_module_sp));
return Error ();
OpenPOWER on IntegriCloud