Class: OdinFlex::MachO::LC_LOAD_DYLIB

Inherits:
Command
  • Object
show all
Defined in:
lib/odinflex/mach-o.rb

Constant Summary collapse

VALUE =
0xc

Instance Attribute Summary

Attributes inherited from Command

#cmd, #size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#command?, from_offset

Methods included from SectionTypes

#command?, #dysymtab?, #section?, #segment?, #symtab?

Constructor Details

#initialize(cmd, size, name, str_offset, timestamp, current_version, compat_version) ⇒ LC_LOAD_DYLIB

Returns a new instance of LC_LOAD_DYLIB.



136
137
138
139
140
141
142
143
# File 'lib/odinflex/mach-o.rb', line 136

def initialize cmd, size, name, str_offset, timestamp, current_version, compat_version
  super(cmd, size)
  @name            = name
  @str_offset      = str_offset
  @timestamp       = timestamp
  @current_version = current_version
  @compat_version  = compat_version
end

Class Method Details

.from_io(cmd, size, offset, io) ⇒ Object



127
128
129
130
131
132
133
134
# File 'lib/odinflex/mach-o.rb', line 127

def self.from_io cmd, size, offset, io
  # `size` is the total segment size including command and length bytes
  # so we need to remove them from the size.
  args = io.read(4 * 4).unpack('LLLL')
  io.seek offset + args.first, IO::SEEK_SET
  name = io.read(size - 8 - (4 * 4)).unpack1('A*')
  new(cmd, size, name, *args)
end