0

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.

Irbis
  • 1,432
  • 1
  • 13
  • 39

1 Answers1

0

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)

DRapp
  • 47,638
  • 12
  • 72
  • 142