Re: Build for 10.3 crashes on 10.4
Re: Build for 10.3 crashes on 10.4
- Subject: Re: Build for 10.3 crashes on 10.4
- From: Rippit the Ogg Frog <email@hidden>
- Date: Thu, 16 Nov 2006 05:57:36 -0800
Rippit the Ogg Frog wrote:
My 10.4 app works great whether I run the i386 code on my MacBook Pro or
run the PowerPC code under Rosetta, but the build for 10.3, when run
under Rosetta on 10.4.8 or 10.4.5, gets a 100% repeatible memory
corruption.
I'm now debugging the 10.3 build under GDB using the instructions on
this page:
http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/index.html?http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_exec_a/chapter_7_section_2.html
What happens is that I set a pointer in an object to NULL, but another
pointer in another object gets set. But what is really weird is that
each time I step into the problem function, GDB says this:
Cannot access memory at address 0x1
One time after getting the above message, I also got a bunch of messages
about bad packets, and invalid hex codes.
I seem to have found the source of my memory corruption. The pointer
that is supposed to get set to NULL, and the pointer that gets stomped,
have the same address, even though they are members of different objects!
The two objects are both members of another object, and are allocated
next to each other. It's as if g++ is calculating their sizes wrong.
Maybe I have a workaround... yes, placing another member between them,
of four bytes in size, makes the bug go away!
It happens that the source code for the two objects are built by two
different XCode projects - one is in a library. Printing sizeof() the
troublesome object reveals that the two projects have different ideas of
its size, likely because there is some conditionally-compiled debugging
code that adds an extra member.
So I put a #error right before the extra member, that's in the library,
then compile that header from my application, and it's not hit!
Here is my problem: my application is built on the ZooLib cross-platform
application framework (http://www.zoolib.org/). It has a header file
called zconfig.h, where one can enable debugging options. The one that
comes by default with the library disables debugging, but the one I was
TRYING to use EVERYWHERE enables it.
Somehow one of my projects got one copy of zconfig.h, and the other
project got a different copy.
As to why my 10.4 builds worked and 10.3 didn't...
The order of the paths given in the User Header Search Path is
different. The compiler must search the paths in the order given. In
my 10.4 target, the directory with the correct header came first. In my
10.3 target, ZooLib's directory came first.
Damnation!
I just spent three days, with tonight being an all-nighter, to find out
I screwed up my header files. (It's 6 AM as I write this, and I have to
work in the morning.)
Usually I delete ZooLib's default zconfig.h when I update from CVS, but
I guess I forgot this time.
Well, thanks for your help.
Rippit the Ogg Frog
email@hidden
http://www.oggfrog.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden