diff options
author | Tamas Berghammer <tberghammer@google.com> | 2015-08-24 10:21:55 +0000 |
---|---|---|
committer | Tamas Berghammer <tberghammer@google.com> | 2015-08-24 10:21:55 +0000 |
commit | 42ecef3b15e9b74fe6bf8dca6bae76650e095726 (patch) | |
tree | a4592ace7d88f818a589866232d7b724ece2c053 /lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp | |
parent | 71ad47f81fb33bbbf0a0713006691ed0c0550b3f (diff) | |
download | bcm5719-llvm-42ecef3b15e9b74fe6bf8dca6bae76650e095726.tar.gz bcm5719-llvm-42ecef3b15e9b74fe6bf8dca6bae76650e095726.zip |
Add absolute load address support for the DynamicLoader plugins
The POSIX linker generally reports the load bias for the loaded
libraries but in some case it is useful to handle a library based on
absolute load address. Example usecases:
* Windows linker uses absolute addresses
* Library list came from different source (e.g. /proc/<pid>/maps)
Differential revision: http://reviews.llvm.org/D12233
llvm-svn: 245834
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp')
-rw-r--r-- | lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 2308129b8ca..dd2a436299e 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -177,7 +177,7 @@ DynamicLoaderHexagonDYLD::DidAttach() // Map the loaded sections of this executable if ( load_offset != LLDB_INVALID_ADDRESS ) - UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset); + UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true); // AD: confirm this? // Load into LLDB all of the currently loaded executables in the stub @@ -268,7 +268,10 @@ DynamicLoaderHexagonDYLD::CanLoadImage() } void -DynamicLoaderHexagonDYLD::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, addr_t base_addr) +DynamicLoaderHexagonDYLD::UpdateLoadedSections(ModuleSP module, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { Target &target = m_process->GetTarget(); const SectionList *sections = GetSectionListFromModule(module); @@ -442,7 +445,7 @@ DynamicLoaderHexagonDYLD::RefreshModules() for (I = m_rendezvous.loaded_begin(); I != E; ++I) { FileSpec file(I->path.c_str(), true); - ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr); + ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { loaded_modules.AppendIfNeeded( module_sp ); @@ -571,7 +574,7 @@ DynamicLoaderHexagonDYLD::LoadAllCurrentModules() { const char *module_path = I->path.c_str(); FileSpec file(module_path, false); - ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr); + ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { module_list.Append(module_sp); @@ -591,7 +594,10 @@ DynamicLoaderHexagonDYLD::LoadAllCurrentModules() /// Helper for the entry breakpoint callback. Resolves the load addresses /// of all dependent modules. ModuleSP -DynamicLoaderHexagonDYLD::LoadModuleAtAddress(const FileSpec &file, addr_t link_map_addr, addr_t base_addr) +DynamicLoaderHexagonDYLD::LoadModuleAtAddress(const FileSpec &file, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { Target &target = m_process->GetTarget(); ModuleList &modules = target.GetImages(); @@ -602,12 +608,12 @@ DynamicLoaderHexagonDYLD::LoadModuleAtAddress(const FileSpec &file, addr_t link_ // check if module is currently loaded if ((module_sp = modules.FindFirstModule (module_spec))) { - UpdateLoadedSections(module_sp, link_map_addr, base_addr); + UpdateLoadedSections(module_sp, link_map_addr, base_addr, true); } // try to load this module from disk else if ((module_sp = target.GetSharedModule(module_spec))) { - UpdateLoadedSections(module_sp, link_map_addr, base_addr); + UpdateLoadedSections(module_sp, link_map_addr, base_addr, true); } return module_sp; |