Sha256: 6ab68bb4fa795084a7e26f889a4cd652fc59d3925089a9b433e113cde308a65a
Contents?: true
Size: 818 Bytes
Versions: 8
Compression:
Stored size: 818 Bytes
Contents
class Ragweed::Debugger32 # Hook function calls # nargs is the number of arguments taken by function at ip # callable/block is called with ev, ctx, dir (:enter or :leave), and args Array (see examples/hook_notepad.rb) # default handler prints arguments def hook(ip, nargs, callable=nil, &block) callable ||= block || lambda do |ev, ctx,dir,args| puts "#{dir} #{ip.to_s(16) rescue ip.to_s}" puts args.map{|a| "%08x" % a}.join(',') end breakpoint_set(ip) do |ev,ctx| args = (1..nargs).map {|i| process.read32(ctx.esp + 4*i)} retp = process.read32(ctx.esp) # set exit bpoint breakpoint_set(retp) do |ev,ctx| callable.call(ev, ctx, :leave, args) breakpoint_clear(retp) end.install callable.call(ev, ctx, :enter, args) end end end
Version data entries
8 entries across 8 versions & 3 rubygems