Class: ElfUtils::Types::Dwarf::UnitHeader Private

Inherits:
CTypes::Union
  • Object
show all
Defined in:
lib/elf_utils/types/dwarf.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

common unit header used within various debug sections

Instance Method Summary collapse

Instance Method Details

#addr_typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



390
391
392
393
394
395
396
397
# File 'lib/elf_utils/types/dwarf.rb', line 390

def addr_type
  case format
  when :dwarf64
    CTypes::Helpers.uint64.with_endian(@endian)
  when :dwarf32
    CTypes::Helpers.uint32.with_endian(@endian)
  end
end

#formatObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



361
362
363
364
365
366
367
368
369
370
# File 'lib/elf_utils/types/dwarf.rb', line 361

def format
  case unit_length
  when 0xffffffff
    :dwarf64
  when proc { |v| v < 0xfffffff0 }
    :dwarf32
  else
    raise Error, "unsupported format: 0x%08x" % hdr[:unit_length]
  end
end

#innerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



372
373
374
375
376
# File 'lib/elf_utils/types/dwarf.rb', line 372

def inner
  # PERF: we're caching this here because the Union type will do a bunch
  # of extra work if we keep accessing the union via different members.
  @inner ||= send(format)
end

#typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



386
387
388
# File 'lib/elf_utils/types/dwarf.rb', line 386

def type
  :"#{format}_v#{version}"
end

#unit_sizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



382
383
384
# File 'lib/elf_utils/types/dwarf.rb', line 382

def unit_size
  inner.unit_length + inner.class.offsetof(:version)
end

#versionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



378
379
380
# File 'lib/elf_utils/types/dwarf.rb', line 378

def version
  inner.version
end