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
This commit is contained in:
Alexey Samsonov
2013-10-28 23:01:48 +00:00
parent 730e3c6995
commit c5253237f8
7 changed files with 202 additions and 75 deletions

View File

@@ -144,7 +144,7 @@ uint64_t DWARFUnit::getDWOId() {
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 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
// 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();