[llvm][dwwarf] Change CU/TU index to 64-bit

Changed contribution data structure to 64 bit. I added the 32bit and 64bit
accessors to make it explicit where we use 32bit and where we use 64bit. Also to
make sure sure we catch all the cases where this data structure is used.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D139379
This commit is contained in:
Alexander Yermolovich
2023-01-10 10:33:23 -08:00
parent 35acc32b3e
commit fa3fa4d0d4
24 changed files with 195 additions and 159 deletions

View File

@@ -341,7 +341,7 @@ void DWARFUnit::SetDwoStrOffsetsBase() {
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
if (const auto *contribution =
entry->getContribution(llvm::DW_SECT_STR_OFFSETS))
baseOffset = contribution->Offset;
baseOffset = contribution->getOffset32();
else
return;
}
@@ -489,7 +489,7 @@ void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) {
*GetDWOId());
return;
}
offset += contribution->Offset;
offset += contribution->getOffset32();
}
m_loclists_base = loclists_base;
@@ -527,8 +527,8 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const {
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
if (const auto *contribution = entry->getContribution(
GetVersion() >= 5 ? llvm::DW_SECT_LOCLISTS : llvm::DW_SECT_EXT_LOC))
return DWARFDataExtractor(data, contribution->Offset,
contribution->Length);
return DWARFDataExtractor(data, contribution->getOffset32(),
contribution->getLength32());
return DWARFDataExtractor();
}
return data;
@@ -540,8 +540,8 @@ DWARFDataExtractor DWARFUnit::GetRnglistData() const {
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
if (const auto *contribution =
entry->getContribution(llvm::DW_SECT_RNGLISTS))
return DWARFDataExtractor(data, contribution->Offset,
contribution->Length);
return DWARFDataExtractor(data, contribution->getOffset32(),
contribution->getLength32());
GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
"Failed to find range list contribution for CU with signature {0:x16}",
entry->getSignature());
@@ -924,7 +924,7 @@ DWARFUnitHeader::extract(const DWARFDataExtractor &data,
"Package unit with a non-zero abbreviation offset");
}
auto *unit_contrib = header.m_index_entry->getContribution();
if (!unit_contrib || unit_contrib->Length != header.m_length + 4) {
if (!unit_contrib || unit_contrib->getLength32() != header.m_length + 4) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"Inconsistent DWARF package unit index");
}
@@ -935,7 +935,7 @@ DWARFUnitHeader::extract(const DWARFDataExtractor &data,
llvm::inconvertibleErrorCode(),
"DWARF package index missing abbreviation column");
}
header.m_abbr_offset = abbr_entry->Offset;
header.m_abbr_offset = abbr_entry->getOffset32();
}
bool length_OK = data.ValidOffset(header.GetNextUnitOffset() - 1);

View File

@@ -42,7 +42,7 @@ DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) {
if (auto *unit_contrib = entry->getContribution())
return llvm::dyn_cast_or_null<DWARFCompileUnit>(
DebugInfo().GetUnitAtOffset(DIERef::Section::DebugInfo,
unit_contrib->Offset));
unit_contrib->getOffset32()));
}
return nullptr;
}