Skip to content

Instantly share code, notes, and snippets.

@jrwren
Created February 23, 2012 21:34
Show Gist options
  • Select an option

  • Save jrwren/1895183 to your computer and use it in GitHub Desktop.

Select an option

Save jrwren/1895183 to your computer and use it in GitHub Desktop.
c++ on ios global initializer crash wtf?
I get this only when running on device, not simulator:
#0 0x0000ecd4 in aiVector3D::aiVector3D (this=0x3dbb9e, _x=0, _y=1, _z=0) at aiVector3D.h:64
#1 0x0000e8d8 in aiVector3D::aiVector3D (this=0x3dbb9e, _x=5.66926963e-39, _y=0, _z=1) at aiVector3D.h:64
#2 0x0019bb22 in __cxx_global_var_init1 ()
#3 0x0019bbc4 in global constructors keyed to a ()
#4 0x2fe0ced2 in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
#5 0x2fe0cbd8 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
#6 0x2fe0a7d4 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#7 0x2fe0b794 in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE ()
#8 0x2fe02a20 in __dyld__ZN4dyld24initializeMainExecutableEv ()
#9 0x2fe06b84 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#10 0x2fe012ce in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_ ()
#11 0x2fe01060 in __dyld__dyld_start ()
so, where can I find this global, and why is it causing segfault err EXC_BAD_ACCESS? its constructor is dead simple:
struct aiVector3D
{
#ifdef __cplusplus
aiVector3D () : x(0.0f), y(0.0f), z(0.0f) {}
aiVector3D (float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} // <--- THIS ONE HERE!
...
#endif // __cplusplus
float x, y, z;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment