node/lib/metasm/metasm/disassemble_api.rb
def find_function_start(addr)
		addr = addr.address if addr.kind_of? DecodedInstruction
		todo = [addr]
		done = []
		while a = todo.pop
			a = normalize(a)
			di = @decoded[a]
			next if done.include? a or not di.kind_of? DecodedInstruction
			done << a
			a = di.block.address
			break a if @function[a]
			l = []
			di.block.each_from_samefunc(self) { |f| l << f }
			break a if l.empty?
			todo.concat l
		end
	end
# finds the start of a function from the address of an instruction
finds the start of a function from the address of an instruction
finds the start of a function from the address of an instruction
def find_function_start(addr)
		addr = addr.address if addr.kind_of? DecodedInstruction
		todo = [addr]
		done = []
		while a = todo.pop
			a = normalize(a)
			di = @decoded[a]
			next if done.include? a or not di.kind_of? DecodedInstruction
			done << a
			a = di.block.address
			break a if @function[a]
			l = []
			di.block.each_from_samefunc(self) { |f| l << f }
			break a if l.empty?
			todo.concat l
		end
	end
def find_function_start ( addr ) addr = addr . address if addr . kind_of? DecodedInstruction todo = [ addr ] done = [ ] while a = todo . pop a = normalize ( a ) di = @decoded [ a ] next if done . include? a or not di . kind_of? DecodedInstruction done << a a = di . block . address break a if @function [ a ] l = [ ] di . block . each_from_samefunc ( self ) { | f | l << f } break a if l . empty? todo . concat l end end
finds the start of a function from the address of an instruction
finds the start of a function from the address of an instruction
addr