mardi 28 avril 2015

Understanding the gdb backtrace full report

Can somebody please help me in understanding the issue that caused this segmentation fault. This points to a place where I access an Iter to a map.

The relevant code where it points is:

cout << "Iterate the Map:" << endl;     
    for(Iter=activevalues->begin(); Iter != activevalues->end(); ++Iter)
        {
            Allactivevalues.push_back(Iter->first); [Here on this line]
        }

The gdb log report is:

(gdb) bt full

#0  0x00000000004401ac in Class::Funtion (this=0x1d16ec90) at /Address/to/file/file.cpp:784
    StdVectorVariable = {<std::_Vector_base<int, std::allocator<int> >> = {_M_impl = {<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, 
      _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}

#1  0x0000000000432633 in Class1::Function1 (this=0xdc8035d0, ssMsg=0x2aaaac8acf90 "\003") at /Address/to/file1/file1.cpp:570
    bytSend = 164
    log = {<std::basic_ostream<char, std::char_traits<char> >> = {<std::basic_ios<char, std::char_traits<char> >> = {<std::ios_base> = {_vptr.ios_base = 0x2ae764454b80, static boolalpha = <optimized out>, 
        static dec = <optimized out>, static fixed = <optimized out>, static hex = 858927408, static internal = 0, static left = <optimized out>, static oct = <optimized out>, static right = <optimized out>, 
        static scientific = <optimized out>, static showbase = <optimized out>, static showpoint = <optimized out>, static showpos = <optimized out>, static skipws = <optimized out>, 
        static unitbuf = <optimized out>, static uppercase = <optimized out>, static adjustfield = <optimized out>, static basefield = <optimized out>, static floatfield = <optimized out>, 
        static badbit = <optimized out>, static eofbit = <optimized out>, static failbit = <optimized out>, static goodbit = <optimized out>, static app = <optimized out>, static ate = <optimized out>, 
        static binary = <optimized out>, static in = <optimized out>, static out = <optimized out>, static trunc = 1141968882, static beg = <optimized out>, static cur = <optimized out>, 
        static end = <optimized out>, _M_precision = 6, _M_width = 0, _M_flags = 4098, _M_exception = std::_S_goodbit, _M_streambuf_state = std::_S_goodbit, _M_callbacks = 0x0, _M_word_zero = {_M_pword = 0x0, 
          _M_iword = 0}, _M_local_word = {{_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {
            _M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}, {_M_pword = 0x0, _M_iword = 0}}, _M_word_size = 8, _M_word = 0x2aaaac8ace58, _M_ios_locale = {static none = -1, 
          static ctype = <optimized out>, static numeric = <optimized out>, static collate = <optimized out>, static time = 149717832, static monetary = <optimized out>, static messages = <optimized out>, 
          static all = <optimized out>, _M_impl = 0x2ae76446ab80, static _S_classic = <optimized out>, static _S_global = <optimized out>, static _S_categories = <optimized out>, static _S_once = <optimized out>}}, 
      _M_tie = 0x0, _M_fill = 32 ' ', _M_fill_init = true, _M_streambuf = 0x2aaaac8acd28, _M_ctype = 0x2ae76446ae00, _M_num_put = 0x2ae76446b120, _M_num_get = 0x2ae76446b110}, _vptr.basic_ostream = 0x2ae764454b58}, 
  _M_filebuf = {<std::basic_streambuf<char, std::char_traits<char> >> = {_vptr.basic_streambuf = 0x2ae764454970, 
      _M_in_beg = 0x2aaab00009a0 "Output:Id:31,PID:37,InId:65928,bysll:2,EhId:1100000005231634\n", 
      _M_in_cur = 0x2aaab00009a0 "Output:Id:31,PID:37,InId:65928,bysll:2,EhId:1100000005231634\n", 
      _M_in_end = 0x2aaab00009a0 "Output:Id:31,PID:37,InId:65928,bysll:2,EhId:1100000005231634\n", 
      _M_out_beg = 0x2aaab00009a0 "Output:Id:31,PID:37,InId:65928,bysll:2,EhId:1100000005231634\n", 
      _M_out_cur = 0x2aaab00009a0 "Output:Id:31,PID:37,InId:65928,bysll:2,EhId:1100000005231634\n", _M_out_end = 0x2aaab000299f "", _M_buf_locale = {static none = -1, 
        static ctype = <optimized out>, static numeric = <optimized out>, static collate = <optimized out>, static time = 149717832, static monetary = <optimized out>, static messages = <optimized out>, 
        static all = <optimized out>, _M_impl = 0x2ae76446ab80, static _S_classic = <optimized out>, static _S_global = <optimized out>, static _S_categories = <optimized out>, static _S_once = <optimized out>}}, 
    _M_lock = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\0' <repeats 39 times>, __align = 0}, _M_file = {
      _M_cfile = 0x2aaab0003d00, _M_cfile_created = true}, _M_mode = 17, _M_state_beg = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}, _M_state_cur = {__count = 0, __value = {__wch = 0, 
        __wchb = "\000\000\000"}}, _M_state_last = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}, 
    _M_buf = 0x2aaab00009a0 "Output:Id:31,PID:37,InId:65928,bysll:2,EhId:1100000005231634\n", _M_buf_size = 8192, _M_buf_allocated = true, _M_reading = false, _M_writing = true, _M_pback = 0 '\0', 
    _M_pback_cur_save = 0x0, _M_pback_end_save = 0x0, _M_pback_init = false, _M_codecvt = 0x2ae76446b040, _M_ext_buf = 0x0, _M_ext_buf_size = 0, _M_ext_next = 0x0, _M_ext_end = 0x0}}

