This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: No useful backtrace after uncaught exception in std::thread


On Tuesday 15 of November 2011 21:14:14 Jonathan Wakely wrote:
> 2011/11/15 Tobias Ringström:
> >
> > That's more like it. Is the std::thread behaviour a bug, or am I missing
> > something? Though the C++11 standard seems to allow the stack to be unwound
> > before std::terminate is called, it exceptionally unhelpful. I've search but
> > not been able to find any explanation.
> 
> No, it's not a bug, but it could be improved.

i think it's a gcc/debuginfo bug because at __cxa_throw there's no foo() in backtrace:

Breakpoint 3, 0x00007ffff7b8f960 in __cxa_throw () from /usr/lib64/libstdc++.so.6
(gdb) bt
#0  0x00007ffff7b8f960 in __cxa_throw () from /usr/lib64/libstdc++.so.6
#1  0x00007ffff7b3d87e in std::__throw_system_error(int) () from /usr/lib64/libstdc++.so.6
#2  0x00007ffff7b479f7 in std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) () from /usr/lib64/libstdc++.so.6
#3  0x0000000000401344 in std::thread::thread<void (&)()> (this=0x7fffffffdec0, __f=@0x400fb4) at /usr/include/c++/4.6.2/thread:135
#4  0x0000000000401076 in main () at t.cpp:9

gdb workaround:

(gdb) frame 3
#3  0x0000000000401344 in std::thread::thread<void (&)()> (this=0x7fffffffdec0, __f=@0x400fb4) at /usr/include/c++/4.6.2/thread:135
(gdb) p __f
$1 = (void (&)(void)) @0x400fb4: {void (void)} 0x400fb4 <foo()>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]