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 (Integer)

    the offset of the hints table

  • nhints (Integer)

    the number of two-level hints in the table



981
982
983
984
985
986
987
# File 'lib/macho/load_commands.rb', line 981

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:



975
976
977
# File 'lib/macho/load_commands.rb', line 975

def hints
  @hints
end