Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Frustrating Cocoa bug

 
   Macintosh computer (Home) -> General Discussion RSS
Next:  Word docs try to use wrong version  
Author Message
Tord Kallqvist Rom

External


Since: Dec 14, 2003
Posts: 10



(Msg. 1) Posted: Tue Jul 18, 2006 9:55 am
Post subject: Frustrating Cocoa bug
Archived from groups: comp>sys>mac>programmer>misc (more info?)

I have an old chess program written using Cocoa and OpenMCL. Because
OpenMCL still doesn't work on the new Intel Macs, I am forced to
rewrite my program in Objective-C. The rewrite is mostly going fine,
but I have one very frustrating bug which I have no clue how to track
down. I have an initialization method with a signature like this:

-(id)initWithPGNString:(NSString *)string;

This method works perfectly when I feed it with a string read from a
file. However, when I feed it with exactly the same string read from
the pasteboard, the program crashes about 1/4 of the time. The exact
location of the crash varies. Sometimes it occurs in an apparently
random location in my own code, but most often it occurs in
objc_msgSend.

Another mysterious fact is that when I launch the program using
MallocDebug, the crashes never seem to occur.

Does anyone have any idea what the bug could be, and/or how to track
it down?

--
Tord Romstad

 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
hns

External


Since: May 19, 2006
Posts: 2



