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(bp, ip, callable) ⇒ Breakpoint

Returns a new instance of Breakpoint.



26
27
28
29
30
31
32
# File 'lib/ragweed/debugger32.rb', line 26

def initialize(bp, ip, callable)
  @@bpid ||= 0
  @bp = bp 
  @addr = ip
  @callable = callable
  @bpid = (@@bpid += 1)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



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

def method_missing(meth, *args); @bp.send(meth, *args); end

Instance Attribute Details

#bpidObject

Returns the value of attribute bpid.



24
25
26
# File 'lib/ragweed/debugger32.rb', line 24

def bpid
  @bpid
end

#origObject

Returns the value of attribute orig.



23
24
25
# File 'lib/ragweed/debugger32.rb', line 23

def orig
  @orig
end

Instance Method Details

#call(*args) ⇒ Object



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

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

#installObject



34
35
36
37
38
39
40
# File 'lib/ragweed/debugger32.rb', line 34

def install
  @orig = process.read8(@addr)
  if(@orig != INT3)
    process.write8(@addr, INT3) 
    Wrap32::flush_instruction_cache(@bp.process.handle)
  end
end

#uninstallObject



42
43
44
45
46
47
# File 'lib/ragweed/debugger32.rb', line 42

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