Re: Can't send messages to a valid object
Re: Can't send messages to a valid object
- Subject: Re: Can't send messages to a valid object
- From: Charles Jolley <email@hidden>
- Date: Sat, 4 Oct 2003 17:57:34 -0700
Hi Greg:
The isa pointer for the class looks OK. (It points to NSScrollView) I
can also access data in the NSScrollView struct. The problem I'm
having does seem to jump around a bit. Usually the crash is somewhere
inside of objc_msgSend or in a function called by obc_msgSend trying to
access the class's method cache. This leads me to believe that perhaps
the method cache is getting trashed somehow. I suppose this is heap
allocated along with any other objects, so it could be anything
trashing that cache? I'm not sure exactly which instruction it stopped
on; when I get back into the office I will try to find that out.
Thanks to everyone who has replied. I will investigate this further
using the suggestions in NSDebug and report what I find.
Thanks again,
-Charles
On Oct 4, 2003, at 5:14 PM, Greg Parker wrote:
Charles Jolley wrote:
I am encountering a very obscure bug in my code that does not seem to
make any sense. The basic issue is that when I send any message to an
object (in code or via command line in GDB) then I get a
EXC_BAD_ACCESS
signal inside of objc_msgSend. However, I can inspect the object's
memory and all of its ivars are intact and can be accessed directly.
The problem occurs sporadically, which made me think that this would
be
some kind of memory corruption issue. However, I have posed NSObject
to disable all deallocs, so I know the memory is valid. Additionally,
I can inspect the memory and everything looks to be in order.
The bad access may not actually be in the receiver object's memory.
objc_msgSend also accesses other memory, including the receiver's
class and that class's method cache. If that data is trashed, you'll
get a crash or possibly an infinite loop inside objc_msgSend().
Another possibility is that the receiver's isa pointer is trashed.
What does the crash report say? The actual faulting instruction will
indicate which memory the runtime was trying to access (well, to
me, anyway). You might also check whether the receiver's isa looks
valid.
--
Greg Parker email@hidden Java & Objective-C
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.