internal DwarfAbbreviationItem(ulong code, DwarfTagEx tag, bool hasChildren, DwarfAttributeDescriptors descriptors)
 {
     Code        = code;
     Tag         = tag;
     HasChildren = hasChildren;
     Descriptors = descriptors;
 }
        protected override void Read(DwarfReader reader)
        {
            var itemTag = new DwarfTagEx(reader.ReadULEB128AsU32());

            Tag = itemTag;
            var  hasChildrenRaw = reader.ReadU8();
            bool hasChildren    = false;

            if (hasChildrenRaw == DwarfNative.DW_CHILDREN_yes)
            {
                hasChildren = true;
            }
            else if (hasChildrenRaw != DwarfNative.DW_CHILDREN_no)
            {
                reader.Diagnostics.Error(DiagnosticId.DWARF_ERR_InvalidData, $"Invalid children {hasChildrenRaw}. Must be either {DwarfNative.DW_CHILDREN_yes} or {DwarfNative.DW_CHILDREN_no}");
                return;
            }

            HasChildren = hasChildren;

            List <DwarfAttributeDescriptor> descriptors = null;

            while (true)
            {
                var attributeName = new DwarfAttributeKindEx(reader.ReadULEB128AsU32());
                var attributeForm = new DwarfAttributeFormEx(reader.ReadULEB128AsU32());

                if (attributeForm.Value == 0 && attributeForm.Value == 0)
                {
                    break;
                }

                if (descriptors == null)
                {
                    descriptors = new List <DwarfAttributeDescriptor>(1);
                }
                descriptors.Add(new DwarfAttributeDescriptor(attributeName, attributeForm));
            }

            Descriptors = descriptors != null ? new DwarfAttributeDescriptors(descriptors.ToArray()) : new DwarfAttributeDescriptors();

            Size = reader.Offset - Offset;
        }
Exemple #3
0
 protected DwarfDIE(DwarfTagEx tag)
 {
     _tag = tag;
 }
 public DwarfAbbreviationItemKey(DwarfTagEx tag, bool hasChildren, DwarfAttributeDescriptors descriptors)
 {
     Tag         = tag;
     HasChildren = hasChildren;
     Descriptors = descriptors;
 }