[Python-Dev] short-circuiting runtime errors/exceptions in python debugger.

Nathaniel Smith njs at pobox.com
Mon Oct 29 20:09:22 EDT 2018


On Mon, Oct 29, 2018 at 11:59 AM, Chris Jerdonek
<chris.jerdonek at gmail.com> wrote:
> A simpler feature that could possibly help him (assuming there isn't any
> external state to deal with) would be the ability to save everything at a
> certain point in time, and then resume it later. He could rig things up to
> save the state e.g. after every hour: 1 hour, 2 hours, etc. Then if an error
> occurs after 2.5 hours, he could at least start resuming after 2 hours. This
> could be viewed as a cheap form of a reverse debugger, because a reverse
> debugger has to save the state at every point in time, not just at a few
> select points.

That's very difficult to implement without help from the operating
system, but there is prior art...

On Unix, you can use fork() as a hacky way to do this – fork() off a
process every once and a while, and have the children enter some kind
of loop waiting for instructions (continue / enter debugger / exit /
...).

Or, on Linux, there's: https://www.criu.org/

I also wonder if it would be useful to give pdb the ability to break
when an exception is *raised*, rather than when it's caught?

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-Dev mailing list