How can I 'jump to cursor' while debugging?

Hi!,

While debugging, I would like to skip some statements and jump directly to a specific line. ¿Is this possible in pycharm?

Thanks!
14 comments
Hi Pedro, Run | Run to cursor (Alt + F9) jumps directly to the line where your cursor is placed. If you want to skip break points as well use Run | Force run to cursor (Shift + Alf + F9)
0
Hello Dmitry, I have tried Run to cursor, but it runs every line until it gets to the cursor. What I want is to continue execution at the cursor directly, skipping the execution of intermediate lines.

It is funny, because doing 'Run to cursor' in pyDev did exactly this, which I found useful when you needed to skip some statements for whatever reason, or when you want to go back a couple of lines to re-run a previous statement.
0
That is impossible in PyCharm. You can submit an issue to http://youtrack.jetbrains.com/issues/PY
But note that even in PyDev it works only inside one function(you can't skip statements and go to another call).
0
Thank you for the info, Dmitry.
0
Yes, that's what I was looking for. I usually need it to skip one or two statements or to go back a small amount, always inside the same function.
0

It seems this is now implemented (https://www.jetbrains.com/help/pycharm/jumping-to-cursor.html)

Unfortunately, it doesn't seem to work. 

0

Hi! What exactly doesn't work in your case? Make sure you are using the latest version (2017.3.1), there was a bug (PY-27227) in the previous version which causes Jump to cursor action to be hidden if a non-Python run configuration is selected.

0

When I tried this repeatedly a couple of days ago, it simple didn't jump back (as I continued to step line-by-line forward).

Today it seems to work, however.

0

When I try to jump to cursor, I get

Process finished with exit code 135 (interrupted by signal 7: SIGEMT).

Or the process runs to cursor, instead of jumping.

I am running Ubuntu

0

Does code run fine outside PyCharm? What do you mean by "process runs to cursor, instead of jumping"?

0

The code runs fine outside of PyCharm.  I have an os.system() call that takes a long time because it's copying a lot of files from one folder to another.  But once I've copied the files once in a debug run, I don't need to copy them again so I put a breakpoint on the call. 

When the breakpoint fires, I move my cursor down two lines in the code and then select Run|Jump to Cursor.  

Either the process immediately finishes with exit code 135 (interrupted by signal 7: SIGEMT), which is an Emulator trap; this results from certain unimplemented instructions which might be emulated in software, or the operating system's failure to properly emulate them.

Or the process runs the code line under the breakpoint and the rest of the codelines until it reaches the cursor, instead of jumping to the cursor.

I am running Ubuntu 16.04 and I installed PyCharm 2017.3.3 with umake using these directions: https://itsfoss.com/install-pycharm-ubuntu/

0

I couldn't reproduce the issue on my machine. There is a known problem that curent line is executed on "Jump to cursor": https://youtrack.jetbrains.com/issue/PY-26101

If it's possible please attach sample project example to that issue for investigation.

0

I'm not surprised you couldn't replicate it.  You probably didn't install PyCharm on my particular version of Ubuntu the way that I installed it as mentioned in the earlier comments.  If you can tell me how I can determine how PyCharm is firing the SIGEMT error then I can give you something that you can bug fix.

0

Hi Kjohnsrude!  Unfortunately, it isn't possible to get any logging information after SIGEMT. When executing "Jump to Cursor", it changes execution point and it can lead to some inconsistent program state. Unfortunately, we can't fix this problem until we reproduce it.

0

Please sign in to leave a comment.