Example #1
0
        protected override void Read(DwarfReader reader)
        {
            var addressRangeTable = reader.File.AddressRangeTable;

            while (reader.Offset < reader.Length)
            {
                // 7.5 Format of Debugging Information
                // - Each such contribution consists of a compilation unit header

                var startOffset = Offset;

                reader.ClearResolveAttributeReferenceWithinCompilationUnit();

                var cu = DwarfUnit.ReadInstance(reader, out var offsetEndOfUnit);
                if (cu == null)
                {
                    reader.Offset = offsetEndOfUnit;
                    continue;
                }

                reader.CurrentUnit = cu;

                // Link AddressRangeTable to Unit
                if (addressRangeTable.DebugInfoOffset == cu.Offset)
                {
                    addressRangeTable.Unit = cu;
                }

                AddUnit(cu);
            }

            reader.ResolveAttributeReferenceWithinSection();
        }