node/lib/metasm/metasm/debug.rb
# change the debugger to a specific pid/tid
# if given a block, run the block and then restore the original pid/tid
# pid may be an object that respond to #pid/#tid
change the debugger to a specific pid/tid
if given a block, run the block and then restore the original pid/tid
pid may be an object that respond to #pid/#tid
change the debugger to a specific pid / tid if given a block run the block and then restore the original pid / tid pid may be an object that respond to #pid / #tid
def switch_context(npid, ntid=nil, &b)
		if npid.respond_to?(:pid)
			ntid ||= npid.tid
			npid = npid.pid
		end
		oldpid = pid
		oldtid = tid
		set_pid npid
		set_tid ntid if ntid
		if b
			return b.call if oldpid == pid and oldtid == tid
			begin
				b.call
			ensure
				set_pid oldpid
				set_tid oldtid
			end
		end
	end
def switch_context ( npid , ntid = nil , & b ) if npid . respond_to? ( :pid ) ntid ||= npid . tid npid = npid . pid end oldpid = pid oldtid = tid set_pid npid set_tid ntid if ntid if b return b . call if oldpid == pid and oldtid == tid begin b . call ensure set_pid oldpid set_tid oldtid end end end
change the debugger to a specific pid/tid
if given a block, run the block and then restore the original pid/tid
pid may be an object that respond to #pid/#tid
change the debugger to a specific pid / tid if given a block run the block and then restore the original pid / tid pid may be an object that respond to #pid / #tid
# shortcut begin..ensure overhead
npid
ntid
b