'Visual Studio 2017 - break when a variable is read
I use Visual Studio 2017 for C++ projects. I can set a data breakpoint to break when a value of the variable is changed. Is it possible to set a breakpoint when a variable is just read, for example:
int x = 5;
//somewhere in the code
int y = x; //break when x is read
?
I would like to break every time the variable x is read.
Solution 1:[1]
Take a look at this that explains difference between property and fields
Instead of just a variable creation, if you have a property, you would be able to set a breakpoint at EITHER the getter (value is being read/accessed) or setter (assigning a value TO)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DRapp |
