guettli
guettli

Reputation: 27987

pyCharm Debugging: skip framework code

Is there a way to tell pyCharm that it should skip framework code? The debugger should skip all lines which are not from me.

In my case it is very easy to tell which code I want to debug and which not:

If I press F7 (Step Into) it should skip all lines which are not from my code base.

Upvotes: 8

Views: 1817

Answers (1)

Oliver Bestwalter
Oliver Bestwalter

Reputation: 5397

[Update May 2015: introduced in PyCharm 4.5]

There are two new features now, one of which is the one you asked for, but I mention the other one as well because it is topically very close.

From the 4.5 release notes:

Step into My Code

Stay focused on your code by telling the debugger to step only through your project code, as opposed to stepping through the library sources.

[...]

Ignore Library Files

The debugger is improved with the new 'Ignore library files' option. Use it to have the debugger stop inside your code in case the exception is raised in a library module, instead of stopping inside the library code.

[Update after learning about blackboxing libraries in debugging] In this answer it is mentioned that you can add the modules to ignore into "the dict DONT_TRACE in /helpers/pydev/pydevd.py"

And there is an open issue on the issue tracker.

[original answer] It is not possible to skip code like that, but you can flexibly switch between walking through the code line by line and making bigger jumps in a running debug session by simply adding another breakpoint (while debugging - break points can be changed in a running debug session) at the position after the library code you want to skip and press 'Resume Program' in the Debugger. The library code is skipped and you are back in your code.

You might also want to use conditional breakpoints to make sure that the program breaks into the debugger exactly when the program is in the state that you desire: right click on a breakpoint and enter a condition that has to evaluate to True in the context of that line. The conditional breakpoint makes sure that the execution stops when idx has the desired value.

Upvotes: 8

Related Questions