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

!!! to fast forward breakpoints like in pry #1084

Open
adillari opened this issue Feb 28, 2024 · 5 comments
Open

!!! to fast forward breakpoints like in pry #1084

adillari opened this issue Feb 28, 2024 · 5 comments

Comments

@adillari
Copy link

Pry had a feature where you could fast forward all subsequent breaks if you entered !!!. It would essentially automatically continue the subsequent breaks. It would be awesome to to have something like that in debug.

@hsbt hsbt changed the title !!! to fast forward breakpoints like in pry !!! to fast forward breakpoints like in pry Mar 5, 2024
@ko1
Copy link
Collaborator

ko1 commented Mar 29, 2024

does it mean disable all breakpoints?

@st0012
Copy link
Member

st0012 commented Apr 4, 2024

Since !!! calls Kernel.exit underneath, I think the equivalent here is simply typing exit.
Pry has another command called disable_pry, which will exit the current session and disable all the later breakpoints. Looks like this is what the author is looking for?

@joshuay03
Copy link

joshuay03 commented Apr 23, 2024

Pry has another command called disable_pry, which will exit the current session and disable all the later breakpoints. Looks like this is what the author is looking for?

Not OP, but it would be great if debug had something similar to disable-pry. We just switched from using pry to debug in our Rails monolith and that seems to be one of the features that's "missing". I'm planning on implementing a temporary solution in our codebase, but it's not ideal...

Hack
module Kernel
  mattr_accessor :debugger_method, instance_accessor: false

  def disable_debug
    return unless Kernel.respond_to?(:debugger)

    Kernel.debugger_method = method(:debugger)
    Kernel.define_method(:debugger) { nil }

    nil
  end

  def enable_debug
    return unless Kernel.debugger_method

    Kernel.define_method(:debugger, Kernel.debugger_method)
    Kernel.debugger_method = nil

    nil
  end
end

@joshuay03
Copy link

joshuay03 commented Apr 28, 2024

Having played with debug a bit more, I think I now understand what OP meant.

In pry, !!! would exit, but then on a subsequent request, execution would halt at a breakpoint again. With debug however, once you exit (at least when using it with Rails + puma), you need to restart the server to hit another breakpoint.

If for example you're stuck in a loop, with pry you can use !!!, remove your breakpoint and refresh the page. And if you put a breakpoint back in, and continue making requests, it'll halt as usual. But that's not the case with debug...

@adillari
Copy link
Author

@joshuay03 That's what I mean, yes. It was quite useful in a Rails setting.

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