I have a Python program with a function foo() in it.
I run the program with PDB, and stop at an arbitrary breakpoint somewhere within the program.
Now, it's easy for me to call foo() from within PDB, I just type:
!foo()
And foo runs. As soon as it finishes, it drops back to PDB, and I'm still waiting at the original line my program was at before.
But now let's say I want PDB to stop at a breakpoint within foo. I set a breakpoint in my source file on the first line of foo(), and then execute !foo().
But PDB doesn't stop at the breakpoint. It only seems to stop there if foo() is called from within the program, not from PDB's command-line while the program is running.
Does anybody know any way around this? I've searched the PDB documentation and Google to no avail.
(The reason I need to do this is because my program takes an hour to read all necessary data to boot up, and I need to be able to debug as much as possible within a single debugging session, as opposed to simply adding breakpoints and re-running the program. So the flexibility of calling functions interactively, and debugging them within, would be tremendously helpful.)