diff options
author | emaste <emaste@FreeBSD.org> | 2015-07-03 16:57:06 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-07-03 16:57:06 +0000 |
commit | 8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (patch) | |
tree | 3c2e41c3be19b7fc7666ed45a5f91ec3b6e35f2a /source/Core/DynamicLoader.cpp | |
parent | d61b076ede88b56f3372a55e7d1eac6a9d717120 (diff) | |
download | FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.zip FreeBSD-src-8037fa4ee916fa20b3c63cbf531f4ee7e1c76138.tar.gz |
Import LLDB as of upstream SVN 241361 (git 612c075f)
Diffstat (limited to 'source/Core/DynamicLoader.cpp')
-rw-r--r-- | source/Core/DynamicLoader.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/Core/DynamicLoader.cpp b/source/Core/DynamicLoader.cpp index 1f545b7..ffd7425 100644 --- a/source/Core/DynamicLoader.cpp +++ b/source/Core/DynamicLoader.cpp @@ -186,6 +186,24 @@ DynamicLoader::LoadModuleAtAddress(const FileSpec &file, addr_t link_map_addr, a { UpdateLoadedSections(module_sp, link_map_addr, base_addr); } + else + { + // Try to fetch the load address of the file from the process. It can be different from the + // address reported by the linker in case of a file with fixed load address because the + // linker reports the bias between the load address specified in the file and the actual + // load address it loaded the file. + bool is_loaded; + lldb::addr_t load_addr; + Error error = m_process->GetFileLoadAddress(file, is_loaded, load_addr); + if (error.Fail() || !is_loaded) + load_addr = base_addr; + + if ((module_sp = m_process->ReadModuleFromMemory(file, load_addr))) + { + UpdateLoadedSections(module_sp, link_map_addr, base_addr); + target.GetImages().AppendIfNeeded(module_sp); + } + } return module_sp; } |