Exemplo n.º 1
0
 public static bool TryRead(DwarfReaderWriter reader, ulong abbreviationOffset, out DwarfAbbreviation abbrev, out DiagnosticBag diagnostics)
 {
     if (reader == null)
     {
         throw new ArgumentNullException(nameof(reader));
     }
     abbrev      = new DwarfAbbreviation();
     diagnostics = new DiagnosticBag();
     return(abbrev.TryReadInternal(reader, abbreviationOffset, diagnostics));
 }
Exemplo n.º 2
0
        protected override void Read(DwarfReader reader)
        {
            var endOffset = reader.Offset;

            while (reader.Offset < reader.Length)
            {
                var abbreviation = new DwarfAbbreviation
                {
                    Offset = endOffset
                };
                abbreviation.ReadInternal(reader);
                endOffset += abbreviation.Size;
                AddAbbreviation(abbreviation);
            }

            Size = endOffset - Offset;
        }
Exemplo n.º 3
0
        public static void Print(this DwarfAbbreviation abbreviation, TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            writer.WriteLine();

            writer.WriteLine($"  Number TAG (0x{abbreviation.Offset})");

            foreach (var item in abbreviation.Items)
            {
                writer.WriteLine($"   {item.Code}      {item.Tag}    [{(item.HasChildren ? "has children" : "no children")}]");
                var descriptors = item.Descriptors;
                for (int i = 0; i < descriptors.Length; i++)
                {
                    var descriptor = descriptors[i];
                    writer.WriteLine($"    {descriptor.Kind.ToString(),-18} {descriptor.Form}");
                }
                writer.WriteLine("    DW_AT value: 0     DW_FORM value: 0");
            }
        }
Exemplo n.º 4
0
        public DwarfAbbreviation Read(ulong abbreviationOffset)
        {
            var reader = new DwarfReaderWriter(Stream, true);

            return(DwarfAbbreviation.Read(reader, abbreviationOffset));
        }
Exemplo n.º 5
0
 internal void RemoveAbbreviation(DwarfAbbreviation abbreviation)
 {
     _abbreviations.Remove(this, abbreviation);
 }
Exemplo n.º 6
0
 internal void AddAbbreviation(DwarfAbbreviation abbreviation)
 {
     _abbreviations.Add(this, abbreviation);
 }