Class: MachO::SegmentCommand

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

Overview

A load command indicating that part of this file is to be mapped into the task's address space. Corresponds to LC_SEGMENT.

Constant Summary collapse

FORMAT =
"VVa16VVVVVVVV"
SIZEOF =
56

Instance Attribute Summary collapse

Attributes inherited from LoadCommand

#cmd, #cmdsize, #offset

Instance Method Summary collapse

Methods inherited from LoadCommand

new_from_bin, #to_s, #type

Methods inherited from MachOStructure

bytesize, new_from_bin

Constructor Details

#initialize(raw_data, offset, cmd, cmdsize, segname, vmaddr, vmsize, fileoff, filesize, maxprot, initprot, nsects, flags) ⇒ SegmentCommand

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 SegmentCommand.



283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/macho/load_commands.rb', line 283

def initialize(raw_data, offset, cmd, cmdsize, segname, vmaddr, vmsize, fileoff,
		filesize, maxprot, initprot, nsects, flags)
	super(raw_data, offset, cmd, cmdsize)
	@segname = segname.delete("\x00")
	@vmaddr = vmaddr
	@vmsize = vmsize
	@fileoff = fileoff
	@filesize = filesize
	@maxprot = maxprot
	@initprot = initprot
	@nsects = nsects
	@flags = flags
end

Instance Attribute Details

#fileoffFixnum (readonly)

Returns the file offset of the segment.

Returns:

  • (Fixnum)

    the file offset of the segment



262
263
264
# File 'lib/macho/load_commands.rb', line 262

def fileoff
  @fileoff
end

#filesizeFixnum (readonly)

Returns the amount to map from the file.

Returns:

  • (Fixnum)

    the amount to map from the file



265
266
267
# File 'lib/macho/load_commands.rb', line 265

def filesize
  @filesize
end

#flagsFixnum (readonly)

Returns any flags associated with the segment.

Returns:

  • (Fixnum)

    any flags associated with the segment



277
278
279
# File 'lib/macho/load_commands.rb', line 277

def flags
  @flags
end

#initprotFixnum (readonly)

Returns the initial VM protection.

Returns:

  • (Fixnum)

    the initial VM protection



271
272
273
# File 'lib/macho/load_commands.rb', line 271

def initprot
  @initprot
end

#maxprotFixnum (readonly)

Returns the maximum VM protection.

Returns:

  • (Fixnum)

    the maximum VM protection



268
269
270
# File 'lib/macho/load_commands.rb', line 268

def maxprot
  @maxprot
end

#nsectsFixnum (readonly)

Returns the number of sections in the segment.

Returns:

  • (Fixnum)

    the number of sections in the segment



274
275
276
# File 'lib/macho/load_commands.rb', line 274

def nsects
  @nsects
end

#segnameString (readonly)

Returns the name of the segment.

Returns:

  • (String)

    the name of the segment



253
254
255
# File 'lib/macho/load_commands.rb', line 253

def segname
  @segname
end

#vmaddrFixnum (readonly)

Returns the memory address of the segment.

Returns:

  • (Fixnum)

    the memory address of the segment



256
257
258
# File 'lib/macho/load_commands.rb', line 256

def vmaddr
  @vmaddr
end

#vmsizeFixnum (readonly)

Returns the memory size of the segment.

Returns:

  • (Fixnum)

    the memory size of the segment



259
260
261
# File 'lib/macho/load_commands.rb', line 259

def vmsize
  @vmsize
end