You can set a conditional break point in Xcode by setting the breakpoint normally, then control-click on it and select Edit Breakpoint (choose Run -> Show -> Breakpoints).
In the breakpoint entry, there is a Condition column.
Now, there are several issues to keep in mind for the condition. Firstly, gdb does not understand dot syntax, so instead of myObj.name, you must use [myObj name] (unless name is an ivar).
Next, as with most expressions in gdb, you must tell it the type of return result, namely "BOOL". So set a condition like:
(BOOL)[[myObj name] isEqualToString:@"Bar"]
Often it is actually easier to just do this in code by temporarily adding code like:
if ( [myObj.name isEqualToString:@"Bar"] ) {
NSLog( @"here" );
}
and then setting the break point on the NSLog. Then your condition can be arbitrarily complex without having to worry about what gdb can and can't parse.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…