开发者

Monitor the state of an object in pdb

开发者 https://www.devze.com 2023-01-26 04:22 出处:网络
I am using python 2.4 and trying to debug a twisted application. Is there any way by which I can perhaps put a watch on an object开发者_Go百科 and break execution when its value changes.

I am using python 2.4 and trying to debug a twisted application.

Is there any way by which I can perhaps put a watch on an object开发者_Go百科 and break execution when its value changes.

For Example

To start with A.state="connected" What I want is a notification or pause in execution when A.state changes its value.

I am new to pdb and twisted so if you feel this question needs more info, I can provide it.


Yes, take a look here:

  • http://docs.python.org/library/pdb.html

Here is a more detailed answer. python: in pdb is it possible to enable a breakpoint only after n hit counts?


If state is a property of A with a setter method, then you can set a break point inside its setter method and the execution will break whenever there is an attempt to change it.

0

精彩评论

暂无评论...
验证码 换一张
取 消