summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-10-09 00:15:01 +0000
committerReid Kleckner <rnk@google.com>2015-10-09 00:15:01 +0000
commite94fef7b3d2efbdbd22098e4ead372033bf731ab (patch)
tree61d9953f625179af720486c1f6508f0616d3d1fc /llvm/lib/DebugInfo
parentd837cd044fd21ba182d4af49d3885dcd59a5d6a4 (diff)
downloadbcm5719-llvm-e94fef7b3d2efbdbd22098e4ead372033bf731ab.tar.gz
bcm5719-llvm-e94fef7b3d2efbdbd22098e4ead372033bf731ab.zip
[llvm-symbolizer] Make --relative-address work with DWARF contexts
Summary: Previously the relative address flag only affected PDB debug info. Now both DIContext implementations always expect to be passed virtual addresses. llvm-symbolizer is now responsible for adding ImageBase to module offsets when --relative-offset is passed. Reviewers: zturner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12883 llvm-svn: 249784
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBContext.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/llvm/lib/DebugInfo/PDB/PDBContext.cpp
index 83f27c7fa3d..ca2ae6665ce 100644
--- a/llvm/lib/DebugInfo/PDB/PDBContext.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBContext.cpp
@@ -21,24 +21,11 @@ using namespace llvm;
using namespace llvm::object;
PDBContext::PDBContext(const COFFObjectFile &Object,
- std::unique_ptr<IPDBSession> PDBSession,
- bool RelativeAddress)
+ std::unique_ptr<IPDBSession> PDBSession)
: DIContext(CK_PDB), Session(std::move(PDBSession)) {
- if (!RelativeAddress) {
- uint64_t ImageBase = 0;
- if (Object.is64()) {
- const pe32plus_header *Header = nullptr;
- Object.getPE32PlusHeader(Header);
- if (Header)
- ImageBase = Header->ImageBase;
- } else {
- const pe32_header *Header = nullptr;
- Object.getPE32Header(Header);
- if (Header)
- ImageBase = static_cast<uint64_t>(Header->ImageBase);
- }
- Session->setLoadAddress(ImageBase);
- }
+ ErrorOr<uint64_t> ImageBase = Object.getImageBase();
+ if (ImageBase)
+ Session->setLoadAddress(ImageBase.get());
}
void PDBContext::dump(raw_ostream &OS, DIDumpType DumpType) {}
OpenPOWER on IntegriCloud