class WORF::DebugAbbrev

Public Class Methods

new(io, section, head_pos) click to toggle source
# File lib/worf.rb, line 491
def initialize io, section, head_pos
  @io      = io
  @section = section
  @head_pos     = head_pos
end

Public Instance Methods

tags() click to toggle source
# File lib/worf.rb, line 497
def tags
  @tags ||= begin
              @io.seek @head_pos + @section.offset, IO::SEEK_SET
              tags = []
              loop do
                break if @io.pos + 1 >= @head_pos + @section.offset + @section.size
                tags << read_tag
              end
              tags
            end
end

Private Instance Methods

read_tag() click to toggle source
# File lib/worf.rb, line 511
def read_tag
  abbreviation_code = WORF.unpackULEB128 @io
  name              = WORF.unpackULEB128 @io
  children_p        = @io.readbyte == Constants::DW_CHILDREN_yes
  attr_names = []
  attr_forms = []
  loop do
    attr_name = WORF.unpackULEB128 @io
    attr_form = WORF.unpackULEB128 @io
    break if attr_name == 0 && attr_form == 0

    attr_names << attr_name
    attr_forms << attr_form
  end
  Tag.build abbreviation_code, name, children_p, attr_names, attr_forms
end