(Msg. 2) Posted: Tue Jul 18, 2006 9:55 am
Post subject: Re: Frustrating Cocoa bug [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tord Kallqvist Romstad schrieb:

> I have an old chess program written using Cocoa and OpenMCL. Because
> OpenMCL still doesn't work on the new Intel Macs, I am forced to
> rewrite my program in Objective-C. The rewrite is mostly going fine,
> but I have one very frustrating bug which I have no clue how to track
> down. I have an initialization method with a signature like this:
>
> -(id)initWithPGNString:(NSString *)string;
>
> This method works perfectly when I feed it with a string read from a
> file. However, when I feed it with exactly the same string read from
> the pasteboard, the program crashes about 1/4 of the time. The exact
> location of the crash varies. Sometimes it occurs in an apparently
> random location in my own code, but most often it occurs in
> objc_msgSend.
>
> Another mysterious fact is that when I launch the program using
> MallocDebug, the crashes never seem to occur.
>
> Does anyone have any idea what the bug could be, and/or how to track
> it down?
>
> --
> Tord Romstad

Looks like a alloc/release error in your implementation. You could try
to set NSZombieEnabled.

-- hns

 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
Tord Kallqvist Rom

External


Since: Dec 14, 2003
Posts: 10



(Msg. 3) Posted: Tue Jul 18, 2006 1:55 pm
Post subject: Re: Frustrating Cocoa bug [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hns DeleteThis @computer.org writes:

> Looks like a alloc/release error in your implementation.

Yes, it has to be something like that. I still can't track it down,
though. Sad

> You could try to set NSZombieEnabled.

Thanks, I didn't know about NSZombieEnabled. It looks like a nice
tool for debugging this kind of problem. But where do I look for
error messages? I don't see anything unusual in XCode's "Run Log"
window after setting NSZombieEnabled=YES in the program's
environment. The output of my own NSLog() statements is all that
appears, and the program seems to behave in exactly the same way as
with NSZombieEnabled=NO.

--
Tord Romstad
 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
Sean McBride

External


Since: Jan 05, 2004
Posts: 474



(Msg. 4) Posted: Wed Jul 19, 2006 7:06 pm
Post subject: Re: Frustrating Cocoa bug [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Tord Kallqvist Romstad wrote:

> > You could try to set NSZombieEnabled.
>
> Thanks, I didn't know about NSZombieEnabled. It looks like a nice
> tool for debugging this kind of problem. But where do I look for
> error messages? I don't see anything unusual in XCode's "Run Log"
> window after setting NSZombieEnabled=YES in the program's
> environment. The output of my own NSLog() statements is all that
> appears, and the program seems to behave in exactly the same way as
> with NSZombieEnabled=NO.

<http://developer.apple.com/technotes/tn2004/tn2124.html#SECFOUNDATION>
 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
Tord Kallqvist Rom

External


Since: Dec 14, 2003
Posts: 10



(Msg. 5) Posted: Fri Jul 21, 2006 9:24 pm
Post subject: Re: Frustrating Cocoa bug [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sean McBride writes:

> In article ,
> Tord Kallqvist Romstad wrote:
>
> > > You could try to set NSZombieEnabled.
> >
> > Thanks, I didn't know about NSZombieEnabled. It looks like a nice
> > tool for debugging this kind of problem. But where do I look for
> > error messages? I don't see anything unusual in XCode's "Run Log"
> > window after setting NSZombieEnabled=YES in the program's
> > environment. The output of my own NSLog() statements is all that
> > appears, and the program seems to behave in exactly the same way as
> > with NSZombieEnabled=NO.
>
> <http://developer.apple.com/technotes/tn2004/tn2124.html#SECFOUNDATION>

Yes, I found that technote. Unfortunately, it doesn't answer my
question of where to look for error messages (unless I am missing
something). When I set NSZombieEnabled to YES, no new error messages
are printed to stderr or the system log, so clearly they must be sent
somewhere else.

--
Tord Romstad
 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
Sean McBride

External


Since: Jan 05, 2004
Posts: 474



(Msg. 6) Posted: Sat Jul 22, 2006 5:16 pm
Post subject: Re: Frustrating Cocoa bug [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Tord Kallqvist Romstad wrote:

> Sean McBride writes:
>
> > In article ,
> > Tord Kallqvist Romstad wrote:
> >
> > > > You could try to set NSZombieEnabled.
> > >
> > > Thanks, I didn't know about NSZombieEnabled. It looks like a nice
> > > tool for debugging this kind of problem. But where do I look for
> > > error messages? I don't see anything unusual in XCode's "Run Log"
> > > window after setting NSZombieEnabled=YES in the program's
> > > environment. The output of my own NSLog() statements is all that
> > > appears, and the program seems to behave in exactly the same way as
> > > with NSZombieEnabled=NO.
> >
> > <http://developer.apple.com/technotes/tn2004/tn2124.html#SECFOUNDATION>
>
> Yes, I found that technote. Unfortunately, it doesn't answer my
> question of where to look for error messages (unless I am missing
> something). When I set NSZombieEnabled to YES, no new error messages
> are printed to stderr or the system log, so clearly they must be sent
> somewhere else.

"any attempt to interact with a freed object will raise an exception"
.... "You can use GDB to set a breakpoint on -[_NSZombie
methodSignatureForSelector:] to further debug this sort of problem"

No messages are logged. Basically you enable it and then run in the
debugger.
 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
Tord Kallqvist Rom

External


Since: Dec 14, 2003
Posts: 10



(Msg. 7) Posted: Tue Jul 25, 2006 2:55 pm
Post subject: Re: Frustrating Cocoa bug [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sean McBride writes:

> In article ,
> Tord Kallqvist Romstad wrote:
> >
> > Yes, I found that technote. Unfortunately, it doesn't answer my
> > question of where to look for error messages (unless I am missing
> > something). When I set NSZombieEnabled to YES, no new error messages
> > are printed to stderr or the system log, so clearly they must be sent
> > somewhere else.
>
> "any attempt to interact with a freed object will raise an exception"
> ... "You can use GDB to set a breakpoint on -[_NSZombie
> methodSignatureForSelector:] to further debug this sort of problem"
>
> No messages are logged.

Why not? In my experience, all other uncaught exceptions are logged ...

> Basically you enable it and then run in the debugger.

I tried, but the breakpoint was never reached. It appears that either
NSZombieEnabled=YES for some mysterious reason doesn't work as
intended, or that my bug is something else.

Anyway, thanks for trying to help!

--
Tord Romstad
 >> Stay informed about: Frustrating Cocoa bug 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Cocoa or Carbon ? - Hello, i now got two small "Hello Worlds" programs up and running, one with cocoa and one with carbon. But now i must decide which framework is the best for my purpose. This is not easy because 1) My application is written with GNU Eiffel....

cocoa and opengl - I'm trying to learn a bit of opengl with a custom opengl class, and here's a strange problem I found. All the tutorials I find use these code to setup and/or resize the opengl view: glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity();....

Starting out on Cocoa programming... - I've just started Cocoa programming and was wondering how to get the data in a text file into an NSTextView. I've got an NSData object filled with file data read by an NSFileManager, but am unsure of how to place it in the NSTextView object. Dale -- ....

cocoa design-question - I have a design-question of cocoa-document-applications. I want every window in a seperate nib-file. The file's owner in the nib-files are then always NSWindowControllers-derived classes. Then I changed MyDocument.h: Instead of - (NSString..

cocoa and window resizing - Hi, I'm trying to learn a bit of cocoa and I'm currently playing a bit with an NSOpenGL subclass, As you may have guessed from the subject I've a problem with window resizing. AFAIK when I resize the window I need to tell my NSOpenGL subclass to ..
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]