node/lib/metasm/metasm/exe_format/elf_decode.rb
def decode_section_header(off = @header.shoff)
		raise InvalidExeFormat, "Invalid elf section header size: #{@header.shentsize}" if Section.size(self) != @header.shentsize
		@encoded.add_export new_label('section_header'), off
		@encoded.ptr = off
		@sections = []
		@header.shnum.times { @sections << Section.decode(self) }

		# read sections name
		if @header.shstrndx != 0 and str = @sections[@header.shstrndx] and str.encoded = @encoded[str.offset, str.size]
			# LoadedElf may not have shstr mmaped
			@sections[1..-1].each { |s|
				s.name = readstr(str.encoded.data, s.name_p)
				add_label("section_#{s.name}", s.addr) if s.name and s.addr > 0
			}
		end
	end
# decodes the section header
# section names are read from shstrndx if possible
decodes the section header
section names are read from shstrndx if possible
decodes the section header section names are read from shstrndx if possible
def decode_section_header(off = @header.shoff)
		raise InvalidExeFormat, "Invalid elf section header size: #{@header.shentsize}" if Section.size(self) != @header.shentsize
		@encoded.add_export new_label('section_header'), off
		@encoded.ptr = off
		@sections = []
		@header.shnum.times { @sections << Section.decode(self) }
		if @header.shstrndx != 0 and str = @sections[@header.shstrndx] and str.encoded = @encoded[str.offset, str.size]
			@sections[1..-1].each { |s|
				s.name = readstr(str.encoded.data, s.name_p)
				add_label("section_#{s.name}", s.addr) if s.name and s.addr > 0
			}
		end
	end
def decode_section_header ( off = @header . shoff ) raise InvalidExeFormat , "Invalid elf section header size: #{@header.shentsize}" if Section . size ( self ) != @header . shentsize @encoded . add_export new_label ( 'section_header' ) , off @encoded . ptr = off @sections = [ ] @header . shnum . times { @sections << Section . decode ( self ) } if @header . shstrndx != 0 and str = @sections [ @header . shstrndx ] and str . encoded = @encoded [ str . offset , str . size ] @sections [ 1 .. - 1 ] . each { | s | s . name = readstr ( str . encoded . data , s . name_p ) add_label ( "section_#{s.name}" , s . addr ) if s . name and s . addr > 0 } end end
decodes the section header
section names are read from shstrndx if possible
decodes the section header section names are read from shstrndx if possible
# read sections name # LoadedElf may not have shstr mmaped
off
shoff