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



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

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

#deferred_install(h, base) ⇒ Object



53
54
55
56
57
# File 'lib/ragweed/debugger32.rb', line 53

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
50
51
# File 'lib/ragweed/debugger32.rb', line 39

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

    o = @process.read8(@addr)

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

#uninstallObject



59
60
61
62
63
64
# File 'lib/ragweed/debugger32.rb', line 59

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