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!
While debugging, I would like to skip some statements and jump directly to a specific line. ¿Is this possible in pycharm?
Thanks!
请先登录再写评论。
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.
But note that even in PyDev it works only inside one function(you can't skip statements and go to another call).
It seems this is now implemented (https://www.jetbrains.com/help/pycharm/jumping-to-cursor.html)
Unfortunately, it doesn't seem to work.
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.
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.
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
Does code run fine outside PyCharm? What do you mean by "process runs to cursor, instead of jumping"?
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/
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.
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.
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.
According to the documentation here: https://www.jetbrains.com/help/pycharm/stepping-through-the-program.html#jump-to-cursor this should now be possible (found it mentioned on stackoverflow as well) but on my installation I can't find the option. Does it require enabling some setting?
Currently using PyCharm 2024.1.3 (Professional Edition)