Class: MachO::Headers::FatArch

Inherits:
MachOStructure show all
Defined in:
lib/macho/headers.rb

Overview

Note:

"32-bit" indicates the fact that this structure stores 32-bit offsets, not that the Mach-Os that it points to necessarily are 32-bit.

32-bit fat binary header architecture structure. A 32-bit fat Mach-O has one or more of these, indicating one or more internal Mach-O blobs.

See Also:

Direct Known Subclasses

FatArch64

Instance Method Summary collapse

Methods inherited from MachOStructure

bytesize, format, #initialize, new_from_bin

Constructor Details

This class inherits a constructor from MachO::MachOStructure

Instance Method Details

#alignInteger

Returns the alignment, as a power of 2.

Returns:

  • (Integer)

    the alignment, as a power of 2



547
# File 'lib/macho/headers.rb', line 547

field :align, :uint32, :endian => :big

#cpusubtypeInteger

Returns the CPU subtype of the Mach-O.

Returns:

  • (Integer)

    the CPU subtype of the Mach-O



538
# File 'lib/macho/headers.rb', line 538

field :cpusubtype, :uint32, :endian => :big, :mask => CPU_SUBTYPE_MASK

#cputypeInteger

Returns the CPU type of the Mach-O.

Returns:

  • (Integer)

    the CPU type of the Mach-O



535
# File 'lib/macho/headers.rb', line 535

field :cputype, :uint32, :endian => :big

#offsetInteger

Returns the file offset to the beginning of the Mach-O data.

Returns:

  • (Integer)

    the file offset to the beginning of the Mach-O data



541
# File 'lib/macho/headers.rb', line 541

field :offset, :uint32, :endian => :big

#serializeString

Returns the serialized fields of the fat arch.

Returns:

  • (String)

    the serialized fields of the fat arch



550
551
552
# File 'lib/macho/headers.rb', line 550

def serialize
  [cputype, cpusubtype, offset, size, align].pack(self.class.format)
end

#sizeInteger

Returns the size, in bytes, of the Mach-O data.

Returns:

  • (Integer)

    the size, in bytes, of the Mach-O data



544
# File 'lib/macho/headers.rb', line 544

field :size, :uint32, :endian => :big

#to_hHash

Returns a hash representation of this MachO::Headers::FatArch.

Returns:



555
556
557
558
559
560
561
562
563
564
565
# File 'lib/macho/headers.rb', line 555

def to_h
  {
    "cputype" => cputype,
    "cputype_sym" => CPU_TYPES[cputype],
    "cpusubtype" => cpusubtype,
    "cpusubtype_sym" => CPU_SUBTYPES[cputype][cpusubtype],
    "offset" => offset,
    "size" => size,
    "align" => align,
  }.merge super
end