No useful backtrace after uncaught exception in std::thread

Jonathan Wakely jwakely.gcc@gmail.com
Tue Nov 15 20:46:00 GMT 2011


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?



More information about the Gcc-help mailing list