I just noticed an odd behavior when using l
(i.e. the list
command) in ipdb
. I think I have seen something similar with the Perl debugger in the past, but it still puzzles me.
The first time I inoke it shows corerectly ~10 lines of code around the current step (breakpoint). However, if I press it repeatedly, it does not show code around the current location anymore, but instead it shows code that comes below it.
Eventually list
shows the final lines of the script, and if I press l
again it doesn't show anything anymore.
Why is this, and how can I have it behave consistently as the first time I invoke it?
In [1]: raise Exception --------------------------------------------------------------------------- Exception Traceback (most recent call last) <ipython-input-1-fca2ab0ca76b> in <module>() ----> 1 raise Exception Exception: In [2]: %debug > <ipython-input-1-fca2ab0ca76b>(1)<module>() -1 raise Exception ipdb> l ----> 1 raise Exception ipdb> l ipdb> l
Those last two list commands return nothing, just as the OP says. – Enact