Class: MachO::LoadCommands::BuildVersionCommand

Inherits:
LoadCommand show all
Defined in:
lib/macho/load_commands.rb

Overview

A load command containing the minimum OS version on which the binary was built for its platform. Corresponds to LC_BUILD_VERSION.

Defined Under Namespace

Classes: ToolEntries

Instance Method Summary collapse

Methods inherited from LoadCommand

#cmd, #cmdsize, create, new_from_bin, #offset, #serializable?, #serialize, #to_s, #type, #view

Methods inherited from MachOStructure

bytesize, format, #initialize, new_from_bin

Constructor Details

This class inherits a constructor from MachO::MachOStructure

Instance Method Details

#minosInteger

Returns the minimum OS version X.Y.Z packed as x16.y8.z8.

Returns:

  • (Integer)

    the minimum OS version X.Y.Z packed as x16.y8.z8



1164
# File 'lib/macho/load_commands.rb', line 1164

field :minos, :uint32

#minos_stringString

A string representation of the binary's minimum OS version.

Returns:

  • (String)

    a string representing the minimum OS version.



1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/macho/load_commands.rb', line 1174

def minos_string
  binary = "%032<minos>b" % { :minos => minos }
  segs = [
    binary[0..15], binary[16..23], binary[24..31]
  ].map { |s| s.to_i(2) }

  segs.join(".")
end

#platformInteger

Returns:

  • (Integer)


1161
# File 'lib/macho/load_commands.rb', line 1161

field :platform, :uint32

#sdkInteger

Returns the SDK version X.Y.Z packed as x16.y8.z8.

Returns:

  • (Integer)

    the SDK version X.Y.Z packed as x16.y8.z8



1167
# File 'lib/macho/load_commands.rb', line 1167

field :sdk, :uint32

#sdk_stringString

A string representation of the binary's SDK version.

Returns:

  • (String)

    a string representing the SDK version.



1185
1186
1187
1188
1189
1190
1191
1192
# File 'lib/macho/load_commands.rb', line 1185

def sdk_string
  binary = "%032<sdk>b" % { :sdk => sdk }
  segs = [
    binary[0..15], binary[16..23], binary[24..31]
  ].map { |s| s.to_i(2) }

  segs.join(".")
end

#to_hHash

Returns a hash representation of this MachO::LoadCommands::BuildVersionCommand.

Returns:



1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
# File 'lib/macho/load_commands.rb', line 1195

def to_h
  {
    "platform" => platform,
    "minos" => minos,
    "minos_string" => minos_string,
    "sdk" => sdk,
    "sdk_string" => sdk_string,
    "tool_entries" => tool_entries.tools.map(&:to_h),
  }.merge super
end

#tool_entriesToolEntries

Returns tool entries.

Returns:



1170
# File 'lib/macho/load_commands.rb', line 1170

field :tool_entries, :tool_entries