class OdinFlex::MachO::LC_SYMTAB

Constants

SIZE
VALUE

Attributes

nlist[R]
nsyms[R]
stroff[R]
strsize[R]
symoff[R]

Public Class Methods

from_io(cmd, size, offset, io) click to toggle source
# File lib/odinflex/mach-o.rb, line 297
def self.from_io cmd, size, offset, io
  current = io.pos
  symoff, nsyms, stroff, strsize = *io.read(SIZE).unpack('L4')

  io.seek stroff, IO::SEEK_SET
  stable = io.read(strsize)

  io.seek symoff, IO::SEEK_SET

  nlist = nsyms.times.map do |i|
    index = io.read(4).unpack1 'L'
    x = stable.byteslice(index, stable.bytesize)
    unless x
      return new(cmd, size, symoff, nsyms, stroff, strsize, [])
    end
    name = x.unpack1 "Z*"
    NList.new(name, index, *io.read(1 + 1 + 2 + 8).unpack('CCsQ'))
  end
  new(cmd, size, symoff, nsyms, stroff, strsize, nlist)
ensure
  io.seek current, IO::SEEK_SET
end
new(cmd, size, symoff, nsyms, stroff, strsize, nlist) click to toggle source
Calls superclass method OdinFlex::MachO::Command::new
# File lib/odinflex/mach-o.rb, line 322
def initialize cmd, size, symoff, nsyms, stroff, strsize, nlist
  super(cmd, size)
  @symoff  = symoff
  @nsyms   = nsyms
  @stroff  = stroff
  @strsize = strsize
  @nlist   = nlist
end

Public Instance Methods

symtab?() click to toggle source
# File lib/odinflex/mach-o.rb, line 331
def symtab?; true; end