node/lib/metasm/samples/dbg-plugins/trace_func.rb
def trace_func_blockend(id, blockaddr)
	if di = disassembler.di_at(pc)
		if end_stepout(di) and trace_func_istraceend(id, di)
			# trace ends there
			trace_func_finish(id)
			return true
		elsif di.opcode.props[:saveip] and not trace_func_entersubfunc(id, di)
			# call to a subfunction
			bpx(di.next_addr, true) {
				trace_func_block(id)
				continue
			}
			continue
		else
			singlestep {
				newaddr = pc
				trace_func_block(id)

				trace_func_linkdasm(di.address, newaddr)
				continue
			}
		end
	else
		# XXX should link in the dasm somehow
		singlestep {
			trace_func_block(id)
			continue
		}
	end
	false
end
# we are at the end of a traced block, find whats next
we are at the end of a traced block, find whats next
we are at the end of a traced block find whats next
def trace_func_blockend(id, blockaddr)
	if di = disassembler.di_at(pc)
		if end_stepout(di) and trace_func_istraceend(id, di)
			trace_func_finish(id)
			return true
		elsif di.opcode.props[:saveip] and not trace_func_entersubfunc(id, di)
			bpx(di.next_addr, true) {
				trace_func_block(id)
				continue
			}
			continue
		else
			singlestep {
				newaddr = pc
				trace_func_block(id)
				trace_func_linkdasm(di.address, newaddr)
				continue
			}
		end
	else
		singlestep {
			trace_func_block(id)
			continue
		}
	end
	false
end
def trace_func_blockend ( id , blockaddr ) if di = disassembler . di_at ( pc ) if end_stepout ( di ) and trace_func_istraceend ( id , di ) trace_func_finish ( id ) return true elsif di . opcode . props [ :saveip ] and not trace_func_entersubfunc ( id , di ) bpx ( di . next_addr , true ) { trace_func_block ( id ) continue } continue else singlestep { newaddr = pc trace_func_block ( id ) trace_func_linkdasm ( di . address , newaddr ) continue } end else singlestep { trace_func_block ( id ) continue } end false end
we are at the end of a traced block, find whats next
we are at the end of a traced block find whats next
# trace ends there # call to a subfunction # XXX should link in the dasm somehow
id
blockaddr