Unable to get vscode to stop at a conditional breakpoint in a C++ debug


This Content is from Stack Overflow. Question asked by PENG

I’m using VSC on a Mac to work on a C++ project running on a Linux VM using gcc & gdb. Everything works great, but I can’t get conditional breakpoints to work. If I set a breakpoint, execution will stop there every time. But if I make the breakpoint conditional on an expression, execution never steps.

The VSC debugging instructions don’t provide an example, so maybe I’m entering the conditions incorrectly.

I want the program to stop at the loop when i == 2. The expression I tried but didn’t work:

(i == 2)

Moreover, When I set a hit-count condition, execution stops the next time the breakpoint is reached, so that doesn’t seem to work as expected, either.


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?