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

Keystrokes between debugger sessions seem to persist #1098

Open
joshuay03 opened this issue Apr 23, 2024 · 8 comments
Open

Keystrokes between debugger sessions seem to persist #1098

joshuay03 opened this issue Apr 23, 2024 · 8 comments

Comments

@joshuay03
Copy link

joshuay03 commented Apr 23, 2024

Your environment

  • ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
  • rdbg -v: rdbg 1.9.2

Describe the bug

After hitting a debugger break point once, and using c to move on, if you hit Enter before the next break point, the next breakpoint is skipped.

To Reproduce

Script:

require "debug"; def my_method; 2.times { |i| p i; debugger; sleep 1 }; end

Without hitting Enter:

1.mov

With hitting Enter during the first sleep:

2.mov

Expected behavior

The execution should stop at the next breakpoint regardless of what keystrokes are used between breakpoints.

Additional context

None.

@joshuay03 joshuay03 changed the title Keystrokes between debug sessions seem to persist Keystrokes between debugger sessions seem to persist Apr 24, 2024
@ko1
Copy link
Collaborator

ko1 commented Apr 24, 2024

wow I see... Should we consume all input before REPL?

@ko1
Copy link
Collaborator

ko1 commented Apr 24, 2024

advices are very welcome If someone knows a techniques about it on other implementations

@joshuay03
Copy link
Author

joshuay03 commented Apr 24, 2024

Should we consume all input before REPL?

Hmm possibly, is that considered unconventional? Might be worth looking at how pry handles this.

Or maybe just ignore previous REPL if in-between sessions.

@joshuay03
Copy link
Author

joshuay03 commented Apr 24, 2024

The source of the issue:

debug/lib/debug/session.rb

Lines 1146 to 1152 in 0b77e82

if line.empty?
if @repl_prev_line
line = @repl_prev_line
else
return :retry
end
else

@mattkuras
Copy link

I too recently encountered this same issue. makes it hard to clear extra lines in the console

@dhh
Copy link

dhh commented Sep 9, 2024

Been seeing the same issue. This didn't use to be the case. Maybe we can track down when this started?

@joshuay03
Copy link
Author

joshuay03 commented Sep 21, 2024

Maybe we can track down when this started?

I think it was introduced here. And there's this related follow-up issue.

I think a sensible middle ground would be to skip the repeat functionality on enter / empty line until the prompt is displaying. Or discard empty line input altogether until then.

@dhh
Copy link

dhh commented Oct 4, 2024

@ko1 What do you think about an option where Rails could turn off this repeater behavior? Right now ruby/debug is not all that usable in Rails because of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants