protected override void Read(DwarfReader reader) { Offset = reader.Offset; var unitLength = reader.ReadUnitLength(); Is64BitEncoding = reader.Is64BitEncoding; Version = reader.ReadU16(); if (Version != 2) { reader.Diagnostics.Error(DiagnosticId.DWARF_ERR_VersionNotSupported, $"Version {Version} for .debug_aranges not supported"); return; } DebugInfoOffset = reader.ReadUIntFromEncoding(); AddressSize = reader.ReadAddressSize(); var segment_selector_size = (DwarfAddressSize)reader.ReadU8(); SegmentSelectorSize = segment_selector_size; var align = (ulong)segment_selector_size + (ulong)AddressSize * 2; // SPECS 7.21: The first tuple following the header in each set begins at an offset that is a multiple of the size of a single tuple reader.Offset = AlignHelper.AlignToUpper(reader.Offset, align); while (true) { ulong segment = 0; switch (segment_selector_size) { case DwarfAddressSize.Bit8: segment = reader.ReadU8(); break; case DwarfAddressSize.Bit16: segment = reader.ReadU16(); break; case DwarfAddressSize.Bit32: segment = reader.ReadU32(); break; case DwarfAddressSize.Bit64: segment = reader.ReadU64(); break; case DwarfAddressSize.None: break; } ulong address = 0; ulong length = 0; switch (AddressSize) { case DwarfAddressSize.Bit8: address = reader.ReadU8(); length = reader.ReadU8(); break; case DwarfAddressSize.Bit16: address = reader.ReadU16(); length = reader.ReadU16(); break; case DwarfAddressSize.Bit32: address = reader.ReadU32(); length = reader.ReadU32(); break; case DwarfAddressSize.Bit64: address = reader.ReadU64(); length = reader.ReadU64(); break; } if (segment == 0 && address == 0 && length == 0) { break; } Ranges.Add(new DwarfAddressRange(segment, address, length)); } Size = reader.Offset - Offset; }