This should be such an easy question to answer. I'm a bit of a newbie to Visual Studio Code and I'm struggling to work out how to get the "Hit Count" conditional breakpoint feature to work. I've got a simple for loop set up like this:
for (int i = 0; i < 10; i++)
{
cout << i << endl;
}
I put a breakpoint on the cout line, right-clicked it and clicked "Edit Breakpoint..." and changed the drop-down box to "Hit Count". I want to simply have the breakpoint fire on the 5th iteration through the for loop, but I can't figure out how to write the expression. No matter what I write, the program breaks at the first pass through the loop. I've tried "5", "== 5" and "Hit Count == 5" but nothing works.

If anyone could tell me what I'm doing wrong, I'd be grateful! All the stuff I can find online is about Visual Studio and not VSCode.
This link helps you.
https://github.com/microsoft/vscode/issues/13211
I think, If you want to use it when hit-count is 5, you can write '= 5'.
example
For me,(using javascript)
You can see the change(the output value 'i') in the left 'watch' section.
enter image description here
I set "hit-count '>= 5' ". so 4, 5, 6, 7, 8, 9(the output value 'i') are printed
I hope this helps
The Hit Count feature is NOT supported by the GDB C++ debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With