I'm trying to debug a for loop and want to see what's happening inside after it has run for a while. It iterates several thousand times and I'd want to check what's happening every hundred or so. Is there a way to tell pdb to run the next command a few hundred times so I can check quickly?
There is the ignore
Parameter(Docs), which lets you skip n
iterations.
Say you have code like this:
import pdb; pdb.set_trace()
for i in range(1000):
pass
you could set a breakpoint with b 3
to line 3.
Then ignore the first 100 steps with ignore 1 100
(1
is the number of the breakpoint) and then c
to continue. Next stop will be after 100 iterations. If you want to pass the next 100 you have to write the ignore statement again.
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