Class: Ragweed::Debugger32::Breakpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/ragweed/debugger32.rb

Overview

Breakpoint class. Handles the actual setting, removal and triggers for breakpoints. no user servicable parts.

Constant Summary collapse

INT3 =
0xCC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(process, ip, def_status, callable) ⇒ Breakpoint

Returns a new instance of Breakpoint.



29
30
31
32
33
34
35
# File 'lib/ragweed/debugger32.rb', line 29

def initialize(process, ip, def_status, callable)
  @process = process
  @addr = ip
  @callable = callable
  @deferred = def_status
  @orig = 0
end

Instance Attribute Details

#addrObject

Returns the value of attribute addr.



27
28
29
# File 'lib/ragweed/debugger32.rb', line 27

def addr
  @addr
end

#deferredObject

Returns the value of attribute deferred.



27
28
29
# File 'lib/ragweed/debugger32.rb', line 27

def deferred
  @deferred
end

#origObject

Returns the value of attribute orig.



27
28
29
# File 'lib/ragweed/debugger32.rb', line 27

def orig
  @orig
end

Instance Method Details

#call(*args) ⇒ Object



64
# File 'lib/ragweed/debugger32.rb', line 64

def call(*args); @callable.call(*args); end

#deferred_install(h, base) ⇒ Object



51
52
53
54
55
# File 'lib/ragweed/debugger32.rb', line 51

def deferred_install(h, base)
    @addr = @process.get_deferred_proc_remote(@addr, h, base)
    self.install
    return @addr
end

#installObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ragweed/debugger32.rb', line 39

def install
    return if @addr == 0 or @deferred == true

    o = @process.read8(@addr)

    if(orig != INT3)
      @orig = o
      @process.write8(@addr, INT3) 
      Ragweed::Wrap32::flush_instruction_cache(@process.handle)
    end
end

#uninstallObject



57
58
59
60
61
62
# File 'lib/ragweed/debugger32.rb', line 57

def uninstall
  if(@orig != INT3)
    @process.write8(@addr, @orig)
    Ragweed::Wrap32::flush_instruction_cache(@process.handle)
  end
end