summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Maste <emaste@freebsd.org>2013-10-11 17:39:07 +0000
committerEd Maste <emaste@freebsd.org>2013-10-11 17:39:07 +0000
commit5480365b2566c4cf4360de76b3540bc9f1c5e5e6 (patch)
tree693c26344021e5db9723a126c33eb798cc20932c
parent1d27ffd6978b73f25b800097c517db768eb53cc0 (diff)
downloadbcm5719-llvm-5480365b2566c4cf4360de76b3540bc9f1c5e5e6.tar.gz
bcm5719-llvm-5480365b2566c4cf4360de76b3540bc9f1c5e5e6.zip
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 llvm-svn: 192469
-rw-r--r--lldb/include/lldb/Symbol/ObjectFile.h2
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp17
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h2
-rw-r--r--lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp17
-rw-r--r--lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp17
5 files changed, 20 insertions, 35 deletions
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index b4a78e73bcc..03c21645ccf 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 (bool &indirect) { indirect = false; return Address(); }
+ GetImageInfoAddress (Target *target) { 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 00204e1ec0a..163e713bedb 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -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(FileSpecList &files)
}
Address
-ObjectFileELF::GetImageInfoAddress(bool &indirect)
+ObjectFileELF::GetImageInfoAddress(Target *target)
{
if (!ParseDynamicSymbols())
return Address();
@@ -539,14 +540,24 @@ ObjectFileELF::GetImageInfoAddress(bool &indirect)
{
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();
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index 1ee7979ef0e..ede886fb4f6 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(bool &indirect);
+ GetImageInfoAddress(lldb_private::Target *target);
virtual lldb_private::Address
GetEntryPointAddress ();
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
index a1511014009..70ad3a66d9e 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
+++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
@@ -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;
}
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index fa2265167ec..c793be614eb 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -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;
}
OpenPOWER on IntegriCloud