У меня есть набор тестов CppUnit, который я выполняю и в конце выполнения сегменты приложения.
Я уже некоторое время пытаюсь понять этот дамп памяти, и я не могу понять, что может быть не так, хотя, если я вставлю его сюда, возможно, кто-то столкнется с такой проблемой и укажет мне правильное направление.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000100ad8e in CppUnit::XmlOutputter::XmlOutputter (this=0x7fffc180bc00, result=<optimized out>, stream=<optimized out>, encoding=...) at XmlOutputter.cpp:21
21 XmlOutputter.cpp: No such file or directory.
in XmlOutputter.cpp
(gdb) where
#0 0x000000000100ad8e in CppUnit::XmlOutputter::XmlOutputter (this=0x7fffc180bc00, result=<optimized out>, stream=<optimized out>, encoding=...) at XmlOutputter.cpp:21
#1 0x00000000016e7d18 in ?? ()
#2 0x0000000001426498 in std::string::_Rep::_S_empty_rep_storage ()
#3 0x000000000101488a in ?? ()
#4 0x00000000016d1de8 in ?? ()
#5 0x00000000016e79e0 in ?? ()
#6 0x00000000016e79f0 in ?? ()
#7 0x00000000016e79e8 in ?? ()
#8 0x00007f93740040e0 in ?? ()
#9 0x00007f9374001310 in ?? ()
#10 0x0000000000000004 in ?? ()
#11 0x00007fffc180bcf8 in ?? ()
#12 0x00007f93740040e0 in ?? ()
#13 0x00000000016e79e0 in ?? ()
#14 0x000000000100b1a2 in CppUnit::XmlOutputter::addSuccessfulTest (this=<optimized out>, test=0x7f9374004de0, testNumber=32767, testsNode=0x7f9374001610) at XmlOutputter.cpp:195
#15 0x00007f937c47bd85 in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) () from /usr/lib64/libstdc++.so.6
#16 0x000000000100a887 in CppUnit::TextTestRunner::~TextTestRunner (this=<optimized out>, __in_chrg=<optimized out>) at TextTestRunner.cpp:36
#17 0x000000000100a4ca in __exchange_and_add_single (__val=<optimized out>, __mem=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/ext/atomicity.h:70
#18 __exchange_and_add_dispatch (__val=<optimized out>, __mem=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/ext/atomicity.h:86
#19 _M_dispose (__a=<optimized out>, this=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/basic_string.h:234
#20 ~basic_string (this=<optimized out>, __in_chrg=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/basic_string.h:494
#21 _Destroy<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > (__pointer=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/stl_construct.h:88
#22 _Destroy<std::basic_string<char, std::char_traits<char>, std::allocator<char> >*> (__last=<optimized out>, __first=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/stl_construct.h:103
#23 _Destroy<std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > (__last=<optimized out>, __first=0x0)
at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/stl_construct.h:128
#24 _M_destroy_data_aux (__last=<optimized out>, __first=<optimized out>, this=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/deque.tcc:709
#25 _M_destroy_data (__last=<optimized out>, __first=<optimized out>, this=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/stl_deque.h:1604
#26 ~deque (this=<optimized out>, __in_chrg=<optimized out>) at /proj/ims_lu/repository/LOTC/R1A07-0/usr/include/c++/4.3/bits/stl_deque.h:776
#27 ~Message (this=<optimized out>, __in_chrg=<optimized out>) at ../../include/cppunit/Message.h:39
#28 CppUnit::TextOutputter::printFailureDetail (this=0x407a80, thrownException=0x7fffc180d1b0) at TextOutputter.cpp:101
#29 0x00007f937c3e7b38 in ?? () from /usr/lib64/libstdc++.so.6
#30 0x00007fffc180bf50 in ?? ()
#31 0x00007fffc180c0b0 in ?? ()
#32 0x00007fffc180c0c8 in ?? ()
#33 0x00007f937d84f58b in _dl_map_object_deps () from /lib64/ld-linux-x86-64.so.2
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Просто предположение, но попробуйте использовать общий TestRunner с XmlOutputter, а не TextTestRunner
CPPUNIT_NS::TextUi::TestRunner runner;
std::ofstream outputFile("testOutput.xml" );
CPPUNIT_NS::XmlOutputter xmlOutputter( &runner.result(), outputFile );
runner.addTest( testSuite );
runner.setOutputter( &xmlOutputter );
runner.run();
Других решений пока нет …