Program terminated with signal 11, Segmentation fault.
今天寫程序遇到一個問題:Program terminated with signal 11, Segmentation fault.
gdb 調試現象如下:
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff1b1fc000
Core was generated by `./test'.
Program terminated with signal 11, Segmentation fault.
#0 ?0x0000003b5e6b76d2 in __gnu_cxx::__exchange_and_add(int volatile*, int) () from /usr/lib64/libstdc++.so.6
(gdb) bt
#0 ?0x0000003b5e6b76d2 in __gnu_cxx::__exchange_and_add(int volatile*, int) () from /usr/lib64/libstdc++.so.6
#1 ?0x0000003b5e69dbb9 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() () from /usr/lib64/libstdc++.so.6
#2 ?0x00000000004124ab in testing::TestInfo::~TestInfo() ()
#3 ?0x0000000000412534 in void testing::internal::Delete<testing::TestInfo>(testing::TestInfo*) ()
#4 ?0x000000000042b522 in void (*std::for_each<__gnu_cxx::__normal_iterator<testing::TestInfo* const*, std::vector<testing::TestInfo*, std::allocator<testing::TestInfo*> > >, void (*)(testing::TestInfo*)>(__gnu_cxx::__normal_iterator<testing::TestInfo* const*, std::vector<testing::TestInfo*, std::allocator<testing::TestInfo*> > >, __gnu_cxx::__normal_iterator<testing::TestInfo* const*, std::vector<testing::TestInfo*, std::allocator<testing::TestInfo*> > >, void (*)(testing::TestInfo*)))(testing::TestInfo*) ()
#5 ?0x000000000042b577 in void testing::internal::ForEach<std::vector<testing::TestInfo*, std::allocator<testing::TestInfo*> >, void (*)(testing::TestInfo*)>(std::vector<testing::TestInfo*, std::allocator<testing::TestInfo*> > const&, void (*)(testing::TestInfo*)) ()
#6 ?0x0000000000411fc3 in testing::TestCase::~TestCase() ()
#7 ?0x000000000040e997 in void testing::internal::Delete<testing::TestCase>(testing::TestCase*) ()
#8 ?0x000000000042a486 in void (*std::for_each<__gnu_cxx::__normal_iterator<testing::TestCase* const*, std::vector<testing::TestCase*, std::allocator<testing::TestCase*> > >, void (*)(testing::TestCase*)>(__gnu_cxx::__normal_iterator<testing::TestCase* const*, std::vector<testing::TestCase*, std::allocator<testing::TestCase*> > >, __gnu_cxx::__normal_iterator<testing::TestCase* const*, std::vector<testing::TestCase*, std::allocator<testing::TestCase*> > >, void (*)(testing::TestCase*)))(testing::TestCase*) ()
#9 ?0x000000000042ac49 in void testing::internal::ForEach<std::vector<testing::TestCase*, std::allocator<testing::TestCase*> >, void (*)(testing::TestCase*)>(std::vector<testing::TestCase*, std::allocator<testing::TestCase*> > const&, void (*)(testing::TestCase*)) ()
#10 0x000000000041a26f in testing::internal::UnitTestImpl::~UnitTestImpl() ()
#11 0x0000000000411df6 in testing::UnitTest::~UnitTest() ()
#12 0x0000000000411e66 in __tcf_0 ()
#13 0x000000340fa334f5 in exit () from /lib64/libc.so.6
#14 0x000000340fa1d99b in __libc_start_main () from /lib64/libc.so.6
#15 0x0000000000405699 in _start ()
通過代碼接口開關的方法,定位到程序中
mock_config->parser_name_tag =?"ssp_creative.so";
是這條代碼的問題
改為:
std::string parser_name_tag ="ssp_creative.so";
mock_config->parser_name_tag = parser_name_tag.c_str();
段錯誤問題解決。
先把現象記錄下,具體原因后續分析。
總結
以上是生活随笔為你收集整理的Program terminated with signal 11, Segmentation fault.的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: POSIX文件及目录管理
- 下一篇: pthread_create函数 参数不