[Lldb-commits] [lldb] r247666 - [LLDB][MIPS] Add support for DT_MIPS_RLD_MAP_REL
Bhushan D. Attarde via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 14 22:45:29 PDT 2015
Author: bhushan.attarde
Date: Tue Sep 15 00:45:29 2015
New Revision: 247666
URL: http://llvm.org/viewvc/llvm-project?rev=247666&view=rev
Log:
[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
Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=247666&r1=247665&r2=247666&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Tue Sep 15 00:45:29 2015
@@ -1097,16 +1097,35 @@ ObjectFileELF::GetImageInfoAddress(Targe
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;
+ }
+ }
}
}
More information about the lldb-commits
mailing list