Странный Segfault на Ubuntu 15.04

Я нахожусь в классе Comp Sci, и мой учитель использует систему тестирования для оценки наших домашних заданий. Я могу построить свои назначения, но когда я пытаюсь выполнить, я получаю ошибку сегментации. В LLDB я получаю этот след:

* thread #1: tid = 11993, 0x00007ffff796e990 libstdc++.so.6`std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string(), name = 'cpp_refresher', stop reason = invalid address (fault address: 0x10)
* frame #0: 0x00007ffff796e990 libstdc++.so.6`std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
frame #1: 0x000000000042229c cpp_refresher`MemoryAllocation::~MemoryAllocation() + 28
frame #2: 0x0000000000422555 cpp_refresher`void std::_Destroy<MemoryAllocation>(MemoryAllocation*) + 21
frame #3: 0x000000000042251f cpp_refresher`void std::_Destroy_aux<false>::__destroy<MemoryAllocation*>(MemoryAllocation*, MemoryAllocation*) + 47
frame #4: 0x00000000004224dd cpp_refresher`void std::_Destroy<MemoryAllocation*>(MemoryAllocation*, MemoryAllocation*) + 29
frame #5: 0x0000000000422321 cpp_refresher`void std::_Destroy<MemoryAllocation*, MemoryAllocation>(MemoryAllocation*, MemoryAllocation*, std::allocator<MemoryAllocation>&) + 33
frame #6: 0x0000000000421847 cpp_refresher`std::vector<MemoryAllocation, std::allocator<MemoryAllocation> >::~vector() + 55
frame #7: 0x00000000004217a5 cpp_refresher`UTTest::~UTTest() + 37
frame #8: 0x0000000000422f49 cpp_refresher`UTTestRunner::RunSuite(std::string, std::function<void (UTTestRunner*)>) + 249
frame #9: 0x000000000041e716 cpp_refresher`main + 118
frame #10: 0x00007ffff6fe4a40 libc.so.6`__libc_start_main + 240
frame #11: 0x000000000041bc09 cpp_refresher`_start + 41

Исходя из этого, я думаю, что инфраструктура тестирования приводит к тому, что стандартные библиотеки C ++ перестают работать при попытке уничтожить строку. Интересно, что это происходит только в Ubuntu 15.04. Я могу запустить этот скрипт на Ubuntu 14.04, и он отлично работает.

Есть идеи, почему это происходит только в Ubuntu 15.04?

Редактировать:
Вот вывод из valgrind:

==2684== Memcheck, a memory error detector
==2684== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==2684== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==2684== Command: ./cpp_refresher
==2684==
==2684== Invalid read of size 8
==2684==    at 0x5118990: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==2684==    by 0x42229B: MemoryAllocation::~MemoryAllocation() (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x422554: void std::_Destroy<MemoryAllocation>(MemoryAllocation*) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x42251E: void std::_Destroy_aux<false>::__destroy<MemoryAllocation*>(MemoryAllocation*, MemoryAllocation*) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x4224DC: void std::_Destroy<MemoryAllocation*>(MemoryAllocation*, MemoryAllocation*) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x422320: void std::_Destroy<MemoryAllocation*, MemoryAllocation>(MemoryAllocation*, MemoryAllocation*, std::allocator<MemoryAllocation>&) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x421846: std::vector<MemoryAllocation, std::allocator<MemoryAllocation> >::~vector() (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x4217A4: UTTest::~UTTest() (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x422F48: UTTestRunner::RunSuite(std::string, std::function<void (UTTestRunner*)>) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x41E715: main (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==2684==
==2684==
==2684== Process terminating with default action of signal 11 (SIGSEGV)
==2684==  Access not within mapped region at address 0x10
==2684==    at 0x5118990: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20)
==2684==    by 0x42229B: MemoryAllocation::~MemoryAllocation() (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x422554: void std::_Destroy<MemoryAllocation>(MemoryAllocation*) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x42251E: void std::_Destroy_aux<false>::__destroy<MemoryAllocation*>(MemoryAllocation*, MemoryAllocation*) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x4224DC: void std::_Destroy<MemoryAllocation*>(MemoryAllocation*, MemoryAllocation*) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x422320: void std::_Destroy<MemoryAllocation*, MemoryAllocation>(MemoryAllocation*, MemoryAllocation*, std::allocator<MemoryAllocation>&) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x421846: std::vector<MemoryAllocation, std::allocator<MemoryAllocation> >::~vector() (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x4217A4: UTTest::~UTTest() (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x422F48: UTTestRunner::RunSuite(std::string, std::function<void (UTTestRunner*)>) (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==    by 0x41E715: main (in /home/cooper/csci-2270/cpp_refresher/cpp_refresher)
==2684==  If you believe this happened as a result of a stack
==2684==  overflow in your program's main thread (unlikely but
==2684==  possible), you can try to increase the size of the
==2684==  main thread stack using the --main-stacksize= flag.
==2684==  The main thread stack size used in this run was 8388608.
==2684==
==2684== HEAP SUMMARY:
==2684==     in use at exit: 554 bytes in 8 blocks
==2684==   total heap usage: 8 allocs, 0 frees, 554 bytes allocated
==2684==
==2684== LEAK SUMMARY:
==2684==    definitely lost: 0 bytes in 0 blocks
==2684==    indirectly lost: 0 bytes in 0 blocks
==2684==      possibly lost: 66 bytes in 2 blocks
==2684==    still reachable: 488 bytes in 6 blocks
==2684==         suppressed: 0 bytes in 0 blocks
==2684== Rerun with --leak-check=full to see details of leaked memory
==2684==
==2684== For counts of detected and suppressed errors, rerun with: -v
==2684== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1]    2684 segmentation fault (core dumped)  valgrind ./cpp_refresher

0

Решение

Задача ещё не решена.

Другие решения


По вопросам рекламы [email protected]