Class: Elf::NoBits

Inherits:
Object
  • Object
show all
Defined in:
lib/mithril/elf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, shdr) ⇒ NoBits

Returns a new instance of NoBits.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/mithril/elf.rb', line 76

def initialize(name,shdr)
  @name = name
  @addr = shdr.vaddr
  @flags = shdr.flags
  expect_value "NOBITS link", shdr.link, 0
  expect_value "NOBITS info", shdr.info, 0
  @align = shdr.addralign
  @entsize = shdr.entsize # Expect 0 for now?
  @size = shdr.siz
  #      expect_value "PROGBITS entsize", @entsize,0
end

Instance Attribute Details

#addrObject

Returns the value of attribute addr.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def addr
  @addr
end

#alignObject

Returns the value of attribute align.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def align
  @align
end

#flagsObject

Returns the value of attribute flags.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def flags
  @flags
end

#nameObject

Returns the value of attribute name.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def name
  @name
end

#phdrObject

Returns the value of attribute phdr.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def phdr
  @phdr
end

#phdr_flagsObject

Returns the value of attribute phdr_flags.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def phdr_flags
  @phdr_flags
end

#sizeObject

Returns the value of attribute size.



75
76
77
# File 'lib/mithril/elf.rb', line 75

def size
  @size
end

Instance Method Details

#dataObject

expect_value “PROGBITS entsize”, @entsize,0



87
88
89
90
91
# File 'lib/mithril/elf.rb', line 87

def data
  StringIO.new().tap{|x|
    BinData::Array.new(type: :uint8le,initial_length: @size).write x
  }
end

#entsizeObject



95
96
97
# File 'lib/mithril/elf.rb', line 95

def entsize
  1
end

#sect_typeObject



92
93
94
# File 'lib/mithril/elf.rb', line 92

def sect_type
  SHT::SHT_NOBITS
end