簡體   English   中英

來自backtrace的堆棧跟蹤未顯示在多線程環境下導致崩潰的方法

[英]Stack trace from backtrace didn't show method that caused the crash under multithreaded enviroment

我試圖捕獲確切的方法,或者至少是哪個類使我的代碼崩潰
收到SIGSEGV信號后,由backtrace返回的消息。 是因為崩潰的方法正在另一個線程上執行,因此backtrace無法做到這一點(請參閱我的日志的第一行-進程ID為7fdae0268700,我在那里添加了代碼以使我的應用程序崩潰)? 對這個問題有什么建議嗎?

    2013-03-07 17:43:42.863709502 [7fdae0268700] DEBUG data_service - I Crash You! Location
    2013-03-07 17:43:42.863804548 [7fdae7d1c720] INFO  service_runner - Receive signal 11
    2013-03-07 17:43:42.870357301 [7fdae7d1c720] DEBUG service_runner - [bt]: (0) ../Debug/MyAppService : my_app_service_lib::service_runner::handle_crash_stop(boost::system::error_code const&, int)+0x7e [0xcccf54]
    2013-03-07 17:43:42.870369392 [7fdae7d1c720] DEBUG service_runner - [bt]: (1) ../Debug/MyAppService : boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>::operator()(my_app_service_lib::service_runner*, boost::system::error_code const&, int) const+0x74 [0xcd8278]
    2013-03-07 17:43:42.870384611 [7fdae7d1c720] DEBUG service_runner - [bt]: (2) ../Debug/MyAppService : void boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> >::operator()<boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list2<boost::system::error_code const&, int const&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>&, boost::_bi::list2<boost::system::error_code const&, int const&>&, int)+0x7c [0xcd80c6]
    2013-03-07 17:43:42.870395158 [7fdae7d1c720] DEBUG service_runner - [bt]: (3) ../Debug/MyAppService : void boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >::operator()<boost::system::error_code, int>(boost::system::error_code const&, int const&)+0x4c [0xcd7f0e]
    2013-03-07 17:43:42.870405480 [7fdae7d1c720] DEBUG service_runner - [bt]: (4) ../Debug/MyAppService : boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>::operator()()+0x2b [0xcd7e15]
    2013-03-07 17:43:42.870419010 [7fdae7d1c720] DEBUG service_runner - [bt]: (5) ../Debug/MyAppService : void boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int> >(boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>, ...)+0x62 [0xcd7d2e]
    2013-03-07 17:43:42.870436180 [7fdae7d1c720] DEBUG service_runner - [bt]: (6) ../Debug/MyAppService : void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > > >(boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>&, boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >&)+0x64 [0xcd7bea]
    2013-03-07 17:43:42.870447863 [7fdae7d1c720] DEBUG service_runner - [bt]: (7) ../Debug/MyAppService : boost::asio::detail::signal_handler<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)+0xb9 [0xcd78db]
    2013-03-07 17:43:42.870454915 [7fdae7d1c720] DEBUG service_runner - [bt]: (8) ../Debug/MyAppService : boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long)+0x32 [0xcce3ba]
    2013-03-07 17:43:42.870462704 [7fdae7d1c720] DEBUG service_runner - [bt]: (9) ../Debug/MyAppService : boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service::thread_info&, boost::system::error_code const&)+0x1a1 [0xcd09b3]
    2013-03-07 17:43:42.870469226 [7fdae7d1c720] DEBUG service_runner - [bt]: (10) ../Debug/MyAppService : boost::asio::detail::task_io_service::run(boost::system::error_code&)+0x137 [0xcd050b]
    2013-03-07 17:43:42.870474974 [7fdae7d1c720] DEBUG service_runner - [bt]: (11) ../Debug/MyAppService : boost::asio::io_service::run()+0x2f [0xcd0d31]
    2013-03-07 17:43:42.870480654 [7fdae7d1c720] DEBUG service_runner - [bt]: (12) ../Debug/MyAppService : my_app_service_lib::service_runner::run()+0x97 [0xcccda9]
    2013-03-07 17:43:42.870486438 [7fdae7d1c720] DEBUG service_runner - [bt]: (13) ../Debug/MyAppService : main+0x4cc [0xcc5838]
    2013-03-07 17:43:42.870491274 [7fdae7d1c720] DEBUG service_runner - [bt]: (14) /lib64/libc.so.6 : __libc_start_main+0xfd [0x3f0f01ecdd]
    2013-03-07 17:43:42.870495884 [7fdae7d1c720] DEBUG service_runner - [bt]: (15) ../Debug/MyAppService() [0xcc5289]

如果您使用的是由boost::asio::signal_set::async_wait調用的處理程序來調用backtrace_symbols(3)此方法將無效。 signal_set類在Linux上使用signalfd ,其他平台可能會使用管道選擇中斷技巧,我不知道具體如何。 因此,當您的處理程序被調用時,它不會來自引起SEGV的線程。

通常不建議在遇到SEGV信號時嘗試做任何聰明/可愛的事情。 您不能可靠地繼續執行 我建議不要處理SEGV信號,而SEGV系統配置為在進程異常終止時進行核心轉儲,然后分析核心轉儲。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM