DebugInfo: Introduce the notion of "form classes"
Summary:
Use DWARF4 table of form classes to fetch attributes from DIE
in a more consistent way. This shouldn't change the functionality and
serves as a refactoring for upcoming change: DW_AT_high_pc has different
semantics depending on its form class.
Reviewers: dblaikie, echristo
Reviewed By: echristo
CC: echristo, llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1961
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193553 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/DebugInfo/DWARFUnit.cpp b/lib/DebugInfo/DWARFUnit.cpp
index 770c65b..25062cd 100644
--- a/lib/DebugInfo/DWARFUnit.cpp
+++ b/lib/DebugInfo/DWARFUnit.cpp
@@ -144,7 +144,7 @@
if (DieArray.empty())
return FailValue;
return DieArray[0]
- .getAttributeValueAsUnsigned(this, DW_AT_GNU_dwo_id, FailValue);
+ .getAttributeValueAsUnsignedConstant(this, DW_AT_GNU_dwo_id, FailValue);
}
void DWARFUnit::setDIERelations() {
@@ -251,14 +251,14 @@
// If CU DIE was just parsed, copy several attribute values from it.
if (!HasCUDie) {
uint64_t BaseAddr =
- DieArray[0].getAttributeValueAsUnsigned(this, DW_AT_low_pc, -1U);
- if (BaseAddr == -1U)
- BaseAddr = DieArray[0].getAttributeValueAsUnsigned(this, DW_AT_entry_pc, 0);
+ DieArray[0].getAttributeValueAsAddress(this, DW_AT_low_pc, -1ULL);
+ if (BaseAddr == -1ULL)
+ BaseAddr = DieArray[0].getAttributeValueAsAddress(this, DW_AT_entry_pc, 0);
setBaseAddress(BaseAddr);
- AddrOffsetSectionBase =
- DieArray[0].getAttributeValueAsReference(this, DW_AT_GNU_addr_base, 0);
- RangeSectionBase =
- DieArray[0].getAttributeValueAsReference(this, DW_AT_GNU_ranges_base, 0);
+ AddrOffsetSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
+ this, DW_AT_GNU_addr_base, 0);
+ RangeSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
+ this, DW_AT_GNU_ranges_base, 0);
}
setDIERelations();