There is a very useful feature in Visual Studio allowing you to set a conditional breakpoint on a line of code. The breakpoint will be triggered only when the condition is met.
To create a conditional breakpoint, just add a standard breakpoint, then move the mouse over it and click on the gear icon.
You can set one or more conditions by adding boolean expressions involving any variable in scope at the breakpoint line.
While setting a condition for a numeric variable is pretty straightforward, when you want to check a string variable you have to add some functions to be evaluated in the condition textbox:
Comparing strings in a conditional breakpoint
// ASCII strings
strcmp(charArrayPointer, "my value")==0 // check if two strings are equal
strstr(charArrayPointer, "substring")!=0 // check if a string contains the other
// Unicode strings
wcscmp(wcharArrayPointer, L"my value")==0 // check if two strings are equal
wcsstr(wcharArrayPointer, L"substring")!=0 // check if a string contains the other
// If you are working with std::string, you can get the char array pointer
// in this way: aString._Bx._Ptr