How to set conditional breakpoint in Xcode?
My situation is here
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000db8f in -[Instrument getFormattedPriceString:] at Instrument.m:195
condition not yet parsed: (bool)[[self name] hasPrefix:@"7_"]
breakpoint already hit 1 time
Current language: auto; currently objective-c
(gdb) p (bool开发者_Python百科)[[self name] hasPrefix:@"7_"]
$1 = false
(gdb) po name
2_YEAR
Despite that fact that condition evaluates correctly, my breakpoint breaks the execution every time. I see some peculiar statement condition not yet parsed
here. Why GDB wouldn't parse my condition?
BTW I use xcode 3.2.6. Xcode4 doesn't even evaluate conditions like a==1
Consider a temporary assert() or NSAssert(). It's much more reliable that debugger-based expression evaluation. Remove the assert() call once you don't need the breakpoint anymore. The syntax is:
#include <assert.h>
assert( !(expression_on_which_to_break));
精彩评论