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));
 }
示例#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;
        }
示例#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");
            }
        }
示例#4
0
        public DwarfAbbreviation Read(ulong abbreviationOffset)
        {
            var reader = new DwarfReaderWriter(Stream, true);

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