How do I quit from debugger without exiting my IRB session?
Asked Answered
C

2

6

This is a long standing source of frustration, but maybe there is something I'm missing. If i'm in the middle of debugging, and I want to exit the debugger and return to IRB or Rails Console, "quit" won't work as it will exit IRB. "finish" also seems to have the same effect as continue. Using "delete" to remove breakpoints and then trying "continue" or "finish" doesn't work.

Any ideas?

Clava answered 12/11, 2011 at 18:2 Comment(0)
J
2

This SO question has a few good suggestions. It deals with specifically with debugging inside of loops. One great solution is to set the break point outside the loop, then from irb set it inside the loop and clear it manually when you want to.

Basically it comes down to putting a little bit of thought into where you set your breakpoints.

Other than that there doesn't appear to be anything else you can do.

Jowett answered 13/11, 2011 at 1:30 Comment(0)
B
3

At least in byebug, you can do this:

eval return

Which has the net effect of evaluating a return statement from the current function. That works sometimes, depending on how the call stack looks.

Now while this doesn't remove the current breakpoint .... if you just want control back, this will do that in most cases, depending on how your code is structured.

It also is useful to do this when creating a debug entry in your code:

byebug unless $continue

So if all else fails in a debugging session, you can always run

$continue = true
c

Now this opens up a whole set of possibilities.

Bucolic answered 28/10, 2016 at 10:56 Comment(0)
J
2

This SO question has a few good suggestions. It deals with specifically with debugging inside of loops. One great solution is to set the break point outside the loop, then from irb set it inside the loop and clear it manually when you want to.

Basically it comes down to putting a little bit of thought into where you set your breakpoints.

Other than that there doesn't appear to be anything else you can do.

Jowett answered 13/11, 2011 at 1:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.