node/lib/metasm/samples/dbg-plugins/trace_func.rb
# update the blocks links in the disassembler
update the blocks links in the disassembler
update the blocks links in the disassembler
def trace_func_linkdasm(from_addr, new_addr)
	di = disassembler.di_at(from_addr)
	ndi = disassembler.di_at(new_addr)
	return if not di
	if end_stepout(di) and cdi = (1..8).map { |i|
				disassembler.di_at(new_addr - i)
			}.compact.find { |cdi_|
				cdi_.opcode.props[:saveip] and cdi_.next_addr == new_addr
			}
		cdi.block.add_to_subfuncret new_addr
		ndi.block.add_from_subfuncret cdi.address if ndi
		cdi.block.each_to_normal { |f|
			disassembler.function[f] ||= DecodedFunction.new if disassembler.di_at(f)
		}
	else
		di.block.add_to_normal new_addr
		ndi.block.add_from_normal from_addr if ndi
	end
end
def trace_func_linkdasm ( from_addr , new_addr ) di = disassembler . di_at ( from_addr ) ndi = disassembler . di_at ( new_addr ) return if not di if end_stepout ( di ) and cdi = ( 1 .. 8 ) . map { | i | disassembler . di_at ( new_addr - i ) } . compact . find { | cdi_ | cdi_ . opcode . props [ :saveip ] and cdi_ . next_addr == new_addr } cdi . block . add_to_subfuncret new_addr ndi . block . add_from_subfuncret cdi . address if ndi cdi . block . each_to_normal { | f | disassembler . function [ f ] ||= DecodedFunction . new if disassembler . di_at ( f ) } else di . block . add_to_normal new_addr ndi . block . add_from_normal from_addr if ndi end end
update the blocks links in the disassembler
update the blocks links in the disassembler
# is it a subfunction return ?
from_addr
new_addr