node/lib/metasm/metasm/disassemble.rb
# handles when disassemble_fast encounters a call to a subfunction
handles when disassemble_fast encounters a call to a subfunction
handles when disassemble_fast encounters a call to a subfunction
def disassemble_fast_block_subfunc(di)
		funcs = di.block.to_normal.to_a
		do_ret = funcs.empty?
		ret = []
		na = di.next_addr + di.bin_length * @cpu.delay_slot(di)
		funcs.each { |fa|
			fa = normalize(fa)
			disassemble_fast_checkfunc(fa)
			yield fa, di if block_given?
			if f = @function[fa] and bf = f.get_backtracked_for(self, fa, di.address) and not bf.empty?
				bf.each { |btt|
					next if btt.type != :x
					bt = backtrace(btt.expr, di.address, :include_start => true, :origin => btt.origin, :maxdepth => [@backtrace_maxblocks_fast, 1].max)
					if btt.detached
						ret.concat bt	
					elsif bt.find { |a| normalize(a) == na }
						do_ret = true
					end
				}
			elsif not f or not f.noreturn
				do_ret = true
			end
		}
		if do_ret
			di.block.add_to_subfuncret(na)
			ret << [na, di.address, true]
			di.block.add_to_normal :default if not di.block.to_normal and @function[:default]
		end
		ret
	end
def disassemble_fast_block_subfunc ( di ) funcs = di . block . to_normal . to_a do_ret = funcs . empty? ret = [ ] na = di . next_addr + di . bin_length * @cpu . delay_slot ( di ) funcs . each { | fa | fa = normalize ( fa ) disassemble_fast_checkfunc ( fa ) yield fa , di if block_given? if f = @function [ fa ] and bf = f . get_backtracked_for ( self , fa , di . address ) and not bf . empty? bf . each { | btt | next if btt . type != :x bt = backtrace ( btt . expr , di . address , :include_start => true , :origin => btt . origin , :maxdepth => [ @backtrace_maxblocks_fast , 1 ] . max ) if btt . detached ret . concat bt elsif bt . find { | a | normalize ( a ) == na } do_ret = true end } elsif not f or not f . noreturn do_ret = true end } if do_ret di . block . add_to_subfuncret ( na ) ret << [ na , di . address , true ] di . block . add_to_normal :default if not di . block . to_normal and @function [ :default ] end ret end
handles when disassemble_fast encounters a call to a subfunction
handles when disassemble_fast encounters a call to a subfunction
# this includes retaddr unless f is noreturn # callback argument
di