Class: MachO::LoadCommands::TwolevelHintsCommand::TwolevelHintsTable

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

Overview

A representation of the two-level namespace lookup hints table exposed by a MachO::LoadCommands::TwolevelHintsCommand (LC_TWOLEVEL_HINTS).

Defined Under Namespace

Classes: TwolevelHint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, htoffset, nhints) ⇒ TwolevelHintsTable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TwolevelHintsTable.

Parameters:

  • view (MachO::MachOView)

    the view into the current Mach-O

  • htoffset (Fixnum)

    the offset of the hints table

  • nhints (Fixnum)

    the number of two-level hints in the table



904
905
906
907
908
909
910
# File 'lib/macho/load_commands.rb', line 904

def initialize(view, htoffset, nhints)
  format = Utils.specialize_format("L=#{nhints}", view.endianness)
  raw_table = view.raw_data[htoffset, nhints * 4]
  blobs = raw_table.unpack(format)

  @hints = blobs.map { |b| TwolevelHint.new(b) }
end

Instance Attribute Details

#hintsArray<TwolevelHint> (readonly)

Returns all hints in the table.

Returns:



898
899
900
# File 'lib/macho/load_commands.rb', line 898

def hints
  @hints
end