Class: MachO::LoadCommand
- Inherits:
-
MachOStructure
- Object
- MachOStructure
- MachO::LoadCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
Mach-O load command structure This is the most generic load command - only cmd ID and size are represented, and no actual data. Used when a more specific class isn’t available/implemented.
Direct Known Subclasses
DyldInfoCommand, DylibCommand, DylinkerCommand, DysymtabCommand, EncryptionInfoCommand, EncryptionInfoCommand64, EntryPointCommand, LinkeditDataCommand, LinkerOptionCommand, PrebindCksumCommand, PreboundDylibCommand, RoutinesCommand, RoutinesCommand64, RpathCommand, SegmentCommand, SegmentCommand64, SourceVersionCommand, SubClientCommand, SubFrameworkCommand, SubLibraryCommand, SubUmbrellaCommand, SymtabCommand, ThreadCommand, TwolevelHintsCommand, UUIDCommand, VersionMinCommand
Instance Attribute Summary collapse
-
#cmd ⇒ Fixnum
readonly
The load command’s identifying number.
-
#cmdsize ⇒ Fixnum
readonly
The size of the load command, in bytes.
-
#offset ⇒ Fixnum
readonly
The offset in the file the command was created from.
Class Method Summary collapse
-
.new_from_bin(offset, bin) ⇒ MachO::LoadCommand
Creates a new LoadCommand given an offset and binary string.
Instance Method Summary collapse
-
#initialize(offset, cmd, cmdsize) ⇒ LoadCommand
constructor
A new instance of LoadCommand.
-
#to_s ⇒ String
A string representation of the load command’s identifying number.
Methods inherited from MachOStructure
Constructor Details
#initialize(offset, cmd, cmdsize) ⇒ LoadCommand
Returns a new instance of LoadCommand.
315 316 317 318 319 |
# File 'lib/macho/load_commands.rb', line 315 def initialize(offset, cmd, cmdsize) @offset = offset @cmd = cmd @cmdsize = cmdsize end |
Instance Attribute Details
#cmd ⇒ Fixnum (readonly)
Returns the load command’s identifying number.
294 295 296 |
# File 'lib/macho/load_commands.rb', line 294 def cmd @cmd end |
#cmdsize ⇒ Fixnum (readonly)
Returns the size of the load command, in bytes.
297 298 299 |
# File 'lib/macho/load_commands.rb', line 297 def cmdsize @cmdsize end |
#offset ⇒ Fixnum (readonly)
Returns the offset in the file the command was created from.
291 292 293 |
# File 'lib/macho/load_commands.rb', line 291 def offset @offset end |
Class Method Details
.new_from_bin(offset, bin) ⇒ MachO::LoadCommand
Creates a new LoadCommand given an offset and binary string
307 308 309 |
# File 'lib/macho/load_commands.rb', line 307 def self.new_from_bin(offset, bin) self.new(offset, *bin.unpack(@format)) end |
Instance Method Details
#to_s ⇒ String
Returns a string representation of the load command’s identifying number.
322 323 324 |
# File 'lib/macho/load_commands.rb', line 322 def to_s LOAD_COMMANDS[cmd] end |