On Dec 10, 2009, at 4:51 PM, Joe Programmer wrote:

> I made a similar post to the Xcode list originally, but it was suggested that 
> I redirect it to the Cocoa list.  Here it is:
> 
> I'm working with a Cocoa app compiling with gcc 4.0 in Xcode 3.2.1.  Both the 
> debug and the release builds launch fine from the Finder, but the app does 
> not launch through the debugger in Xcode.  The app's icon appears in the doc, 
> but the app just hangs in the debugger.
> 
> This app was debugging fine under Xcode 2.5 and 10.5.x.  However, I had to 
> update the code in countless places to get it to build in 3.2.1 and 10.6.  
> Backing out those changes to discover the cause is something I'd like to 
> avoid if possible.  I made some changes to resources, but I *think* I was 
> able to back them all out with the error still occurring.
> 
> Two occurrences of this massage are appearing in the console:
> 
> -[NSCFArray _getCString:maxLength:encoding:]: unrecognized selector sent to 
> instance 0x4016e0
> 
> In a reply to my Xcode list post, "From the method signature, it looks like 
> the message should have been sent to an instance of NSString, rather than 
> NSArray, but the leading underscore indicates it is an internal method and 
> might indicate some 'class cluster' trickery going on behind the scenes".  I 
> would concur.

Hmmmm --- I would not concur.    Here's a potential cause:  The ' fingerprint ' 
of the error you are seeing occurs 
when an object has been over-released.    Let's say that in this case the 
object in question was an NSString.
Somehow, well, because of a mistaken over-release, the memory that was 
previously occupied by the now
deallocated NSString is now occupied by an NSArray (NSCFArray).   The code then 
sends an NSString message
via an object reference that was once pointing to an NSString but is now 
pointing to an NSArray . . .

> 
> With my limited knowledge of Cocoa, viewing the call stack does not reveal 
> the cause of this problem.
> 
> #0    0x92fad4e6 in objc_exception_throw
> #1    0x92a0790b in -[NSObject(NSObject) doesNotRecognizeSelector:]
> #2    0x92962db6 in ___forwarding___
> #3    0x92962982 in __forwarding_prep_0___
> #4    0x9291bc53 in CFStringGetCString
> #5    0x930a4990 in _RegisterApplication
> #6    0x930a3182 in GetCurrentProcess
> #7    0x908e2071 in GetSystemUIMode
> #8    0x908e2013 in IsMenuBarVisible
> #9    0x93991092 in _NSInitializeAppContext
> #10   0x9399094c in -[NSApplication init]
> #11   0x93990485 in +[NSApplication sharedApplication]
> #12   0x9398f45d in NSApplicationMain
> #13   0x00002f6e in main at main.m:42
> 
> Occasionally, I am able to continue stepping/breaking  through model and 
> controller init code beyond the two breaks at objc_exception_throw, but never 
> consistently, probably because memory is trashed.
> 
> Might anyone offer any insight as to what might be going on and/or where to 
> go from here?

If you can run Clang (via Build and Analyse), it might help pinpoint potential 
trouble spots.
But it also sounds as if you are fairly close to homing in on it based on what 
you just said about
stepping through the code.

    Cheers,
        . . . . . . . .    Henry



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to