Stop at the line where a variable gets changed

2019-01-26 04:34发布

I am trying to track down when did a variable gets updated. I have a watcher, but is there anyway to set up so the execution will get paused when the value is getting updated ?

标签: pycharm
2条回答
Ridiculous、
2楼-- · 2019-01-26 05:21

Currently pycharm does not have a default built-in feature that tracks variable modification in real time. Alternatively you can do this:

  1. run debug
  2. From debugger pane -> Variables, right click the variable you would like to track and and add it to Watches.
  3. In Watches pane, right click the variable and select referring objects.

The feature you are talking about is, I believe, called watchpoint support and according to this article: http://sourceforge.net/blog/watchpoints-in-python/ Eric and PyScriptor has the feature but not pycharm.

查看更多
【Aperson】
3楼-- · 2019-01-26 05:35

You can add a breakpoint in the line you need to watch and right-click it. Then in the dialog box you have "condition" as last input: add a condition that uses the variable you need and it should stop when you set it to.

查看更多
登录 后发表回答