Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/ruby-macho-2.5.1/lib/macho/macho_file.rb
# All load commands in the file.
# @return [Array<LoadCommands::LoadCommand>] an array of load commands
# @raise [LoadCommandError] if an unknown load command is encountered
# @api private
All load commands in the file.
All load commands in the file .
def populate_load_commands
      permissive = options.fetch(:permissive, false)
      offset = header.class.bytesize
      load_commands = []
      header.ncmds.times do
        fmt = Utils.specialize_format("L=", endianness)
        cmd = @raw_data.slice(offset, 4).unpack1(fmt)
        cmd_sym = LoadCommands::LOAD_COMMANDS[cmd]
        raise LoadCommandError, cmd unless cmd_sym || permissive
        klass = if (klass_str = LoadCommands::LC_STRUCTURES[cmd_sym])
          LoadCommands.const_get klass_str
        else
          LoadCommands::LoadCommand
        end
        view = MachOView.new(@raw_data, endianness, offset)
        command = klass.new_from_bin(view)
        load_commands << command
        offset += command.cmdsize
      end
      load_commands
    end
def populate_load_commands permissive = options . fetch ( :permissive , false ) offset = header . class . bytesize load_commands = [ ] header . ncmds . times do fmt = Utils . specialize_format ( "L=" , endianness ) cmd = @raw_data . slice ( offset , 4 ) . unpack1 ( fmt ) cmd_sym = LoadCommands :: LOAD_COMMANDS [ cmd ] raise LoadCommandError , cmd unless cmd_sym || permissive klass = if ( klass_str = LoadCommands :: LC_STRUCTURES [ cmd_sym ] ) LoadCommands . const_get klass_str else LoadCommands :: LoadCommand end view = MachOView . new ( @raw_data , endianness , offset ) command = klass . new_from_bin ( view ) load_commands << command offset += command . cmdsize end load_commands end
All load commands in the file.
All load commands in the file .
# If we're here, then either cmd_sym represents a valid load # command *or* we're in permissive mode.
an array of load commands
an array of load commands
Array<LoadCommands::LoadCommand>
[LoadCommandError] if an unknown load command is encountered
[ LoadCommandError ] if an unknown load command is encountered
api
None