Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -452,7 +452,7 @@ GetLoadedModuleList (GDBLoadedModuleInfoList &); lldb::ModuleSP - LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr); + LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr, bool value_is_offset); private: //------------------------------------------------------------------ Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -216,6 +216,16 @@ return m_has[e_has_base]; } + void set_base_is_offset (bool is_offset) + { + m_base_is_offset = is_offset; + } + bool get_base_is_offset(bool & out) const + { + out = m_base_is_offset; + return m_has[e_has_base]; + } + void set_link_map (const lldb::addr_t addr) { m_link_map = addr; @@ -250,6 +260,7 @@ std::string m_name; lldb::addr_t m_link_map; lldb::addr_t m_base; + bool m_base_is_offset; lldb::addr_t m_dynamic; }; @@ -4582,7 +4593,8 @@ { // the displacement as read from the field 'l_addr' of the link_map struct. module.set_base(StringConvert::ToUInt64(value.data(), LLDB_INVALID_ADDRESS, 0)); - + // base address is always a displacement, not an absolute value. + module.set_base_is_offset(true); } else if (name == "l_ld") { @@ -4597,13 +4609,15 @@ { std::string name; lldb::addr_t lm=0, base=0, ld=0; + bool base_is_offset; module.get_name (name); module.get_link_map (lm); module.get_base (base); + module.get_base_is_offset (base_is_offset); module.get_dynamic (ld); - log->Printf ("found (link_map:0x%08" PRIx64 ", base:0x%08" PRIx64 ", ld:0x%08" PRIx64 ", name:'%s')", lm, base, ld, name.c_str()); + log->Printf ("found (link_map:0x%08" PRIx64 ", base:0x%08" PRIx64 "[%s], ld:0x%08" PRIx64 ", name:'%s')", lm, base, (base_is_offset ? "offset" : "absolute"), ld, name.c_str()); } list.add (module); @@ -4645,15 +4659,19 @@ const XMLNode §ion = library.FindFirstChildElementWithName("section"); llvm::StringRef address = section.GetAttributeValue("address"); module.set_base(StringConvert::ToUInt64(address.data(), LLDB_INVALID_ADDRESS, 0)); + // These addresses are absolute values. + module.set_base_is_offset(false); if (log) { std::string name; lldb::addr_t base = 0; + bool base_is_offset; module.get_name (name); module.get_base (base); + module.get_base_is_offset (base_is_offset); - log->Printf ("found (base:0x%08" PRIx64 ", name:'%s')", base, name.c_str()); + log->Printf ("found (base:0x%08" PRIx64 "[%s], name:'%s')", base, (base_is_offset ? "offset" : "absolute"), name.c_str()); } list.add (module); @@ -4670,7 +4688,7 @@ } lldb::ModuleSP -ProcessGDBRemote::LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr) +ProcessGDBRemote::LoadModuleAtAddress (const FileSpec &file, lldb::addr_t base_addr, bool value_is_offset) { Target &target = m_process->GetTarget(); ModuleList &modules = target.GetImages(); @@ -4681,11 +4699,11 @@ ModuleSpec module_spec (file, target.GetArchitecture()); if ((module_sp = modules.FindFirstModule (module_spec))) { - module_sp->SetLoadAddress (target, base_addr, true, changed); + module_sp->SetLoadAddress (target, base_addr, value_is_offset, changed); } else if ((module_sp = target.GetSharedModule (module_spec))) { - module_sp->SetLoadAddress (target, base_addr, true, changed); + module_sp->SetLoadAddress (target, base_addr, value_is_offset, changed); } return module_sp; @@ -4708,10 +4726,12 @@ { std::string mod_name; lldb::addr_t mod_base; + bool mod_base_is_offset; bool valid = true; valid &= modInfo.get_name (mod_name); valid &= modInfo.get_base (mod_base); + valid &= modInfo.get_base_is_offset (mod_base_is_offset); if (!valid) continue; @@ -4723,7 +4743,7 @@ marker += 1; FileSpec file (mod_name.c_str()+marker, true); - lldb::ModuleSP module_sp = LoadModuleAtAddress (file, mod_base); + lldb::ModuleSP module_sp = LoadModuleAtAddress (file, mod_base, mod_base_is_offset); if (module_sp.get()) new_modules.Append (module_sp);