#159 [CppUnit 1.10.2] Segfault on CPPUNIT_ASSERT(true)

1.10.2
open
5
2006-03-10
2006-03-06
zaufi
No

If CppUnit tests compiled with -D_GNUCXX_DEBUG option
(which is turns on libstdc++ containers debug code for
GCC >= 3) even simple assert will segfault with
following backtrace:
--
#0 0xb7c6073b in
__gnu_debug::_Safe_iterator_base::_M_detach () from
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/libstdc++.so.6
(gdb) bt
#0 0xb7c6073b in
__gnu_debug::_Safe_iterator_base::_M_detach () from
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/libstdc++.so.6
#1 0xb7c607d9 in
__gnu_debug::_Safe_iterator_base::_M_attach () from
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/libstdc++.so.6
#2 0xb7c6089c in
__gnu_debug::_Safe_sequence_base::_M_detach_all () from
/usr/lib/gcc/i686-pc-linux-gnu/3.4.5/libstdc++.so.6
#3 0x080594e7 in ~_Safe_sequence_base
(this=0xbff678ac) at safe_base.h:170
#4 0x0805a62d in ~_Safe_sequence (this=0xbff678ac) at
deque:85
#5 0x0805a5e9 in ~deque (this=0xbff67884) at deque:85
#6 0x08058be1 in ~Message (this=0xbff67880) at
xml_node-tester.cc:44
#7 0x08053244 in xml_node_tester::compile_test
(this=0x806bbe8) at xml_node-tester.cc:44
#8 0x08062eb0 in
CppUnit::TestCaller<xml_node_tester>::runTest
(this=0x806bbf8) at TestCaller.h:166
#9 0xb7ee4be7 in
CppUnit::TestCaseMethodFunctor::operator() () from
/usr/lib/libcppunit-1.10.so.2
#10 0xb7ed5508 in CppUnit::DefaultProtector::protect ()
from /usr/lib/libcppunit-1.10.so.2
#11 0xb7ee08d5 in
CppUnit::ProtectorChain::ProtectFunctor::operator() ()
from /usr/lib/libcppunit-1.10.so.2
#12 0xb7ee04aa in CppUnit::ProtectorChain::protect ()
from /usr/lib/libcppunit-1.10.so.2
#13 0xb7ef2af4 in CppUnit::TestResult::protect () from
/usr/lib/libcppunit-1.10.so.2
#14 0xb7ee48cc in CppUnit::TestCase::run () from
/usr/lib/libcppunit-1.10.so.2
#15 0xb7ee5144 in
CppUnit::TestComposite::doRunChildTests () from
/usr/lib/libcppunit-1.10.so.2
#16 0xb7ee507a in CppUnit::TestComposite::run () from
/usr/lib/libcppunit-1.10.so.2
#17 0xb7ee5144 in
CppUnit::TestComposite::doRunChildTests () from
/usr/lib/libcppunit-1.10.so.2
#18 0xb7ee507a in CppUnit::TestComposite::run () from
/usr/lib/libcppunit-1.10.so.2
#19 0xb7ef657c in
CppUnit::TestRunner::WrappingSuite::run () from
/usr/lib/libcppunit-1.10.so.2
#20 0xb7ef2a36 in CppUnit::TestResult::runTest () from
/usr/lib/libcppunit-1.10.so.2
#21 0xb7ef66f3 in CppUnit::TestRunner::run () from
/usr/lib/libcppunit-1.10.so.2
#22 0xb7efa2c0 in CppUnit::TextTestRunner::run () from
/usr/lib/libcppunit-1.10.so.2
#23 0x08052bbf in main (argc=1, argv=0xbff67fe4) at
classes-tests.cc:66
---
xml_node-tester.cc:44 contain just
'CPPUNIT_ASSERT(true)' (actually as u may c it doesn't
matter what it contain... segfault occured in
destructor of Message object)

Discussion

    • labels: --> Unix-Compilation
    • milestone: --> 1.10.2
    • status: open --> pending
     
  • Logged In: YES
    user_id=196852

    My guess is that just like on windows, when using the debug
    version of the CRT, all your libraries must use the same
    version.

    CppUnit also use STL and you should also compile it with the
    debug version of gcc STL: memory represents of data
    structure is different between STL version.

    Could you try this and let us know what is required to
    achieve this ? This is worth a note in the documentation.

    Baptiste.

     
    • assigned_to: nobody --> blep
     
  • zaufi
    zaufi
    2006-03-10

    Logged In: YES
    user_id=806285

    sure! I was trying to compile CppUnit with -D_GNUCXX_DEBUG
    define... segfault still there... :(
    to reproduce this (as I mention) it is enough to call
    CPPUNIT_ASSERT and compile with given -D option to turn
    GNU STL debug code on...

     
  • zaufi
    zaufi
    2006-03-10

    • status: pending --> open
     
  • hixxxxx
    hixxxxx
    2006-07-06

    Logged In: YES
    user_id=1041846

    Hi,

    I have a very similar problem with a very basic testsuite on
    a new cygwin system. cppunit 1.10.2.

    I get:
    . 1003 [main] HelloCppUnit 2868
    _cygtls::handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
    4568 [main] HelloCppUnit 2868 open_stackdumpfile: Dumping
    stack trace to HelloCppUnit.exe.stackdump

    I've already tried several debug options for gcc (3.4.4)

    How can I help?