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?

4

2 回答 2

1

我认为没有这样的方法,因为 pudb (和其他调试器)只能无条件地 set_trace() 。

我不确定通过将条件移动到 set_trace() 本身来完成什么。如果那里有一些重复的代码,只需将其包装在一个函数中。

于 2014-02-26T21:09:15.580 回答
0

在 pudb 中,您可以设置断点,然后编辑断点以跳过给定次数或仅在给定条件下触发。

于 2020-03-21T20:28:57.667 回答