No useful backtrace after uncaught exception in std::thread

Paweł Sikora pluto@agmk.net
Tue Nov 15 20:53:00 GMT 2011


On Tuesday 15 of November 2011 21:32:58 Jonathan Wakely wrote:
> On 15 November 2011 20:29, Paweł Sikora wrote:
> > 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
> 
> Your program is still in the main thread, i.e. it failed to even
> launch a thread - did you forget to use -pthread?

i've used gcc commandline from original post (w/o -pthread), so it looks like another bug
that allows std::thread compilation w/o (-pthread) -D_REENTRANT definition.



More information about the Gcc-help mailing list