summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2015-09-15 05:45:29 +0000
committerBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2015-09-15 05:45:29 +0000
commit1bcc7bac8f1bf50d73b7505ea069f7a0efa620ce (patch)
tree304e11e4e09743e7c8a77deb9808c7a3220429db /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parentd089060d877320b0d14ed2e6c45f77f3e5d8a8e2 (diff)
downloadbcm5719-llvm-1bcc7bac8f1bf50d73b7505ea069f7a0efa620ce.tar.gz
bcm5719-llvm-1bcc7bac8f1bf50d73b7505ea069f7a0efa620ce.zip
[LLDB][MIPS] Add support for DT_MIPS_RLD_MAP_REL
SUMMARY: This patch provides support for MIPS specific DT_MIPS_RLD_MAP_REL tag in LLDB. This tag allows debugging of MIPS position independent executables and provides access to shared library information. Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits Differential Revision: http://reviews.llvm.org/D12794 llvm-svn: 247666
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 565f95d2a2c..a846beee05d 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1097,16 +1097,35 @@ ObjectFileELF::GetImageInfoAddress(Target *target)
addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize();
return Address(dynsym_section_sp, offset);
}
- else if (symbol.d_tag == DT_MIPS_RLD_MAP && target)
+ // MIPS executables uses DT_MIPS_RLD_MAP_REL to support PIE. DT_MIPS_RLD_MAP exists in non-PIE.
+ else if ((symbol.d_tag == DT_MIPS_RLD_MAP || symbol.d_tag == DT_MIPS_RLD_MAP_REL) && target)
{
addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize();
addr_t dyn_base = dynsym_section_sp->GetLoadBaseAddress(target);
if (dyn_base == LLDB_INVALID_ADDRESS)
return Address();
- Address addr;
+
Error error;
- if (target->ReadPointerFromMemory(dyn_base + offset, false, error, addr))
- return addr;
+ if (symbol.d_tag == DT_MIPS_RLD_MAP)
+ {
+ // DT_MIPS_RLD_MAP tag stores an absolute address of the debug pointer.
+ Address addr;
+ if (target->ReadPointerFromMemory(dyn_base + offset, false, error, addr))
+ return addr;
+ }
+ if (symbol.d_tag == DT_MIPS_RLD_MAP_REL)
+ {
+ // DT_MIPS_RLD_MAP_REL tag stores the offset to the debug pointer, relative to the address of the tag.
+ uint64_t rel_offset;
+ rel_offset = target->ReadUnsignedIntegerFromMemory(dyn_base + offset, false, GetAddressByteSize(), UINT64_MAX, error);
+ if (error.Success() && rel_offset != UINT64_MAX)
+ {
+ Address addr;
+ addr_t debug_ptr_address = dyn_base + (offset - GetAddressByteSize()) + rel_offset;
+ addr.SetOffset (debug_ptr_address);
+ return addr;
+ }
+ }
}
}
OpenPOWER on IntegriCloud