See where different debugging sessions diverge
This would be super hard to implement, but I'm putting it here in the hopes that someone will do it, or maybe point out an easy way to do it.
A common thing that I have to debug is two functions that give different things in different environments (say, two different git checkouts of some code, or whether or not a certain optional dependency is installed). The way I typically debug this with PuDB is to run the two side-by-side, and step through them both in parallel, and try to figure out exactly where they diverge.
This is super annoying, though, especially since it usually means stepping past the divergent point for each place in the stack, and then restarting and checking the next frame. Plus, it's easy to miss stuff, so that you have to restart again with no new information, and tricky to get the breakpointing right.
What I would like is some way to start PuDB from a given breakpoint (it has to be from a breakpoint, because e.g., if things differ from an optional dependency, I would want to skip things that diverge in unrelated code paths that do different setups when it is installed or not), and basically runs this schemata for me automatically, stopping when it notices the code going along a different path, or a variable set to a different value.
A thought occurred to me of an potentially easier way to do this, which would probably be useful for other things as well. There should be a way to "bisect" along breakpoints. The idea is that you run a piece of code once, and it gathers all possible breakpoints that would break that code (in a non-duplicating fashion; "breakpoint" here would have to be some kind of extended notion of a breakpoint that only breaks after an nth iteration over a line). Then, you run it again, and it bisects along those breakpoints. So first it enables the middle breakpoint. Then you tell if if you want an earlier or a later breakpoint, and it breaks on that, and so on, until you've stopped at exactly the part of the code that interests you (in this case, where different things diverge, but it could be useful for other things too I'd imagine).
Right now, this idea sounds much more tractable than the original one, but I'd love to hear if anyone has any ideas for either. What sorts of features to fancy debuggers like visual studio offer these days that could solve this sort of problem?
I have experimented python -m trace -t run_script.py today, but the output is enormous.
The intention was to diff between the outputs of two different branches, but I guess the output has to be changed.