diff options
-rw-r--r-- | lib/irb/cmd/debug.rb | 9 | ||||
-rw-r--r-- | lib/irb/cmd/step.rb | 3 | ||||
-rw-r--r-- | test/irb/test_debug_cmd.rb | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/lib/irb/cmd/debug.rb b/lib/irb/cmd/debug.rb index 76f17e3c2f..e6e812e075 100644 --- a/lib/irb/cmd/debug.rb +++ b/lib/irb/cmd/debug.rb @@ -55,6 +55,13 @@ module IRB end end + module SkipPathHelperForIRB + def skip_internal_path?(path) + # The latter can be removed once https://github.com/ruby/debug/issues/866 is resolved + super || path.match?(IRB_DIR) || path.match?('<internal:prelude>') + end + end + def setup_debugger unless defined?(DEBUGGER__::SESSION) begin @@ -75,6 +82,8 @@ module IRB end frames end + + DEBUGGER__::ThreadClient.prepend(SkipPathHelperForIRB) end true diff --git a/lib/irb/cmd/step.rb b/lib/irb/cmd/step.rb index d3d0f16291..2bc74a9d79 100644 --- a/lib/irb/cmd/step.rb +++ b/lib/irb/cmd/step.rb @@ -8,8 +8,7 @@ module IRB module ExtendCommand class Step < DebugCommand def execute(*args) - # Run `next` first to move out of binding.irb - super(pre_cmds: "next", do_cmds: ["step", *args].join(" ")) + super(do_cmds: ["step", *args].join(" ")) end end end diff --git a/test/irb/test_debug_cmd.rb b/test/irb/test_debug_cmd.rb index 3ba8742304..9aafbec7f0 100644 --- a/test/irb/test_debug_cmd.rb +++ b/test/irb/test_debug_cmd.rb @@ -119,11 +119,13 @@ module TestIRB output = run_ruby_file do type "step" + type "step" type "continue" end assert_match(/\(rdbg:irb\) step/, output) - assert_match(/=> 2| puts "Hello"/, output) + assert_match(/=> 5\| foo/, output) + assert_match(/=> 2\| puts "Hello"/, output) end def test_continue |