summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-04-24 10:19:45 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-04-24 10:19:45 +0000
commitca53211beb5e552ed1c661844f333726eca8fd50 (patch)
tree81a65785491f6dfd449043c21bac08dfb99867f5 /llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
parentdf0497c4aaabd119d5d835bce6339be8fed58602 (diff)
downloadbcm5719-llvm-ca53211beb5e552ed1c661844f333726eca8fd50.tar.gz
bcm5719-llvm-ca53211beb5e552ed1c661844f333726eca8fd50.zip
[DWARF] - Take relocations in account when extracting ranges from .debug_ranges
I found this when investigated "Bug 32319 - .gdb_index is broken/incomplete" for LLD. When we have object file with .debug_ranges section it may be filled with zeroes. Relocations are exist in file to relocate this zeroes into real values later, but until that a pair of zeroes is treated as terminator. And DWARF parser thinks there is no ranges at all when I am trying to collect address ranges for building .gdb_index. Solution implemented in this patch is to take relocations in account when parsing ranges. Differential revision: https://reviews.llvm.org/D32228 llvm-svn: 301170
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
index f1d82fda8c0..9380fe8fe85 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
@@ -22,7 +23,8 @@ void DWARFDebugRangeList::clear() {
Entries.clear();
}
-bool DWARFDebugRangeList::extract(DataExtractor data, uint32_t *offset_ptr) {
+bool DWARFDebugRangeList::extract(DataExtractor data, uint32_t *offset_ptr,
+ const RelocAddrMap &Relocs) {
clear();
if (!data.isValidOffset(*offset_ptr))
return false;
@@ -33,8 +35,11 @@ bool DWARFDebugRangeList::extract(DataExtractor data, uint32_t *offset_ptr) {
while (true) {
RangeListEntry entry;
uint32_t prev_offset = *offset_ptr;
- entry.StartAddress = data.getAddress(offset_ptr);
- entry.EndAddress = data.getAddress(offset_ptr);
+ entry.StartAddress =
+ getRelocatedValue(data, AddressSize, offset_ptr, &Relocs);
+ entry.EndAddress =
+ getRelocatedValue(data, AddressSize, offset_ptr, &Relocs);
+
// Check that both values were extracted correctly.
if (*offset_ptr != prev_offset + 2 * AddressSize) {
clear();
OpenPOWER on IntegriCloud