2013-03-07 1 views
1

정확하게 어떤 메소드를 캡처하려고했는지 또는 적어도 어떤 클래스가 SIGSEGV 신호를받은 후 역 추적으로
메시지를 반환했는지 캡처하려고했습니다. 그것은 충돌 한 메소드가 다른 스레드에서 실행 되었기 때문에 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] 
+1

코어 덤프를 얻을 수 있을까요? 이렇게하면 모든 스레드, 변수 등을 포함하여 전체 프로그램의 상태를 알 수 있습니다. – NPE

+0

공유 할 수있는 최소한의 재생기가 없어도 대부분 디버깅이 힘듭니다. –

+3

백 트레이스는 항상'backtrace'와'backtrace_symbols'가 호출 된 스레드를 가리 킵니다. 그 외에, 당신이 묻고/기대하고있는 것을 정확히 이해하지 못합니다 ... –

답변

1

당신이 전화를 boost::asio::signal_set::async_wait에 의해 호출 핸들러를 사용하는 경우 backtrace_symbols(3)이 작동하지 않습니다. signal_set 클래스는 리눅스에서 signalfd을 사용하고, 다른 플랫폼에서는 pipe-select-interrupt 트릭을 사용할 수 있습니다. 특별히 알고 있지는 않습니다. 따라서 핸들러가 호출 될 때 SEGV를 발생시킨 스레드에서 핸들러를 가져 오지 않습니다.

SEGV 신호가 발생하면 스마트하거나 귀여운 것을 시도하는 것이 일반적으로 권장되지 않습니다. 당신은 reliably continue execution 할 수 없습니다. SEGV 신호를 처리하지 말고 프로세스가 비정상적으로 종료되면 시스템을 코어 덤프로 구성한 다음 코어 덤프를 분석하십시오.

+0

설명해 주셔서 감사 드리며 샘을 진급시켜 주셔서 감사합니다. 어제 @NPE가 진행되면서 코어 덤프 솔루션을 사용해 보았지만 잘 작동합니다. 그리고 내 의견으로는, 프로그램 내에서 SEGV 신호를 잡는 것은 코어 덤프가 제공 할 수없는 장점을 가지고 있습니다. –

관련 문제