public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Search Repo:
Added breakpoint delete command to Debugger
agardiner (author)
Wed Apr 16 06:27:05 -0700 2008
commit  6402fcc6308b9136a2d310553f18092549ca65cc
tree    e5c75a0da4fb0cfd7de3952b206b107e795cccdf
parent  35125e5aa14fef4d38905307affc3ad283eb4fc9
...
34
35
36
37
38
39
40
41
42
43
44
 
 
 
 
 
 
 
 
 
 
 
45
46
 
 
47
48
49
...
51
52
53
54
 
55
56
57
...
69
70
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
73
74
...
34
35
36
 
 
 
 
 
 
 
 
37
38
39
40
41
42
43
44
45
46
47
48
 
49
50
51
52
53
...
55
56
57
 
58
59
60
61
...
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
0
@@ -34,16 +34,20 @@
0
     end
0
 
0
     def execute(dbg, md)
0
- output = Output.new
0
- output << "Breakpoints:"
0
- output.set_columns(["%d.", "%-s", " %s ", "[IP:%d]", "%4d", "%s"])
0
- dbg.breakpoints.each_with_index do |bp, i|
0
- if bp.enabled?
0
- output.set_color :white
0
- else
0
- output.set_color :yellow
0
+ if bp_list = dbg.breakpoints and bp_list.size > 0
0
+ output = Output.new
0
+ output << "Breakpoints:"
0
+ output.set_columns(["%d.", "%-s", " %s ", "[IP:%d]", "%4d", "%s"])
0
+ dbg.breakpoints.each_with_index do |bp, i|
0
+ if bp.enabled?
0
+ output.set_color :white
0
+ else
0
+ output.set_color :yellow
0
+ end
0
+ output << [i+1, "#{bp.method.file}:#{bp.line}", bp.method.name, bp.ip, bp.hits, "#{'(disabled)' unless bp.enabled?}"]
0
         end
0
- output << [i+1, "#{bp.method.file}:#{bp.line}", bp.method.name, bp.ip, bp.hits, "#{'(disabled)' unless bp.enabled?}"]
0
+ else
0
+ output = "No breakpoints currently defined"
0
       end
0
       output
0
     end
0
@@ -51,7 +55,7 @@
0
 
0
 
0
   class AddBreakpoint < Command
0
- @@re = Regexp.new('^b(?:reak)?\s+' + MODULE_METHOD_RE + '(?:(?::|\s+)(\d+))?$')
0
+ @@re = Regexp.new('^b(?:reak)?\s+' + MODULE_METHOD_RE + '(?::(\d+))?$')
0
 
0
     def help
0
       return "b[reak] <method>[:<line>]", "Set a breakpoint at the start or specified line of <method>."
0
@@ -69,6 +73,28 @@
0
 
0
       bp = dbg.set_breakpoint cm, ip
0
       return "Breakpoint set on #{bp.method.name} at #{bp.method.file}:#{bp.line}"
0
+ end
0
+ end
0
+
0
+
0
+ class DeleteBreakpoint < Command
0
+ def help
0
+ return "b[reak] d[el] <n>", "Delete breakpoint <n>."
0
+ end
0
+
0
+ def command_regexp
0
+ /^b(?:reak)?\s+d(?:el(?:ete)?)?\s+(\d+)$/
0
+ end
0
+
0
+ def execute(dbg, md)
0
+ n = md[1].to_i
0
+ bp = dbg.breakpoints[n-1]
0
+ if bp
0
+ dbg.remove_breakpoint bp
0
+ return "Deleted breakpoint #{n} from #{bp.method.file}:#{bp.line}"
0
+ else
0
+ return "No such breakpoint"
0
+ end
0
     end
0
   end
0
 

Comments

    No one has commented yet.