码迷,mamicode.com
首页 > 其他好文 > 详细

Program terminated with signal 11, Segmentation fault.

时间:2015-06-16 16:52:51      阅读:332      评论:0      收藏:0      [点我收藏+]

标签:段错误

今天写程序遇到一个问题: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.

标签:段错误

原文地址:http://blog.csdn.net/ai2000ai/article/details/46519169

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!