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();
        }
Example #2
0
 public static void Print(this DwarfUnit unit, TextWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException(nameof(writer));
     }
     writer.WriteLine("Contents of the .debug_info section:");
     writer.WriteLine();
     writer.WriteLine($"  Compilation Unit @ offset 0x{unit.Offset:x}:");
     writer.WriteLine($"   Length:        0x{unit.UnitLength:x}");
     writer.WriteLine($"   Version:       {unit.Version}");
     writer.WriteLine($"   Abbrev Offset: 0x{unit.Abbreviation?.Offset ?? 0:x}");
     writer.WriteLine($"   Pointer Size:  {(uint)unit.AddressSize}");
     if (unit.Root != null)
     {
         Print(unit.Root, writer);
     }
 }
Example #3
0
 public void AddUnit(DwarfUnit unit)
 {
     _units.Add <DwarfContainer, DwarfUnit>(this, unit);
 }
Example #4
0
 public void RemoveUnit(DwarfUnit unit)
 {
     _units.Remove(this, unit);
 }
Example #5
0
 public void AddUnit(DwarfUnit unit)
 {
     _units.Add(this, unit);
 }