node/lib/metasm/metasm/debug.rb
# checks if bp has an emul_instr
# do the lazy initialization if needed
checks if bp has an emul_instr
do the lazy initialization if needed
checks if bp has an emul_instr do the lazy initialization if needed
def has_emul_instr(bp)
		if bp.emul_instr.kind_of?(DecodedInstruction)
			if di = bp.emul_instr and fdbd = @disassembler.get_fwdemu_binding(di, register_pc) and
					fdbd.all? { |k, v| (k.kind_of?(Symbol) or k.kind_of?(Indirection)) and
						k != :incomplete_binding and v != Expression::Unknown }
				bp.emul_instr = lambda {
					fdbd.map { |k, v|
						k = Indirection[emulinstr_resv(k.pointer), k.len] if k.kind_of?(Indirection)
						[k, emulinstr_resv(v)]
					}.each { |k, v|
						if k.to_s =~ /flags?_(.+)/i
							f = $1.downcase.to_sym
							set_flag_value(f, v)
						elsif k.kind_of?(Symbol)
							set_reg_value(k, v)
						elsif k.kind_of?(Indirection)
							memory_write_int(k.pointer, v, k.len)
						end
					}
				}
				bp.hash_shared.each { |bb| bb.emul_instr = bp.emul_instr }
			else
				bp.hash_shared.each { |bb| bb.emul_instr = nil }
			end
		end
		bp.emul_instr
	end
def has_emul_instr ( bp ) if bp . emul_instr . kind_of? ( DecodedInstruction ) if di = bp . emul_instr and fdbd = @disassembler . get_fwdemu_binding ( di , register_pc ) and fdbd . all? { | k , v | ( k . kind_of? ( Symbol ) or k . kind_of? ( Indirection ) ) and k != :incomplete_binding and v != Expression :: Unknown } bp . emul_instr = lambda { fdbd . map { | k , v | k = Indirection [ emulinstr_resv ( k . pointer ) , k . len ] if k . kind_of? ( Indirection ) [ k , emulinstr_resv ( v ) ] } . each { | k , v | if k . to_s =~ / flags?_(.+) /i f = $1 . downcase . to_sym set_flag_value ( f , v ) elsif k . kind_of? ( Symbol ) set_reg_value ( k , v ) elsif k . kind_of? ( Indirection ) memory_write_int ( k . pointer , v , k . len ) end } } bp . hash_shared . each { | bb | bb . emul_instr = bp . emul_instr } else bp . hash_shared . each { | bb | bb . emul_instr = nil } end end bp . emul_instr end
checks if bp has an emul_instr
do the lazy initialization if needed
checks if bp has an emul_instr do the lazy initialization if needed
# setup a lambda that will mimic, using the debugger primitives, the actual execution of the instruction
bp