diff --git a/lib/debug/breakpoint.rb b/lib/debug/breakpoint.rb index 070881684..2d9e37451 100644 --- a/lib/debug/breakpoint.rb +++ b/lib/debug/breakpoint.rb @@ -277,10 +277,15 @@ def initialize pat, cond: nil, command: nil, path: nil def setup @tp = TracePoint.new(:raise){|tp| - next if skip_path?(tp.path) exc = tp.raised_exception next if SystemExit === exc - next if @path && !tp.path.match?(@path) + + if @path + next if !tp.path.match?(@path) + elsif skip_path?(tp.path) + next + end + next if !safe_eval(tp.binding, @cond) if @cond should_suspend = false diff --git a/test/debug/catch_test.rb b/test/debug/catch_test.rb index 8ef28445b..776c510e0 100644 --- a/test/debug/catch_test.rb +++ b/test/debug/catch_test.rb @@ -186,5 +186,24 @@ def test_catch_only_stops_when_path_matches end end end + + def test_the_path_option_supersede_skip_path_config + with_extra_tempfile do |extra_file| + debug_code(program(extra_file.path)) do + type "config set skip_path #{extra_file.path}" + type 'c' + assert_finish + end + + debug_code(program(extra_file.path)) do + type "config set skip_path #{extra_file.path}" + type "catch RuntimeError path: #{extra_file.path}" + type 'c' + assert_line_text(/bar/) + type 'c' + assert_finish + end + end + end end end