Ejemplo n.º 1
0
            /// <summary>
            /// Gets the debug data description for the specified code.
            /// </summary>
            /// <param name="findCode">The code to be found.</param>
            public DataDescription GetDebugDataDescription(uint findCode)
            {
                DataDescription result;

                if (readDescriptions.TryGetValue(findCode, out result))
                {
                    return(result);
                }

                debugDataDescription.Position = lastReadPosition;
                while (!debugDataDescription.IsEnd)
                {
                    uint     code        = debugDataDescription.LEB128();
                    DwarfTag tag         = (DwarfTag)debugDataDescription.LEB128();
                    bool     hasChildren = debugDataDescription.ReadByte() != 0;
                    List <DataDescriptionAttribute> attributes = new List <DataDescriptionAttribute>();

                    while (!debugDataDescription.IsEnd)
                    {
                        DwarfAttribute attribute = (DwarfAttribute)debugDataDescription.LEB128();
                        DwarfFormat    format    = (DwarfFormat)debugDataDescription.LEB128();

                        while (format == DwarfFormat.Indirect)
                        {
                            format = (DwarfFormat)debugDataDescription.LEB128();
                        }

                        if (attribute == DwarfAttribute.None && format == DwarfFormat.None)
                        {
                            break;
                        }

                        attributes.Add(new DataDescriptionAttribute()
                        {
                            Attribute = attribute,
                            Format    = format,
                        });
                    }

                    result = new DataDescription()
                    {
                        Tag         = tag,
                        HasChildren = hasChildren,
                        Attributes  = attributes,
                    };
                    readDescriptions.Add(code, result);
                    if (code == findCode)
                    {
                        lastReadPosition = debugDataDescription.Position;
                        return(result);
                    }
                }

                throw new NotImplementedException();
            }
Ejemplo n.º 2
0
        public DwarfAbbrev CreateAbbrev(DwarfTag tag, ICollection <DwarfAbbrevAttribute> attributes, ICollection <DwarfAbbrev> children = null)
        {
            var abbr = new DwarfAbbrev
            {
                Number     = GetNewTagNumber(),
                Tag        = tag,
                Attributes = attributes,
                Children   = children
            };

            AbbrevList.Add(abbr);
            return(abbr);
        }
Ejemplo n.º 3
0
            public AbbrevEntry(DwarfReader dwarf, DwarfBinaryReader reader)
            {
                abbrev_id = reader.ReadLeb128 ();
                tag = (DwarfTag) reader.ReadLeb128 ();
                has_children = reader.ReadByte () != 0;

                Attributes = new ArrayList ();

                do {
                    int attr = reader.ReadLeb128 ();
                    int form = reader.ReadLeb128 ();

                    if ((attr == 0) && (form == 0))
                        break;

                    Attributes.Add (new AttributeEntry (
                        dwarf, (DwarfAttribute) attr, (DwarfForm) form));
                } while (true);
            }