summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>2017-05-09 19:38:38 +0000
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>2017-05-09 19:38:38 +0000
commit15fa44698cbf525d604961c82d72f54064ab4f40 (patch)
treea5b9f8bb7478b67a05fe9bd2563a52dc47485fa6 /llvm/lib/DebugInfo
parent674deed94ed786a6eb9e2812f0fe7bfa861ab84e (diff)
downloadbcm5719-llvm-15fa44698cbf525d604961c82d72f54064ab4f40.tar.gz
bcm5719-llvm-15fa44698cbf525d604961c82d72f54064ab4f40.zip
[DWARF] Fix a parsing issue with type unit headers.
Reviewers: dblaikie Differential Revision: https://reviews.llvm.org/D32987 llvm-svn: 302574
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
index e0f81938328..25824f6eb83 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
@@ -24,7 +24,11 @@ bool DWARFTypeUnit::extractImpl(DataExtractor debug_info,
return false;
TypeHash = debug_info.getU64(offset_ptr);
TypeOffset = debug_info.getU32(offset_ptr);
- return TypeOffset < getLength();
+ // TypeOffset is relative to the beginning of the header,
+ // so we have to account for the leading length field.
+ // FIXME: The size of the length field is 12 in DWARF64.
+ unsigned SizeOfLength = 4;
+ return TypeOffset < getLength() + SizeOfLength;
}
void DWARFTypeUnit::dump(raw_ostream &OS, bool SummarizeTypes) {
OpenPOWER on IntegriCloud