2

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 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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
anijhaw
  • 8,954
  • 7
  • 35
  • 36
  • http://stackoverflow.com/questions/192109/is-there-a-function-in-python-to-print-all-the-current-properties-and-values-of this question and the answer given by @JeremyCantrell is the most useful. – franklin Jul 19 '13 at 03:11
  • Possible duplicate of [How do you watch a variable in pdb](http://stackoverflow.com/questions/7668979/how-do-you-watch-a-variable-in-pdb) – qff Apr 12 '16 at 13:29
  • Possible duplicate: https://stackoverflow.com/questions/14139817/python-in-pdb-is-it-possible-to-enable-a-breakpoint-only-after-n-hit-counts – anijhaw Jan 22 '18 at 00:58

2 Answers2

1

Yes, take a look here:

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

anijhaw
  • 8,954
  • 7
  • 35
  • 36
icyrock.com
  • 27,952
  • 4
  • 66
  • 85
0

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.