Tips for debugging EXC_BAD_ACCESS

Michel Fortin michel.fortin at michelf.ca
Thu Oct 11 11:19:57 PDT 2012


On 2012-10-11 06:52:24 +0000, Jacob Carlborg <doob at me.com> said:

> I didn't have any luck with this in the learn newsgroup so I'm trying here.
> 
> I'm trying to debug the Mac OS X port of DWT. Almost as soon as a DWT 
> application starts to process events I receive a segmentation fault. 
> The error happens in the "objc_msgSend" C function when calling an 
> Objective-C method.

Most likely, the object objc_msgSend is called on has been deallocated, 
which would mean that windowSendEvent is called with a deallocated 
NSWindow object as its first argument.

I don't know how DWT works, but I'd say there's something amiss with 
how DWT is retaining its NSWindow.

Since you're on OS X, I'd suggest you try using Instruments to track 
the reference counters of all Objective-C objects within your program 
until it crashes, then search back the history for all 
retain/release/autorelease calls made to the address the 
EXEC_BAD_ACCESS happens on.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list