Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipdb debugger, step out of cycle

Tags:

Is there a command to step out of cycles (say, for or while) while debugging on ipdb without having to use breakpoints out of them?

I use the until command to step out of list comprehensions, but don't know how could I do a similar thing, if possible, of entire loop blocks.

like image 913
Javier Novoa C. Avatar asked Jul 03 '15 00:07

Javier Novoa C.


People also ask

How do you jump out of a loop in pdb?

Once you get you pdb prompt . Just hit n (next) 10 times to exit the loop.

How do I get out of IPDB?

If you enter pdb interactive mode there is no way to return to ipdb or ipython. The proper way to exit is by using ctrl-d .

How do you step out in pdb?

As mentioned by Arthur in a comment, you can use r(eturn) to run execution to the end of the current function and then stop, which almost steps out of the current function. Then enter n(ext) once to complete the step out, returning to the caller.


1 Answers

I believe this is the intent of the until command. It's like a next except that when a jump occurs to a previous line number for the loop, it will continue until exiting the loop.

unt(il) Continue execution until the line with a number greater than the current one is reached or until the current frame returns 

In general, to "step out" of the current function, use return.

r(eturn) Continue execution until the current function returns. 
like image 194
John Lehmann Avatar answered Sep 17 '22 15:09

John Lehmann