richpodraza Posted January 25, 2013 Report Share Posted January 25, 2013 I am struggling to resolve a crash in some code I'm working on. I don't want to post the code just yet because I think I would need to post a lot of it in order to provide all the relevant details. Here is a majorly simplified description: - There is a structure that contains some sc_bv fields, as well as a deque< sc_lv<32> > called data. - An instance of this structure is passed by constant reference to a function and is used to fill another buffer of the same size. - After the other buffer is filled, accesses to this structure's other fields in a cout << operation crash. Keep in mind this is a constant reference object and no changes are made to it. The same cout << operation works fine before the other buffer is filled. EDIT: in fact, completely separate objects show the same behavior where accesses to them before work but after crash. It seems like a memory problem. Now I know that is sparse information but based on the stacktrace below, can anyone hazard a guess about what's happening? So far I have verified that all the index values used when accessing both the deque and it's containing sc_lv objects are in-bounds, and I've verified that values within the structure are valid and print out before the buffer fill. Could I have a problem with my libc.so.6? Or another environment issue? A memory problem? Any suggestions on how to better debug this? Thanks! GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-linux-gnu". For bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>... Reading symbols from /home/sc_hmc/sc_hmc...done. [New LWP 8994] warning: Can't read pathname for load map: Input/output error. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Core was generated by `./sc_hmc'. Program terminated with signal 11, Segmentation fault. #0 0x0043b10f in ?? () from /lib/i386-linux-gnu/libc.so.6 (gdb) where #0 0x0043b10f in ?? () from /lib/i386-linux-gnu/libc.so.6 #1 0x0043dddc in malloc () from /lib/i386-linux-gnu/libc.so.6 #2 0x00e78627 in operator new(unsigned int) () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #3 0x00e5d7d4 in std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator<char> const&) () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #4 0x00e5eacf in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned int) () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #5 0x00e5ebfe in std::string::reserve(unsigned int) () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #6 0x00e5f316 in std::string::operator+=(char) () from /usr/lib/i386-linux-gnu/libstdc++.so.6 #7 0x08051ed5 in sc_dt::sc_proxy<sc_dt::sc_bv_base>::to_string (this=0x8b5ebf4) at /home/systemc-2.3.0/include/sysc/datatypes/bit/sc_proxy.h:1325 #8 0x08053efa in sc_dt::sc_proxy<sc_dt::sc_bv_base>::print (this=0x8b5ebf4, os=...) at /home/systemc-2.3.0/include/sysc/datatypes/bit/sc_proxy.h:452 #9 0x080529f3 in sc_dt::operator<< <sc_dt::sc_bv_base> (os=..., a=...) at /home/systemc-2.3.0/include/sysc/datatypes/bit/sc_proxy.h:1524 #10 0x0805f678 in pkg_pkt::cls_req_pkt::build_pkt (this=0x8c19c70, cad=..., credit_return=@0x8b5eaf8: 512, tag0=@0x8b5ed04: 0, seq=@0x8b5ed24: 0) at pkt.svp.cpp:409 #11 0x0813921b in pkg_drv::cls_drv::run_tx (this=0x8b5ea58) at pkg_drv.sv.cpp:205 #12 0x0017becf in sc_core::sc_thread_cor_fn(void*) () from /home/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so #13 0x00163494 in sc_cor_qt_wrapper () from /home/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so #14 0x00183740 in ?? () from /home/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.