Breakpoint at end of if statement in VS Code

Viewed 294

How can I place a breakpoint at the end of an if statement when debugging C++ code using CMake Tools and the C/C++ extension?

Here is some sample code:

int a = 2;
for (int i = 0; i < 10; i++) {
  if (i < a) {
    b += i;
  } // <-- I would like to break here and check the value of b, so I place breakpoint here
}
otherCode(b); // <-- this is where the debugger breaks

Now I will do a hack like int HACK_REMOVE = 0; at the end of the if statement, but it is annoying to have to do that. Is there another way to break at the end of a statement?

0 Answers
Related