简体   繁体   中英

How Can I set a C++ breakpoint programmatically in Eclipse, when a certian condition is true?

I'm working on Eclipse on Ubuntu 12.04. I have a huge project with multiple files and classes. One member variable of a class is set to wrongly to zero somewhere during run time and I don't know when that happens. I would like to be able to set a breakpoint programmatically to break once say x is set to zero during runtime.

How can I do that please? Thank you.

You can use breakpoint conditions for that.

Right click on the break point and set a condition in its property window. You can set a condition like

memberVal == null

See this article for detailed instructions.

Edit

Change all your occurances of your member valriable from

memberVar = value

to

SetMemberVar(value)

and set in that setter method a breakpoint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM