class MachO::Sections::Section
Represents a section of a segment for 32-bit architectures.
Public Instance Methods
@example
puts "pure instructions" if sect.attribute?(:S_ATTR_PURE_INSTRUCTIONS)
@param attr_sym [Symbol] a section attribute symbol @return [Boolean] whether this section is of the given type
# File lib/macho/sections.rb, line 162 def attribute?(attr_sym) !!(attributes & SECTION_ATTRIBUTES[attr_sym]) end
@return [Integer] the raw numeric attributes of this section
# File lib/macho/sections.rb, line 154 def attributes flags & SECTION_ATTRIBUTES_MASK end
@return [Boolean] whether the section is empty (i.e, {size} is 0)
# File lib/macho/sections.rb, line 136 def empty? size.zero? end
@deprecated Use {#type?} or {#attribute?} instead. @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 171 def flag?(flag) flag = SECTION_FLAGS[flag] return false if flag.nil? flags & flag == flag end
@return [String] the section’s name
# File lib/macho/sections.rb, line 126 def section_name sectname end
@return [String] the parent segment’s name
# File lib/macho/sections.rb, line 131 def segment_name segname end
@return [Hash] a hash representation of this {Section}
# File lib/macho/sections.rb, line 180 def to_h { "sectname" => sectname, "segname" => segname, "addr" => addr, "size" => size, "offset" => offset, "align" => align, "reloff" => reloff, "nreloc" => nreloc, "flags" => flags, "reserved1" => reserved1, "reserved2" => reserved2, }.merge super end
@return [Integer] the raw numeric type of this section
# File lib/macho/sections.rb, line 141 def type flags & SECTION_TYPE_MASK end
@example
puts "this section is regular" if sect.type?(:S_REGULAR)
@param type_sym [Symbol] a section type symbol @return [Boolean] whether this section is of the given type
# File lib/macho/sections.rb, line 149 def type?(type_sym) type == SECTION_TYPES[type_sym] end