Re: Is it me or XCode 1.2?
Re: Is it me or XCode 1.2?
- Subject: Re: Is it me or XCode 1.2?
- From: Brent Gulanowski <email@hidden>
- Date: Fri, 30 Apr 2004 09:03:28 -0400
Sorry to respond so late. Did you resolve your problem?
I think you have a heisenbug, although if I understand them right, they
usually work the other way -- crash normally and work in debugger.
Anyway, sometimes the memory you are incorrectly pointing to is in a
safe area, other times it is not, and using the debugger affects this.
I have seen this kind of problem before in my own code, but I'm having
a mental block on what it was. Usually it's an auto-release problem,
but not where you're expecting it. Specifically, an object that seems
fine in one method is used as an argument and becomes invalid by the
time it gets to the called method. Then again, you weren't specific as
to whether the "node" pointer is found invalid on the first call to
-setXNode or a recursive call. If it's the latter, it might be that
there's an incorrect calculation of the number of child nodes.
(As for the subject question, the change in XCode version is unrelated
to the behaviour of gcc and gdb, although I didn't check if their
versions changed.)
On Apr 25, 2004, at 12:26 AM, Phil Curry wrote:
> No... I don't think so as 'tNode' has a valid set of values at the
> line below marked by '<<<<<<'.
> Again, if I run the code it runs, if I try to step thru it with the
> debugger, I get the error.
>
> On Apr 24, 2004, at 7:41 PM, Brent Gulanowski wrote:
>
>>
>> It would appear that your tree is returning an uninitialized pointer
>> value. Is that possible?
>>
>>
>> On Apr 24, 2004, at 12:57 AM, Phil Curry wrote:
>>
>>> I could have sworn this code worked before moving to Xcode 1.2
>>> But now, if I build/run it runs without error. If I build/debug, the
>>> identifier 'node' in the line:
>>> if ( [node numChildren] > 0) {
>>> shows node has a value of 0x7 and I get a bad EXC_BAD_ACCESS if I
>>> try to step through that line.
>>>
>>> Why would it execute but not be valid if I step through with the
>>> debugger?
>>>
>>> Thanks.
>>> -Phil
>>> ===========================================
>>> - (void)drawRect:(NSRect)canvas
>>> {
>>> // locals
>>> int i;
>>> Node* tNode;
>>>
>>> // body
>>> [self describeGrid];
>>> [self drawBackground];
>>> [self resetRightMostNode];
>>> for ( i = 1; i >= 0; i-- ) {
>>> tNode = [tree objectAtIndex:i]; // <<<<<< tNode valid here
>>> [self setXForNode:tNode];
>>> }
>>> <snip>
>>> } // drawRect
>>
>>>
>>> - (void)setXForNode:(Node*)node
>>> {
>>> // locals
>>> int i;
>>> NSNumber* num;
>>>
>>> // body
>>> if ( [node numChildren] > 0) { // <<<<<< node invalid here
>>> for ( i = 0; i < [node numChildren]; i++ ) {
>>> [self setXForNode: [[node children] objectAtIndex:i]];
>>> } // for
>>>
>>> [node setXPosition: [[[node children] objectAtIndex:0]
>>> position].x];
>>> } // if
>>> <snip>
>>> } // setX
>>> _______________________________________________
>>> xcode-users mailing list | email@hidden
>>> Help/Unsubscribe/Archives:
>>> http://www.lists.apple.com/mailman/listinfo/xcode-users
>>> Do not post admin requests to the list. They will be ignored.
>>>
>>>
>> --
>> Brent Gulanowski email@hidden
> _______________________________________________
> xcode-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/xcode-users
> Do not post admin requests to the list. They will be ignored.
>
>
--
Brent Gulanowski email@hidden
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.