class Metasm::ELF::DwarfDebug::Node

Attributes

attributes[RW]
children[RW]
parent[RW]

Public Instance Methods

decode(elf, info, abbrev, str, idx_abbroff) click to toggle source
Calls superclass method Metasm::SerialStruct#decode
# File metasm/exe_format/elf_decode.rb, line 824
def decode(elf, info, abbrev, str, idx_abbroff)
        super(elf, abbrev)
        return if @index == 0
        @attributes = []
        loop {
                a = Attribute.decode(elf, abbrev)
                break if a.attr == 0 and a.form == 0
                if a.form == 'INDIRECT'    # actual form tag is stored in info
                        a.form = elf.decode_leb(info)
                        a.form = DWARF_FORM[a.form] || a.form     # XXX INDIRECT again ?
                end
                a.data = case a.form
                when 'ADDR'; elf.decode_xword(info)        # should use dbg.ptr_sz
                when 'DATA1', 'REF1', 'BLOCK1', 'FLAG'; elf.decode_byte(info)
                when 'DATA2', 'REF2', 'BLOCK2'; elf.decode_half(info)
                when 'DATA4', 'REF4', 'BLOCK4'; elf.decode_word(info)
                when 'DATA8', 'REF8', 'BLOCK8'; elf.decode_word(info) | (elf.decode_word(info) << 32)
                when 'SDATA', 'UDATA', 'REF_UDATA', 'BLOCK'; elf.decode_leb(info)
                when 'STRING'; elf.decode_strz(info)
                when 'STRP'; str.ptr = elf.decode_word(info) ; elf.decode_strz(str)
                end
                case a.form
                when /^REF/
                when /^BLOCK/; a.data = info.read(a.data)
                end
                @attributes << a
        }
end