[llvm] [DWARF] Refactor findDebugNamesOffsets (PR #88064)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 11:13:15 PDT 2024
================
@@ -552,31 +552,22 @@ DWARFDebugNames::NameIndex::extractAbbrev(uint64_t *Offset) {
return Abbrev(Code, dwarf::Tag(Tag), AbbrevOffset, std::move(*AttrEncOr));
}
-void llvm::findDebugNamesOffsets(
- DWARFDebugNames::DWARFDebugNamesOffsets &Offsets, uint64_t HdrSize,
- dwarf::DwarfFormat Format, const DWARFDebugNames::Header &Hdr) {
- uint32_t DwarfSize = (Format == llvm::dwarf::DwarfFormat::DWARF64) ? 8 : 4;
- uint64_t Offset = HdrSize;
- Offsets.CUsBase = Offset;
- Offset += Hdr.CompUnitCount * DwarfSize;
- Offset += Hdr.LocalTypeUnitCount * DwarfSize;
- Offset += Hdr.ForeignTypeUnitCount * 8;
-
- Offsets.BucketsBase = Offset;
- Offset += Hdr.BucketCount * 4;
-
- Offsets.HashesBase = Offset;
- if (Hdr.BucketCount > 0)
- Offset += Hdr.NameCount * 4;
-
- Offsets.StringOffsetsBase = Offset;
- Offset += Hdr.NameCount * DwarfSize;
-
- Offsets.EntryOffsetsBase = Offset;
- Offset += Hdr.NameCount * DwarfSize;
-
- Offset += Hdr.AbbrevTableSize;
- Offsets.EntriesBase = Offset;
+DWARFDebugNames::DWARFDebugNamesOffsets
+dwarf::findDebugNamesOffsets(uint64_t EndOfHeaderOffset,
+ const DWARFDebugNames::Header &Hdr) {
+ DWARFDebugNames::DWARFDebugNamesOffsets Ret;
+ uint32_t DwarfSize = Hdr.Format == dwarf::DwarfFormat::DWARF64 ? 8 : 4;
----------------
MaskRay wrote:
Thanks. Adopted gerDwarfOffsetByteSize
https://github.com/llvm/llvm-project/pull/88064
More information about the llvm-commits
mailing list