Re: Breakpoint condition "foo == YES" is ignored
Re: Breakpoint condition "foo == YES" is ignored
- Subject: Re: Breakpoint condition "foo == YES" is ignored
- From: Fritz Anderson <email@hidden>
- Date: Sun, 02 Feb 2014 23:45:37 -0600
On Feb 2, 2014, at 10:45 PM, Jerry Krinock <email@hidden> wrote:
> In the “Condition” field, enter: foo == YES
Your question deserves more and better attention than I can give at bedtime, and this doesn’t seem to relate directly to your problem (the surprising value is 0), but this has to go into the record as often as humanly possible:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not compare against YES. Ever.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It seems a true Boolean type is being phased into Objective-C, but for the past quarter-century, BOOL has been defined as signed char, and YES as ((BOOL)1). YES is true in C conditionals.
So is 42. If foo==42, your code will behave as if foo==YES, but your breakpoint will never fire.
As to
> foo should be YES, because that was a breakpoint condition.
Do you have any reason to believe that, other than that if the debugger does it, it must be so?
What is the optimization level?
I’ve found lldb surprisingly picky about conditional expressions. I find I have to cast aggressively, particularly at the outer expression: (BOOL) (onlyIfVulnerable != NO). Try that.
When I don’t cast religiously, lldb refuses to see anything it can use as a condition in the breakpoint-condition field. Execution gets to the breakpoint, lldb can’t handle the condition, so it breaks _unconditionally,_ and prints a message saying it can’t parse the condition.
Your video cut off the bottom of the console view before you erased it. What was at the bottom?
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden