Re: crash in __static_initialization_and_destruction on 10.3.9 but not 10.4.4?
Re: crash in __static_initialization_and_destruction on 10.3.9 but not 10.4.4?
- Subject: Re: crash in __static_initialization_and_destruction on 10.3.9 but not 10.4.4?
- From: "John C. Daub" <email@hidden>
- Date: Wed, 01 Feb 2006 09:11:37 -0600
- Thread-topic: crash in __static_initialization_and_destruction on 10.3.9 but not 10.4.4?
on 2/1/06 5:13 AM, Jens Krüger at email@hidden wrote:
> On 1 Feb 2006, at 00:00, Steve Checkoway wrote:
>
>> On Jan 31, 2006, at 12:32 PM, John C. Daub wrote:
>>>
>>> Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/
>>> operand.
>>> 0xa0a35c98 in distantPastInterval ()
>>> (gdb) bt
>>> #0 0xa0a35c98 in distantPastInterval ()
>>> #1 0xc08cc934 in qpthr::QpCond::~QpCond() ()
>>> #2 0xc0822fd4 in __static_initialization_and_destruction_0(int,
>>> int) ()
>>> #3 0xc08230c8 in _GLOBAL__D__ZN5qpthr7QpTimer14TIMERJOB_MAGICE ()
>>> #4 0x8fe17ce4 in __dyld__dyld_mod_term_funcs ()
>>> #5 0x9002ce58 in exit ()
>>> #6 0x92f5decc in -[NSApplication terminate:] ()
>>> #7 0x92f276fc in -[NSApplication sendAction:to:from:] ()
>>> #8 0x92f5cf48 in -[NSMenu performActionForItemAtIndex:] ()
>>> #9 0x92fa17f4 in -[NSCarbonMenuImpl
>>> performActionWithHighlightingForItemAtIndex:] ()
>>> #10 0x92ede89c in _NSHandleCarbonMenuEvent ()
>>> #11 0x92e825fc in _DPSNextEvent ()
>>> #12 0x92e98d2c in -[NSApplication
>>> nextEventMatchingMask:untilDate:inMode:dequeue:] ()
>>> #13 0x92ead0ac in -[NSApplication run] ()
>>> #14 0x92f697bc in NSApplicationMain ()
>>> #15 0x0000dc74 in ?? ()
>>> #16 0x00008fb4 in ?? ()
>>> #17 0x00008e5c in ?? ()
>>
>> Since you're crashing in a static dtor, my guess would be that you
>> have code that depends on the order of destruction. C++ offers no
>> guarantees as to the order that destructors will be called. In
>> particular, the order might have changed between OS releases or the
>> order in which the linker links the files:
>
> There was a change in the order terminators are called in 10.4.
> Before 10.4 global objects were destructed in the same order they
> were constructed (not good). In 10.4 objects are destructed in the
> reverse order they were constructed.
> Not related to this problem, there is also a problem with
> initializers before 10.4. Basically, initializers are run too lazily
> before 10.4.
>
> http://developer.apple.com/releasenotes/DeveloperTools/dyld.html
This is still good information, and may be involved here. Thanx for
mentioning it.
As I'm looking at this this morning (going on Mr. Checkoway's suggestion) I
inserted a bunch of fprint(stderr, ...) and old school Debugger() statements
into the ctor and dtor's of the classes in question (QpMutex and QpCond). My
app launches, I see a bunch of objects created... but then oddly the 3
suspect objects have their destructor called while the app is still
launching. Running under gdb and breaking on Debugger() (only inserted into
the dtors), I see this:
Breakpoint 1, 0x903505fc in Debugger ()
(gdb) bt
#0 0x903505fc in Debugger ()
#1 0xc0819678 in qpthr::QpMutex::~QpMutex() ()
#2 0xc0812230 in __static_initialization_and_destruction_0(int, int) ()
#3 0x8fe17448 in __dyld_call_module_initializers_for_library ()
#4 0x8fe171c0 in __dyld_call_module_initializers ()
#5 0x8fe142a4 in __dyld__dyld_make_delayed_module_initializer_calls ()
#6 0x00009108 in ?? ()
#7 0x00008efc in ?? ()
#8 0x00008e5c in ?? ()
And so, that's why I end up crashing... the objects were deallocated
"prematurely", and so when the app quits and my framework is unloaded, it
goes to deallocate the already deallocated objects and thus the crash. So,
Mr. Checkoway's suggestion is leading me more in the right direction.
Of course I'm still curious why deployment post processing (the stripping of
the binaries) would make any sort of difference in here. Because I turn that
option off, I don't see the "premature" deallocations. Turn it on, and the
deallocations happen.
Continuing my investigation....
--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
"When there is no desire, all things are at peace." -- Tao Te Ching #30
_______________________________________________
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