Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Faster next by reducing number of frame_depth calls" #779

Merged
merged 5 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -866,23 +866,17 @@ def wait_next_action_

depth = @target_frames.first.frame_depth

skip_line = false
step_tp iter do |event|
next if event == :line && skip_line

stack_depth = DEBUGGER__.frame_depth - 3

# If we're at a deeper stack depth, we can skip line events until there's a return event.
skip_line = event == :line && stack_depth > depth

# same stack depth
next true if stack_depth <= depth

step_tp iter do
loc = caller_locations(2, 1).first
loc_path = loc.absolute_path || "!eval:#{loc.path}"

# same stack depth
(DEBUGGER__.frame_depth - 3 <= depth) ||

# different frame
next_line && loc_path == path && loc.lineno.between?(line + 1, next_line)
(next_line && loc_path == path &&
(loc_lineno = loc.lineno) > line &&
loc_lineno <= next_line)
end
break

Expand Down
6 changes: 1 addition & 5 deletions test/console/control_flow_commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def program
10|
11| s = Student.new("John")
12| s.name
13| puts "foo"
14| puts "bar"
15| "baz"
13| "foo"
RUBY
end

Expand Down Expand Up @@ -86,8 +84,6 @@ def test_next_with_number_goes_to_the_next_nth_line
assert_line_num 11
type 'n 2'
assert_line_num 13
type 'n 2'
assert_line_num 15
type 'quit'
type 'y'
end
Expand Down