[Lldb-commits] [lldb] r192408 - Support mips shared object debug info
Ed Maste
emaste at freebsd.org
Thu Oct 10 18:16:08 PDT 2013
Author: emaste
Date: Thu Oct 10 20:16:08 2013
New Revision: 192408
URL: http://llvm.org/viewvc/llvm-project?rev=192408&view=rev
Log:
Support mips shared object debug info
MIPS's .dyanamic section is read-only. Instead of using DT_DEBUG for
the pointer to dyld information it uses a separate tag DT_MIPS_RLD_MAP
which points to storage in the read-write .rld_map section, which in
turn points to the dyld information.
Review: http://llvm-reviews.chandlerc.com/D1890
Modified:
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=192408&r1=192407&r2=192408&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Thu Oct 10 20:16:08 2013
@@ -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
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=192408&r1=192407&r2=192408&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Oct 10 20:16:08 2013
@@ -515,7 +515,7 @@ ObjectFileELF::GetDependentModules(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();
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h?rev=192408&r1=192407&r2=192408&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Thu Oct 10 20:16:08 2013
@@ -127,7 +127,7 @@ public:
GetDependentModules(lldb_private::FileSpecList& files);
virtual lldb_private::Address
- GetImageInfoAddress();
+ GetImageInfoAddress(bool &indirect);
virtual lldb_private::Address
GetEntryPointAddress ();
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp?rev=192408&r1=192407&r2=192408&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Thu Oct 10 20:16:08 2013
@@ -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
Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=192408&r1=192407&r2=192408&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Thu Oct 10 20:16:08 2013
@@ -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;
}
More information about the lldb-commits
mailing list