node/lib/metasm/metasm/disassemble.rb
def check_noreturn_function(fa)
		fb = function_blocks(fa, false, false)
		lasts = fb.keys.find_all { |k| fb[k] == [] }
		return if lasts.empty?
		if lasts.all? { |la|
			b = block_at(la)
			next if not di = b.list.last
			(di.opcode.props[:saveip] and b.to_normal.to_a.all? { |tfa|
				tf = function_at(tfa) and tf.noreturn
			}) or (di.opcode.props[:stopexec] and not di.opcode.props[:setip])
		}
			# yay
			@function[fa] ||= DecodedFunction.new
			@function[fa].noreturn = true
		end
	end
# given an address, detect if it may be a noreturn fuction
# it is if all its end blocks are calls to noreturn functions
# if it is, create a @function[fa] with noreturn = true
# should only be called with fa = target of a call
given an address, detect if it may be a noreturn fuction
it is if all its end blocks are calls to noreturn functions
if it is, create a @function[fa] with noreturn = true
should only be called with fa = target of a call
given an address detect if it may be a noreturn fuction it is if all its end blocks are calls to noreturn functions if it is create a @function [ fa ] with noreturn = true should only be called with fa = target of a call
def check_noreturn_function(fa)
		fb = function_blocks(fa, false, false)
		lasts = fb.keys.find_all { |k| fb[k] == [] }
		return if lasts.empty?
		if lasts.all? { |la|
			b = block_at(la)
			next if not di = b.list.last
			(di.opcode.props[:saveip] and b.to_normal.to_a.all? { |tfa|
				tf = function_at(tfa) and tf.noreturn
			}) or (di.opcode.props[:stopexec] and not di.opcode.props[:setip])
		}
			@function[fa] ||= DecodedFunction.new
			@function[fa].noreturn = true
		end
	end
def check_noreturn_function ( fa ) fb = function_blocks ( fa , false , false ) lasts = fb . keys . find_all { | k | fb [ k ] == [ ] } return if lasts . empty? if lasts . all? { | la | b = block_at ( la ) next if not di = b . list . last ( di . opcode . props [ :saveip ] and b . to_normal . to_a . all? { | tfa | tf = function_at ( tfa ) and tf . noreturn } ) or ( di . opcode . props [ :stopexec ] and not di . opcode . props [ :setip ] ) } @function [ fa ] ||= DecodedFunction . new @function [ fa ] . noreturn = true end end
given an address, detect if it may be a noreturn fuction
it is if all its end blocks are calls to noreturn functions
if it is, create a @function[fa] with noreturn = true
should only be called with fa = target of a call
given an address detect if it may be a noreturn fuction it is if all its end blocks are calls to noreturn functions if it is create a @function [ fa ] with noreturn = true should only be called with fa = target of a call
# yay
fa