Skip to content

Commit 62c83c8

Browse files
committed
Let's use Debugger#remove_catchpoint and Debugger#clear_catchpoints if available
These methods allow some optimisations in debugger's backend
1 parent 0208503 commit 62c83c8

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

ChangeLog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [master](https://github.com/ruby-debug/ruby-debug-ide/compare/v0.6.0...master)
2+
3+
* let's use Debugger#remove_catchpoint and Debugger#clear_catchpoints if available
4+
15
## [0.6.0](https://github.com/ruby-debug/ruby-debug-ide/compare/v0.5.0...0.6.0)
26

37
* "file-filter on|off" command added

lib/ruby-debug-ide/commands/catchpoint.rb

+19-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,20 @@ def execute
1616
elsif not @match[2]
1717
# One arg given.
1818
if 'off' == excn
19-
Debugger.catchpoints.clear
19+
clear_catchpoints
2020
else
2121
Debugger.add_catchpoint(excn)
2222
print_catchpoint_set(excn)
2323
end
2424
elsif @match[2] != 'off'
2525
errmsg "Off expected. Got %s\n", @match[2]
26-
elsif Debugger.catchpoints.member?(excn)
27-
Debugger.catchpoints.delete(excn)
26+
elsif remove_catchpoint(excn)
2827
print_catchpoint_deleted(excn)
2928
else
3029
errmsg "Catch for exception %s not found.\n", excn
3130
end
3231
end
33-
32+
3433
class << self
3534
def help_command
3635
'catch'
@@ -45,5 +44,21 @@ def help(cmd)
4544
}
4645
end
4746
end
47+
48+
private
49+
50+
def clear_catchpoints
51+
if Debugger.respond_to?(:clear_catchpoints)
52+
Debugger.clear_catchpoints
53+
else
54+
Debugger.catchpoints.clear
55+
end
56+
end
57+
58+
def remove_catchpoint(excn)
59+
return Debugger.remove_catchpoint(excn) if Debugger.respond_to?(:remove_catchpoint)
60+
return Debugger.catchpoints.delete(excn) if Debugger.catchpoints.member?(excn)
61+
false
62+
end
4863
end
4964
end

lib/ruby-debug-ide/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Debugger
2-
IDE_VERSION='0.6.0'
2+
IDE_VERSION='0.6.1.beta1'
33
end

0 commit comments

Comments
 (0)