Represents a section of a segment for 32-bit architectures.
@see MachOStructure::FORMAT
@see MachOStructure::SIZEOF
@return [Fixnum] the memory address of the section
@return [Fixnum] the section alignment (power of 2) of the section
@return [Fixnum] flags for type and attributes of the section
@return [Fixnum] the number of relocation entries
@return [Fixnum] the file offset of the section
@return [Fixnum] the file offset of the section's relocation entries
@return [void] reserved (for offset or index)
@return [void] reserved (for count or sizeof)
@return [String] the name of the section, including null pad bytes
@return [String] the name of the segment's section, including null
pad bytes
@return [Fixnum] the size, in bytes, of the section
@api private
# File lib/macho/sections.rb, line 113 def initialize(sectname, segname, addr, size, offset, align, reloff, nreloc, flags, reserved1, reserved2) @sectname = sectname @segname = segname @addr = addr @size = size @offset = offset @align = align @reloff = reloff @nreloc = nreloc @flags = flags @reserved1 = reserved1 @reserved2 = reserved2 end
@return [Boolean] whether the section is empty (i.e, {size} is 0)
# File lib/macho/sections.rb, line 141 def empty? size.zero? end
@example
puts "this section is regular" if sect.flag?(:S_REGULAR)
@param flag [Symbol] a section flag symbol @return [Boolean] whether the flag is present in the section's {flags}
# File lib/macho/sections.rb, line 149 def flag?(flag) flag = SECTION_FLAGS[flag] return false if flag.nil? flags & flag == flag end
@return [String] the section's name, with any trailing NULL characters
removed
# File lib/macho/sections.rb, line 130 def section_name sectname.delete("\x00") end
@return [String] the parent segment's name, with any trailing NULL
characters removed
# File lib/macho/sections.rb, line 136 def segment_name segname.delete("\x00") end