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



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

field :minos, :uint32

#minos_stringString

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

Returns:

  • (String)

    a string representing the minimum OS version.



1075
1076
1077
1078
1079
1080
1081
1082
# File 'lib/macho/load_commands.rb', line 1075

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)


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

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



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

field :sdk, :uint32

#sdk_stringString

A string representation of the binary's SDK version.

Returns:

  • (String)

    a string representing the SDK version.



1086
1087
1088
1089
1090
1091
1092
1093
# File 'lib/macho/load_commands.rb', line 1086

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:



1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
# File 'lib/macho/load_commands.rb', line 1096

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:



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

field :tool_entries, :tool_entries