• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fixing logged error that doesn't throw exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fixing logged error that doesn't throw exception


  • Subject: Re: Fixing logged error that doesn't throw exception
  • From: Eric Slosser <email@hidden>
  • Date: Fri, 26 Jun 2009 15:05:40 -0400


On Jun 25, 2009, at 5:34 AM, Tristan Celder wrote:

I'm extremely new to Cocoa programming but have come across a problem where I am getting a [NSConcreteAttributedString initWithString:] called with nil string argument. pop up in my console. I have had it once before and managed to track it down to a NumberFormatter with no symbols set for nil/null values. This problem was the cause of a far more serious problem which was a very bizarre error which breaks my core data bindings for any table view displaying exactly one row of an attribute fetched via a relationship when a document is reopened after save.

Unfortunately the console warnings have begun popping up again, and this time I have absolutely no idea where/who/what could be causing them in my interface. (It's only when I do a clean build that they show up in the first place). So... what I would really like to know is how I can find the source of these messages. A previous post I dug up, simply mentions that one can "test the location on the stack which holds the parameter." which can be done using the syntax "* (id*)($ebp + 16)".



If the message is popping up in the console, but no exception is being thrown, maybe you can find it by setting a conditional breakpoint on that routine, for whenever "nil" is passed it. To do that in Xcode, double click on the words "Double-Click for Symbol" in the "breakpoint" column of the breakpoints window, and type

	-[NSConcreteAttributedString initWithString:]

That sets a breakpoint on the method that I suspect is logging the message to console. To check if the 3rd argument is nil (see "Architecture Considerations" and "Objective-C" in <http://developer.apple.com/technotes/tn2004/tn2124.html >, and understand that gdb will set the BP after the preamble) type the following in the condition column:

	*(int*)($ebp+16)==0

I've tried this, and it works.

  - - -

You could also follow Jesper's advice and set a breakpoint on asl_send. That'll be triggered for every NSLog (and more), so you may have to "continue" a lot before you see the stack trace you care about. So you can set a condition on the asl_send breakpoint, looking only for the text you care about. That text can be retrieved by

	(char*) ask_get( *(int*)($ebp+12), "Message" )

I don't have time to work out the gdb conditional, but you get the idea. Maybe a call to strstr().




_______________________________________________

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


References: 
 >Fixing logged error that doesn't throw exception (From: Tristan Celder <email@hidden>)

  • Prev by Date: Re: document specific "as-you-type" spell checking
  • Next by Date: Re: extending NSSavePanel, how to disable <save> button?
  • Previous by thread: Re: Fixing logged error that doesn't throw exception
  • Next by thread: Badge color in Leopard
  • Index(es):
    • Date
    • Thread