#2  0x000000000042a7b2 in Class2::ThreadFunction2 (this=0xdc802520) at /Address/to/Nfile/Nfile.cpp:280
    Msg = (unsigned char *) 0x2aaaac8acf90 "\003"
    one_queue_buffer = {msg = "\003\000\002\000\037\000\000\000\000\000\000\000\037\000\000\000\"\000\000\000%\000\000\000\210\001\001\000\000\000\002\000C�\f\000\031", '\0' <repeats 12 times>}
    stomType = (short unsigned int *) 0x2aaaac8acf90
    Id1 = (short unsigned int *) 0x2aaaac8acf92
    Id = (unsigned int *) 0x2aaaac8acf94

#3  0x000000000042d139 in Class::run1 (this=0xdc802520) at /Address/to/Nfile/Nfile.hpp:152
No locals.

#4  0x00000000004295c3 in boost::_mfi::mf0<void, ThreadBase>::operator() (this=0xdc80a408, t=@0xdc802520) at /home/dev4/boost_1_54_0/boost/bind/mem_fn_template.hpp:70
No locals.

#5  0x00000000004294d4 in boost::_bi::list1<boost::reference_wrapper<ThreadBase> >::operator()<boost::_mfi::mf0<void, ThreadBase>, boost::_bi::list0> (this=0xdc80a418, f=@0xdc80a408, a=@0x2aaaac8ad0be)
    at /home/dev4/boost_1_54_0/boost/bind/bind.hpp:253
No locals.

#6  0x000000000042937b in boost::_bi::bind_t<void, boost::_mfi::mf0<void, ThreadBase>, boost::_bi::list1<boost::reference_wrapper<ThreadBase> > >::operator() (this=0xdc80a408)
    at /home/dev4/boost_1_54_0/boost/bind/bind_template.hpp:20
    a = {<No data fields>}

#7  0x000000000042924a in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ThreadBase>, boost::_bi::list1<boost::reference_wrapper<ThreadBase> > > >::run (this=0xdc80a250)
    at /home/dev4/boost_1_54_0/boost/thread/detail/thread.hpp:117
No locals.

#8  0x00002ae763b4e0d2 in thread_proxy () from /home/dev4/boost_1_54_0/stage/lib/libboost_thread.so.1.54.0
No symbol table info available.

#9  0x0000003b970064a7 in start_thread () from /lib64/libpthread.so.0
No symbol table info available.

#10 0x0000003b964d3c2d in clone () from /lib64/libc.so.6

My program is multi-threaded program; Can the issue be that some other thread is accessing the same Iter->first at the same time while its been accessed by the pointed code. Can it be clearly understood from the gdb log ?

Aucun commentaire:

Enregistrer un commentaire