[Lldb-commits] [lldb] r192469 - Simplify indirect rld_map for mips (rework r192408).
Ed Maste
emaste at freebsd.org
Fri Oct 11 10:39:07 PDT 2013
Author: emaste
Date: Fri Oct 11 12:39:07 2013
New Revision: 192469
URL: http://llvm.org/viewvc/llvm-project?rev=192469&view=rev
Log:
Simplify indirect rld_map for mips (rework r192408).
Just pass a Target* into ObjectFileELF::GetImageInfoAddress so that
it can do the extra dereference necessary on MIPS, instead of passing
a flag back to the caller.
Review: http://llvm-reviews.chandlerc.com/D1899
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=192469&r1=192468&r2=192469&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Fri Oct 11 12:39:07 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 (bool &indirect) { indirect = false; return Address(); }
+ GetImageInfoAddress (Target *target) { 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=192469&r1=192468&r2=192469&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri Oct 11 12:39:07 2013
@@ -23,6 +23,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/Target.h"
#include "lldb/Host/Host.h"
#include "llvm/ADT/PointerUnion.h"
@@ -515,7 +516,7 @@ ObjectFileELF::GetDependentModules(FileS
}
Address
-ObjectFileELF::GetImageInfoAddress(bool &indirect)
+ObjectFileELF::GetImageInfoAddress(Target *target)
{
if (!ParseDynamicSymbols())
return Address();
@@ -539,14 +540,24 @@ ObjectFileELF::GetImageInfoAddress(bool
{
ELFDynamic &symbol = m_dynamic_symbols[i];
- if (symbol.d_tag == DT_DEBUG || symbol.d_tag == DT_MIPS_RLD_MAP)
+ if (symbol.d_tag == DT_DEBUG)
{
- 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();
return Address(dynsym_section_sp, offset);
}
+ else if (symbol.d_tag == DT_MIPS_RLD_MAP && 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;
+ }
}
return Address();
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=192469&r1=192468&r2=192469&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h Fri Oct 11 12:39:07 2013
@@ -127,7 +127,7 @@ public:
GetDependentModules(lldb_private::FileSpecList& files);
virtual lldb_private::Address
- GetImageInfoAddress(bool &indirect);
+ GetImageInfoAddress(lldb_private::Target *target);
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=192469&r1=192468&r2=192469&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIX.cpp Fri Oct 11 12:39:07 2013
@@ -289,23 +289,10 @@ ProcessPOSIX::GetImageInfoAddress()
{
Target *target = &GetTarget();
ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile();
- bool indirect;
- Address addr = obj_file->GetImageInfoAddress(indirect);
+ Address addr = obj_file->GetImageInfoAddress(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 addr.GetLoadAddress(target);
return LLDB_INVALID_ADDRESS;
}
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=192469&r1=192468&r2=192469&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Fri Oct 11 12:39:07 2013
@@ -338,23 +338,10 @@ ProcessElfCore::GetImageInfoAddress()
{
Target *target = &GetTarget();
ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile();
- bool indirect;
- Address addr = obj_file->GetImageInfoAddress(indirect);
+ Address addr = obj_file->GetImageInfoAddress(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 addr.GetLoadAddress(target);
return LLDB_INVALID_ADDRESS;
}
More information about the lldb-commits
mailing list