0

In pdb/ipdb/pudb, is there a trick whereby I can selectively activate set_trace() statements during runtime?

I'm debugging somewhat complex code with probabilistic behavior, and I would like to interact with the program without the debugger distracting, and when a situation of interest arises, activate the set_trace/s. (This is combined with logging, but not relevant to the question).

I think might be possible to do this with conditionals, but is there a better way?

Basel Shishani
  • 7,735
  • 6
  • 50
  • 67

2 Answers2

1

I think there is no such way, as pudb (and the other debuggers) can only set_trace() unconditially.

I'm not sure what you are trying to accomplish by moving the condition into set_trace() itself.. If you have some repetitive code there, just wrap it in a function.

Beka
  • 725
  • 6
  • 22
0

In pudb, you can set a breakpoint, then edit the breakpoint to be skipped a given number of times or only trigger on a given condition.

JS.
  • 14,781
  • 13
  • 63
  • 75