Class: Elf::ProgBits

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, shdr = nil, data = "") ⇒ ProgBits

Returns a new instance of ProgBits.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/mithril/elf.rb', line 48

def initialize(name,shdr = nil,data = "")
  @data = StringIO.new(data)
  @name = name
  if shdr.nil?
    @addr = nil
    @flags = 0
    @align = 0
    @entsize = 0
    @sect_type = 0
  else
    @addr = shdr.vaddr
    @flags = shdr.flags
    expect_value "PROGBITS link", shdr.link, 0
    expect_value "PROGBITS info", shdr.info, 0
    @align = shdr.addralign
    @entsize = shdr.entsize # Expect 0 for now?
    @sect_type = shdr.type.to_i
    #      expect_value "PROGBITS entsize", @entsize,0
    expect_value "Progbits must be full present", @data.size, shdr.siz
  end
  
end

Instance Attribute Details

#addrObject

Returns the value of attribute addr.



45
46
47
# File 'lib/mithril/elf.rb', line 45

def addr
  @addr
end

#alignObject

Returns the value of attribute align.



45
46
47
# File 'lib/mithril/elf.rb', line 45

def align
  @align
end

#dataObject

Returns the value of attribute data.



45
46
47
# File 'lib/mithril/elf.rb', line 45

def data
  @data
end

#entsizeObject

Returns the value of attribute entsize.



45
46
47
# File 'lib/mithril/elf.rb', line 45

def entsize
  @entsize
end

#flagsObject

Returns the value of attribute flags.



45
46
47
# File 'lib/mithril/elf.rb', line 45

def flags
  @flags
end

#nameObject

Returns the value of attribute name.



45
46
47
# File 'lib/mithril/elf.rb', line 45

def name
  @name
end

#phdrObject

Makes a PHDR for this section



46
47
48
# File 'lib/mithril/elf.rb', line 46

def phdr
  @phdr
end

#phdr_flagsObject

Makes a PHDR for this section



46
47
48
# File 'lib/mithril/elf.rb', line 46

def phdr_flags
  @phdr_flags
end

#sect_typeObject

Returns the value of attribute sect_type.



47
48
49
# File 'lib/mithril/elf.rb', line 47

def sect_type
  @sect_type
end

Instance Method Details

#sizeObject



70
71
72
# File 'lib/mithril/elf.rb', line 70

def size
  @data.size
end