Is there is a tool or a setting in the debugger to stop on the break point or if variable is set to a particular value? I mean if I know that value will be set to "HELLO" then the debugger will stop or do the same if it reached some break point in the loop? Any advise would be helpful!
views:
120answers:
4
+4
A:
- Set a breakpoint anywhere in code.
- Enable the list of breakpoints window by going to Debug menu -> Windows -> Breakpoints.
- In your breakpoints window, right click on a breakpoint
- Select Condition...
- Enter any expression involving your variable
The breakpoint will be hit when the condition is met.
Via the right click on breakpoints menu, you can also set breakpoints:
- Only from certain processes or threads
- Upon hit counts
- Only when a condition or variable is changed
Brian R. Bondy
2009-11-16 16:35:04
Can you do string comparisons there?
jeffamaphone
2009-11-16 17:20:10
You can try and if it doesn't work you can for example only set a value to true in code when it's equal, and then use that as your condition.
Brian R. Bondy
2009-11-16 18:00:22
+2
A:
Daves answer.
And I'll add that you can just add a if statement that contains a couple of dummy statements and you put a breakpoint inside it. It does the same thing.
Typical use :
if (i == 250) {
int dummy = 2+2; //breakpoint here
}
In your case, since you watch the value of a string (assuming C++ strings)
if (mystring == "hello")
{
int dummy = 2+2; //breakpoint here
}
toto
2009-11-16 17:02:30
Or use DebugBreak() to break into the debugger and skip the dummy statement.
jeffamaphone
2009-11-16 17:20:44