If I use the debugger, most of the times I just want to see what the interpreter does in my code. I want to step over all code of the framework and libraries I use.
AFAIK this is called Black Boxing.
How can I do this with Python ipdb or an other Python debugger?
Imagine this:
I use a orm framework which I trust, and don't want to debug.
cut_hair_method(orm_object.user)
The method cut_hair_method()
is mine, and I want to debug it.
The orm_object
is from the framework I use. The debugger will step into the orm-code and do some special things, which I don't care about. I have no way to tell the debugger: Don't jump into the orm code!
Update
For my case it would be very easy to decide which code should be in the black box and which code not: Code in $VIRTUAL_ENV/src/
is not in the black box, all other code is. Except I explicitly tell the debugger something else.
Update2
I have the name "Black Boxing" from this article: https://hacks.mozilla.org/2013/08/new-features-of-firefox-developer-tools-episode-25/
Pycharm One of the best Python debugging tools for the core development process because it is a Python-specific IDE with outstanding debugging facilities. Rollbar Another approach for bug reporting and error aggregation.
The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame.
Debugging in Python is facilitated by pdb module (python debugger) which comes built-in to the Python standard library. It is actually defined as the class Pdb which internally makes use of bdb(basic debugger functions) and cmd (support for line-oriented command interpreters) modules.
The Python debugger base class (bdb.Bdb) has an a .skip attribute, giving a list of module names to skip over. You can provide this list either when instantiation the debugger, or later. If you want to provide a negative list (list of module that are your own), or otherwise compute whether a module should be skipped, you can subclass the debugger class and override is_skipped_module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With