2 Replies Latest reply on Aug 22, 2007 3:44 PM by 807575

    core dump at std::basic_string


      I am working on one of the product here and my program core dumps at std::basic_string class. It dumps at diffrent place in program every time i run. My application is multi threaded program. here is the core image.

      t@1851 (l@15) terminated by signal SEGV (no mapping at the fault address)
      Current function is std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string (optimized)
      957 }
      (/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) w here
      current thread: t@1851
      =>[1] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string(this = ???, s = CLASS) (optimized), at 0xabfdc (line ~957) in "string"
      [2] FilterPath::getData(this = ???, data = CLASS) (optimized), at 0xaac20 (line ~277) in "AttributeFilter.cpp"

      My C++ compiler detail is
      Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-11 2002/10/31

      Any Help Please.

        • 1. Re: core dump at std::basic_string

          Without seeing any code, it's difficult to tell.

          Also, can you try a newer compiler (Studio 12)? If so, does the problem persist?
          • 2. Re: core dump at std::basic_string
            You are using a really old compiler, now End of Life, at an old patch level.
            This old compiler version can run into problems with the std::string class in multi-threaded programs. You can possibly fix the problems as follows:

            1. Get ALL of the latest patches for WS6U2 here
            including the Solaris patches for the C++ runtime libraries.

            2. Make sure the WS6U2 installation has been adjusted to link libCstd.so.1 dynamically, instead of the default static linking. The instructions are in the C++ User Guide for WS6U2.

            3. Clear out all template caches (delete all SunWS_cache directories) and recompile ALL of your code.

            If that solves the problem, you will need to update the C++ runtime libraries on all computers that run the program (not just the computer where the program is built).

            But it would be better to update to the current release, Sun Studio 12, which is free. Studio 12 requires Solaris 9 or 10. If you are on Solaris 8, get Studio 11, which is also free..

            Of course, it is likely that the problem is in your program, and not in the C++ compiler or libraries. A crash in the string class might be due to a problem with a string, but it also might be due to general memory corruption. You often find the program fault at a place far removed in space and time from the actual error.

            Source of corruption in a single-threaded program include
            - reading or writing beyond the bounds of an object
            - using an object after it has been deleted or gone out of scope
            - deleting an object more than once
            - using an uninitialized variable

            In a multi-threaded program, you can also get memory corruption when an object shared among threads is not properly guarded.

            The effects of these errors can appear random, making them hard to find, and even harder to find in a multi-threaded program.

            With any version of WorkShop or Sun Studio, you can find many of these problems by running under the debugger with all checks turned on:
            % dbx myprog
            (dbx) check -all

            Sun Studio 12 includes a Thread Analyzer that can find data races in multi-threaded programs.