diff options
-rw-r--r-- | lldb/include/lldb/Symbol/ObjectFile.h | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp | 22 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp | 19 |
5 files changed, 38 insertions, 12 deletions
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index b85f9888c6a..b4a78e73bcc 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -506,7 +506,7 @@ public: /// The address of any auxiliary tables, or an invalid address if this /// object file format does not support or contain such information. virtual lldb_private::Address - GetImageInfoAddress () { return Address(); } + GetImageInfoAddress (bool &indirect) { indirect = false; return Address(); } //------------------------------------------------------------------ /// Returns the address of the Entry Point in this object file - if diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 0e31cbb45c8..00204e1ec0a 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -515,7 +515,7 @@ ObjectFileELF::GetDependentModules(FileSpecList &files) } Address -ObjectFileELF::GetImageInfoAddress() +ObjectFileELF::GetImageInfoAddress(bool &indirect) { if (!ParseDynamicSymbols()) return Address(); @@ -539,8 +539,9 @@ ObjectFileELF::GetImageInfoAddress() { ELFDynamic &symbol = m_dynamic_symbols[i]; - if (symbol.d_tag == DT_DEBUG) + if (symbol.d_tag == DT_DEBUG || symbol.d_tag == DT_MIPS_RLD_MAP) { + indirect = (symbol.d_tag == DT_MIPS_RLD_MAP); // Compute the offset as the number of previous entries plus the // size of d_tag. addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize(); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index d66b6a1f252..1ee7979ef0e 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -127,7 +127,7 @@ public: GetDependentModules(lldb_private::FileSpecList& files); virtual lldb_private::Address - GetImageInfoAddress(); + GetImageInfoAddress(bool &indirect); virtual lldb_private::Address GetEntryPointAddress (); diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index b46c9375802..a1511014009 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -289,12 +289,24 @@ ProcessPOSIX::GetImageInfoAddress() { Target *target = &GetTarget(); ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile(); - Address addr = obj_file->GetImageInfoAddress(); + bool indirect; + Address addr = obj_file->GetImageInfoAddress(indirect); - if (addr.IsValid()) - return addr.GetLoadAddress(target); - else - return LLDB_INVALID_ADDRESS; + if (addr.IsValid()) + { + if (indirect) + { + Address ind_addr; + Error error; + if (target->ReadPointerFromMemory(addr.GetLoadAddress(target), false, error, ind_addr)) + return ind_addr.GetLoadAddress(target); + } + else + { + return addr.GetLoadAddress(target); + } + } + return LLDB_INVALID_ADDRESS; } Error diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 995c9569496..fa2265167ec 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -338,10 +338,23 @@ ProcessElfCore::GetImageInfoAddress() { Target *target = &GetTarget(); ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile(); - Address addr = obj_file->GetImageInfoAddress(); + bool indirect; + Address addr = obj_file->GetImageInfoAddress(indirect); - if (addr.IsValid()) - return addr.GetLoadAddress(target); + if (addr.IsValid()) + { + if (indirect) + { + Address ind_addr; + Error error; + if (target->ReadPointerFromMemory(addr.GetLoadAddress(target), false, error, ind_addr)) + return ind_addr.GetLoadAddress(target); + } + else + { + return addr.GetLoadAddress(target); + } + } return LLDB_INVALID_ADDRESS; } |