This should make many C/C++ developers happy when Visual Studio 2010 becomes available (you can download Visual Studio 2010 Beta 1 right now). In previous versions of Visual Studio, one of the complains that we’ve received is that developers want to use string manipulation functions like strcmp() and strlen() in a conditional breakpoint and have the debugger break only when the condition becomes true.
Let’s look at an example to make this more concrete. In the following code, I have a function that given a menu (CMenu) and a string (LPCTSTR), finds the ID for a menu item from the menu. Now, let’s say that I want the debugger to break when menuString = "&Help". I could step through the for loop until I see that the value of str = "&Help". Alas, that can get tedious very quickly as my index finger becomes numb after pressing the F11 or F11 over & over.
With the Visual Studio 2010 debugger, this problem is now solved since we now provide the ability for the developer to set a conditional breakpoint where the condition contains one of a number of string manipulation functions. In the example above, I can now set a breakpoint with the expression strcmp(str, menuString) == 0 as the condition, shown below.
Now, when you run the application, the debugger will only break when menuString == "&Help". The Breakpoints window also clearly shows that the breakpoint will be when when the condition is true.
One thing to remember is that we don’t support all the string manipulation functions. Below is the list of functions that we support in Visual Studio 2010 Beta 1. This list may grow/shrink by the time we release the final product. In the mean time, if you have any feedback, e.g. you think we should add other functions, feel free to leave a comment.