Re: Fixing logged error that doesn't throw exception
Re: Fixing logged error that doesn't throw exception
- Subject: Re: Fixing logged error that doesn't throw exception
- From: Ken Thomases <email@hidden>
- Date: Wed, 27 May 2009 20:40:10 -0500
On May 27, 2009, at 7:15 PM, Graham Cox wrote:
I'm getting this in the log when I open the "Customize Toolbar" sheet:
-[NSConcreteAttributedString initWithString:] called with nil
string argument. This has undefined behavior and will raise an
exception in post-Leopard linked apps. This warning is displayed
only once.
Is this a bug in the frameworks or in my code?
Probably your code. Presumably Apple has tried to eliminate all
instances of this bug in their own code.
I tried setting a symbolic breakpoint on this but it doesn't fire at
all, though if it did I'm not sure how I'd make it conditional on
the string being nil as there are no debugging symbols.
You could test the location on the stack which holds the parameter.
On x86, that's:
*(id*)($ebp + 16)
You can also use DTrace:
sudo dtrace -n 'objc$target:NS*AttributedString:initWithString?:entry /
arg2==0/ {ustack();}' -p <pid>
(arg0 is 'self', arg1 is '_cmd', so arg2 is the first non-hidden
method parameter.)
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden