Class: WORF::DIE

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/worf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, offset, attributes, children) ⇒ DIE

Returns a new instance of DIE.



173
174
175
176
177
178
# File 'lib/worf.rb', line 173

def initialize tag, offset, attributes, children
  @tag        = tag
  @offset     = offset
  @attributes = attributes
  @children   = children
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



171
172
173
# File 'lib/worf.rb', line 171

def attributes
  @attributes
end

#childrenObject (readonly)

Returns the value of attribute children.



171
172
173
# File 'lib/worf.rb', line 171

def children
  @children
end

#offsetObject (readonly)

Returns the value of attribute offset.



171
172
173
# File 'lib/worf.rb', line 171

def offset
  @offset
end

#tagObject (readonly)

Returns the value of attribute tag.



171
172
173
# File 'lib/worf.rb', line 171

def tag
  @tag
end

Instance Method Details

#byte_sizeObject



201
202
203
# File 'lib/worf.rb', line 201

def byte_size
  at Constants::DW_AT_byte_size
end

#const_valueObject



213
214
215
# File 'lib/worf.rb', line 213

def const_value
  at Constants::DW_AT_const_value
end

#data_member_locationObject



197
198
199
# File 'lib/worf.rb', line 197

def data_member_location
  at Constants::DW_AT_data_member_location
end

#decl_fileObject



209
210
211
# File 'lib/worf.rb', line 209

def decl_file
  at Constants::DW_AT_decl_file
end

#each {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (WORF::DIE)

    the object that the method was called on



231
232
233
234
# File 'lib/worf.rb', line 231

def each &block
  yield self
  children.each { |child| child.each(&block) }
end

#find_type(child) ⇒ Object

Raises:

  • (ArgumentError)


180
181
182
183
# File 'lib/worf.rb', line 180

def find_type child
  raise ArgumentError, "DIE doesn't have a type" unless child.type
  children.bsearch { |c_die| child.type <=> c_die.offset }
end

#high_pcObject



193
194
195
# File 'lib/worf.rb', line 193

def high_pc
  at Constants::DW_AT_high_pc
end

#locationObject



185
186
187
# File 'lib/worf.rb', line 185

def location
  at Constants::DW_AT_location
end

#low_pcObject



189
190
191
# File 'lib/worf.rb', line 189

def low_pc
  at Constants::DW_AT_low_pc
end

#name(strings) ⇒ Object



217
218
219
220
221
222
223
224
225
# File 'lib/worf.rb', line 217

def name strings
  tag.attribute_info(Constants::DW_AT_name) do |form, i|
    if form == Constants::DW_FORM_string
      attributes[i]
    else
      strings.string_at(attributes[i])
    end
  end
end

#name_offsetObject



227
228
229
# File 'lib/worf.rb', line 227

def name_offset
  at Constants::DW_AT_name
end

#typeObject



205
206
207
# File 'lib/worf.rb', line 205

def type
  at Constants::DW_AT_type
end