module Dwarftree::DIE

Debugging Information Entry

Constants

ArrayType
BaseType
CompileUnit
ConstType
DwarfProcedure
EnumerationType
Enumerator
FormalParameter
GNUCallSite
GNUCallSiteParameter
InlinedSubroutine
Label
LexicalBlock
Member
PointerType
RestrictType
StructureType
Subprogram
SubrangeType
SubroutineType
Typedef
UnionType
UnspecifiedParameters
Variable
VolatileType

Attributes

attributes[RW]

Public Class Methods

members() click to toggle source
# File lib/dwarftree/die.rb, line 9
def self.members
  []
end
new(*args, &block) click to toggle source
# File lib/dwarftree/die.rb, line 24
def self.new(*args, &block)
  Struct.new(*args, keyword_init: true) do
    class << self
      attr_accessor :attributes
    end
    self.attributes = members

    # Not in members to avoid a conflict with DIE attributes
    attr_accessor :type, :level, :children, :merged

    def initialize(**kwargs)
      begin
      super
      rescue => e
        binding.irb
      end
      self.children = []
      self.merged = []
    end
new(**kwargs) click to toggle source
Calls superclass method
# File lib/dwarftree/die.rb, line 34
def initialize(**kwargs)
  begin
  super
  rescue => e
    binding.irb
  end
  self.children = []
  self.merged = []
end

Public Instance Methods

attributes() click to toggle source
# File lib/dwarftree/die.rb, line 44
def attributes
  attrs = {}
  self.class.attributes.each do |attr|
    if value = send(attr)
      attrs[attr] = value
    end
  end
  attrs
end
new(*args, **_opts, &block) click to toggle source
Calls superclass method
# File lib/dwarftree/die.rb, line 5
def new(*args, **_opts, &block)
  if args.empty?
    # Pseudo Struct for no-member DIE
    Class.new do
      def self.members
        []
      end

      if block
        class_exec(&block)
      end
    end
  else
    super
  end
end