FROM : Randall Meadows
DATE : Wed Mar 19 19:34:35 2008
On Mar 19, 2008, at 12:23 PM, Jens Alfke wrote:
> Here's some advice on how to debug stuff like this in the future...
>
> The exception message is a good clue:
> 2008-03-19 17:19:30.957 cocoabc[10832:10b] *** -[NSCFString
> accident]: unrecognized selector sent to instance 0x33b040
> This shows that the receiver of -accident was an NSCFString object.
I've gotten some messages that just gave an address, not a class
name. I delightfully discovered that sending -class to the raw
address was just as valid and useful. This may be a "duh" moment for
some, but eye-opening to me, and has come in quite handy recently.
> The way I would track something like this down is, first, to set a
> symbolic breakpoint on objc_exception_throw (via Xcode's breakpoints
> window.) This is always a good thing to have. Then run the app in
> the debugger and it'll hit the breakpoint when the exception's raised.
I 2nd this recommendation.
> Now select the topmost application stack frame — it'll be on the
> line that calls [firstNote accident]. Then you can enter "po
> firstNote" in the debugger console to see the object's description.
> But as you pointed out, it looks like the description of a DBNNote
> object even though it's a string, so you can't really tell from
> that. A more surefire test is to enter "po [firstNote class]", which
> will print "NSCFString" instead of "DBNNote". That's your smoking gun.
>
> The "po" and "p" commands are incredibly useful debugging tools,
> since they let you make nearly any Objective-C call interactively on
> your running code. Gdb understands a surprisingly large subset of
> Objective-C syntax.
'po $eax' has become my friend lately as well. It displays the
register that contains the exception object that's already been
thrown, after you've already crashed._______________________________________________
Cocoa-dev mailing list (<email_removed>)
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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
This email sent to <email_removed>
DATE : Wed Mar 19 19:34:35 2008
On Mar 19, 2008, at 12:23 PM, Jens Alfke wrote:
> Here's some advice on how to debug stuff like this in the future...
>
> The exception message is a good clue:
> 2008-03-19 17:19:30.957 cocoabc[10832:10b] *** -[NSCFString
> accident]: unrecognized selector sent to instance 0x33b040
> This shows that the receiver of -accident was an NSCFString object.
I've gotten some messages that just gave an address, not a class
name. I delightfully discovered that sending -class to the raw
address was just as valid and useful. This may be a "duh" moment for
some, but eye-opening to me, and has come in quite handy recently.
> The way I would track something like this down is, first, to set a
> symbolic breakpoint on objc_exception_throw (via Xcode's breakpoints
> window.) This is always a good thing to have. Then run the app in
> the debugger and it'll hit the breakpoint when the exception's raised.
I 2nd this recommendation.
> Now select the topmost application stack frame — it'll be on the
> line that calls [firstNote accident]. Then you can enter "po
> firstNote" in the debugger console to see the object's description.
> But as you pointed out, it looks like the description of a DBNNote
> object even though it's a string, so you can't really tell from
> that. A more surefire test is to enter "po [firstNote class]", which
> will print "NSCFString" instead of "DBNNote". That's your smoking gun.
>
> The "po" and "p" commands are incredibly useful debugging tools,
> since they let you make nearly any Objective-C call interactively on
> your running code. Gdb understands a surprisingly large subset of
> Objective-C syntax.
'po $eax' has become my friend lately as well. It displays the
register that contains the exception object that's already been
thrown, after you've already crashed._______________________________________________
Cocoa-dev mailing list (<email_removed>)
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:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Davide Benini | Mar 19, 17:33 | |
| Julien Jalon | Mar 19, 17:40 | |
| Davide Benini | Mar 19, 18:00 | |
| Jens Alfke | Mar 19, 19:23 | |
| Randall Meadows | Mar 19, 19:34 |






Cocoa mail archive

