# File metasm/exe_format/macho.rb, line 236 def decode(m) super(m) @sections = [] @nsects.times { @sections << SECTION.decode(m, self) } end
# File metasm/exe_format/macho.rb, line 255 def encode(m) ed = super(m) # need to call set_default_values before using @sections @sections.inject(ed) { |ed_, s| ed_ << s.encode(m) } end
# File metasm/exe_format/macho.rb, line 242 def set_default_values(m) # TODO (in the caller?) @encoded = @sections.map { |s| s.encoded }.join @virtaddr ||= m.new_label('virtaddr') @virtsize ||= @encoded.length @fileoff ||= m.new_label('fileoff') @filesize ||= @encoded.rawsize @sections ||= [] @nsects ||= @sections.length @maxprot ||= %w[READ WRITE EXECUTE] @initprot ||= %w[READ] super(m) end