Class: ElfUtils::Section::DebugAbbrev::AbbreviationTable

Inherits:
Object
  • Object
show all
Defined in:
lib/elf_utils/section/debug_abbrev/abbreviation_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf) ⇒ AbbreviationTable

Returns a new instance of AbbreviationTable.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/elf_utils/section/debug_abbrev/abbreviation_table.rb', line 3

def initialize(buf)
  @declarations = {}
  @abbrevs = {}

  # XXX CTypes needs a terminated array where we check the remaining bytes
  # before decoding.
  until buf[0].ord == 0
    decl, buf = ElfUtils::Types::Dwarf::AbbreviationDeclaration.unpack_one(buf)
    @declarations[decl.code] = decl
    @abbrevs[decl.code] = Abbreviation.new(self, decl)
  end
end

Instance Attribute Details

#declarationsObject (readonly)

Returns the value of attribute declarations.



15
16
17
# File 'lib/elf_utils/section/debug_abbrev/abbreviation_table.rb', line 15

def declarations
  @declarations
end

Instance Method Details

#[](code) ⇒ Object



17
18
19
# File 'lib/elf_utils/section/debug_abbrev/abbreviation_table.rb', line 17

def [](code)
  @abbrevs[code]
end

#entriesObject



21
22
23
# File 'lib/elf_utils/section/debug_abbrev/abbreviation_table.rb', line 21

def entries
  @abbrevs.values
end