class Dwarves::Parser::DIE

The basic DWARF descriptive unit, the Debugging Information Entry (DIE).

This is a node in the parse tree that DWARF generates.

These represent types, variables, and functions.

Public Class Methods

new(opts = {}) click to toggle source
# File lib/dwarves/parser/4/ast.rb, line 23
def initialize opts = {}
  @tag = opts[:tag]
  @children = opts[:children] || []
  @siblings = opts[:siblings] || []
  @attributes = opts[:attributes] || []
  @address = opts[:address]
  @depth = opts[:depth]
  @abbrev_number = opts[:abbrev_number]
end

Public Instance Methods

to_s() click to toggle source
# File lib/dwarves/parser/4/ast.rb, line 33
def to_s
  attrs = if @attributes.empty?
            ""
          else
            %(\n#{@attributes.map(&:to_s).join("\n")})
          end
  depth_addr =
    "<#{@depth}><#{@address}>: Abbrev Number: #{@abbrev_number}"

  if @tag
    " #{depth_addr} (#{@tag})#{attrs}"
  else
    " #{depth_addr}#{attrs}"
  end
end