Debugger "Set Next Statement"

Answered

I am using the --- mostly excellent --- Community Edition of PyCharm.

One thing I badly miss in the debugger is the Set Next Statement of most other debuggers (e.g. C/C++/C# Visual Studio/gdb).  That allows you to click on a line in the current function and make that the next line to be executed, e.g. can be used to skip the next line to be executed and continue at the following line, or equally to re-execute the previous line.  Please note this is most certainly not the same as, say, Run to Cursor or Force Run to Cursor.

It seems that https://intellij-support.jetbrains.com/hc/en-us/community/posts/206977725-963-Set-next-statement?input_string=Debugger%20%22Set%20Next%20Statement%22 may be the same request.  I think the implication there is that this is not possible in the JDK used by PyCharm debugger (?), but that was 13 years ago, one would have hoped for some enhancement since then?!

 

Is it not possible to offer this under PyCharm/JDK/Python?

0
8 comments

Hi Jnbarchan! This feature is in fact already implemented and is on review right now. It's going to be included in 2017.3 update. Corresponding ticket: PY-9537.

1
Avatar
Permanently deleted user

@Pavel  Excellent!  Only 13 years to implement ;-)  [jokey smile, not intended as a dig!]  Thank you.

0
Avatar
Permanently deleted user

Any update? I'm using 2018.1 and there is no such feature (or am I missing something)?

0
Avatar
Permanently deleted user

Any update in the last 6 months? I'm using 2018.2 this time.

0

The action is called Jump to Cursor. Start the debugger, wait till the breakpoint is hit, right-click on the desired line and select Jump to Cursor.

0
Avatar
Permanently deleted user

@Tome, @Pavel Karateev

This feature is indeed implemented as per the posts above.  However, be aware that in my experience it only works about 50% of the time, the other 50% you set the current statement back, say, one line but it has no effect and the code continues from the line it had originally reached.  Admittedly I am only using PyCharm 2018.1 (due to further unaddressed bugs in later versions), with Python 3.7.6., under Ubuntu 18.04.

0

@Jnbarchan Could you provide a code sample please? I am not aware of the known bugs with Jump to Cursor. There're some limitations though, e.g. you can not jump out of the current scope but one should see a meaningful error message on such an attempt.

0
Avatar
Permanently deleted user

@Pavel Karateev

Thank you for your interest.

I am aware of scope limitations, that is not the issue.  When it happens I do not receive an error message, the JumpToCursor appears to "take" OK, but execution nonetheless ignores and continues from where it had previously got to.

Now, I quite understand that for a code sample you need something standalone, simple & repeatable.  The problem, as you can imagine, is that it happens when I am in the middle of debugging 32k lines of project code.  It is difficult/time-consuming to try to stop, set up some small example and make it happen again, even if that can be done.  So I will try to do so the next time I happen to need this and it goes wrong and I have time to stop and sort out what the pattern is, but don't hold your breath for when! :)

0

Please sign in to leave a comment.