descructor of locale causes coredump at exit

Help
yu lei
2009-12-16
2013-05-13
  • yu lei
    yu lei
    2009-12-16

    the version of stlport I am using is kind of old, it's stlport4. the compiler I used is CC. platform is solaris.
    everytime when my application exits, I got a coredump which happened in ~locale() method, it looks as below.

    (dbx) where
    current thread: t@1
    => std::locale::~locale(0xfeeebab8, 0x1084, 0x1000, 0xfeee28d4, 0x992bc, 0x0), at 0xff27ea04
       _exithandle(0xfdbedb80, 0xfe101740, 0xfdbecbc0, 0xfeb46e64, 0xfe111100, 0xfe111140), at 0xfdb408dc
       exit(0x0, 0xffbff494, 0xffbff49c, 0x3be800, 0xfe111080, 0xfe1110c0), at 0xfdb2f200

    this coredump can be avoid when I remove a code as below.

    singleton& s = singleton::Instance();

    above code is called in a constructor of a static class member variable as below.
    Environment::EnvImpl Enviroment::base;

    I can't think of why having "singleton& s = singleton::Instance();" will cause a coredump at exit. is it because this line of code cause some problem on the order of descruction? anyone else has runinto this kind of problem?
    thanks in advance.

     
  • Looks like bad support of C++ in Solaris libs: incorrect order of dtors calls for static object (when I work with Solaris this problem was available). But may be this problem come from you code, possible depends upon the order of unload of shared libs (libstlport unload before lib/app with s).

     
  • BTW, if 'incorrect order of dtors' happens, see commits with words like '__cxa_finalize' and '__cxa_atexit' in git repository.