Class: Ragweed::Debuggerosx::Breakpoint
- Defined in:
- lib/ragweed/debuggerosx.rb
Constant Summary collapse
- INT3 =
0xCC
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
-
#bpid ⇒ Object
Returns the value of attribute bpid.
-
#function ⇒ Object
Returns the value of attribute function.
-
#orig ⇒ Object
Returns the value of attribute orig.
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(bp, ip, callable, name = "") ⇒ Breakpoint
constructor
bp: parent for method_missing calls ip: insertion point callable: lambda to be called when breakpoint is hit name: name of breakpoint.
-
#install ⇒ Object
Install this breakpoint.
- #installed? ⇒ Boolean
- #method_missing(meth, *args) ⇒ Object
-
#uninstall ⇒ Object
Uninstall this breakpoint.
Constructor Details
#initialize(bp, ip, callable, name = "") ⇒ Breakpoint
bp: parent for method_missing calls ip: insertion point callable: lambda to be called when breakpoint is hit name: name of breakpoint
34 35 36 37 38 39 40 41 42 |
# File 'lib/ragweed/debuggerosx.rb', line 34 def initialize(bp, ip, callable, name = "") @@bpid ||= 0 @bp = bp @function = name @addr = ip @callable = callable @bpid = (@@bpid += 1) @installed = false end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
69 |
# File 'lib/ragweed/debuggerosx.rb', line 69 def method_missing(meth, *args); @bp.send(meth, *args); end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
27 28 29 |
# File 'lib/ragweed/debuggerosx.rb', line 27 def addr @addr end |
#bpid ⇒ Object
Returns the value of attribute bpid.
26 27 28 |
# File 'lib/ragweed/debuggerosx.rb', line 26 def bpid @bpid end |
#function ⇒ Object
Returns the value of attribute function.
28 29 30 |
# File 'lib/ragweed/debuggerosx.rb', line 28 def function @function end |
#orig ⇒ Object
Returns the value of attribute orig.
25 26 27 |
# File 'lib/ragweed/debuggerosx.rb', line 25 def orig @orig end |
Instance Method Details
#call(*args) ⇒ Object
68 |
# File 'lib/ragweed/debuggerosx.rb', line 68 def call(*args); @callable.call(*args) if @callable != nil; end |
#install ⇒ Object
Install this breakpoint.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ragweed/debuggerosx.rb', line 45 def install Ragweed::Wraposx::task_suspend(@bp.task) @bp.hook if not @bp.hooked? Ragweed::Wraposx::vm_protect(@bp.task,@addr,1,false,Ragweed::Wraposx::Vm::Prot::ALL) @orig = Ragweed::Wraposx::vm_read(@bp.task,@addr,1) if(@orig != INT3) Ragweed::Wraposx::vm_write(@bp.task,@addr, [INT3].pack('C')) end @installed = true Ragweed::Wraposx::task_resume(@bp.task) end |
#installed? ⇒ Boolean
67 |
# File 'lib/ragweed/debuggerosx.rb', line 67 def installed?; @installed; end |
#uninstall ⇒ Object
Uninstall this breakpoint.
58 59 60 61 62 63 64 65 |
# File 'lib/ragweed/debuggerosx.rb', line 58 def uninstall Ragweed::Wraposx::task_suspend(@bp.task) if(@orig != INT3) Ragweed::Wraposx::vm_write(@bp.task, @addr, @orig) end @installed = false Ragweed::Wraposx::task_resume(@bp.task) end |