views:

58

answers:

2

I have a member variable struct in a C++ class I'm debugging in Visual Studio 2008 Professional. I would like to break any time the struct changes. Is it possible to do this, or must I look for every possible point in the code it could change, and set breakpoints there?

A: 

You can set up conditional breakpoints.

http://support.microsoft.com/kb/308469

treefrog
Right. It's not an issue of "how to I break" but "where do I want to break".
Rosarch
+3  A: 

If you can determine the address of the member, you can set a data breakpoint on it:

http://msdn.microsoft.com/en-us/library/350dyxd0.aspx

MSN
I don't think you even need the address to do that.
treefrog
+1. You need the address. And you cannot watch the entire structure.
Hans Passant
@rofly, strictly speaking, you can use a global symbol or an expression that evaluates to an address. But in the end, the processor can only set data breakpoints for addresses, so it has to be translatable to an address.
MSN