On 07/05/18 22:20 +0200, François Dumont wrote:
Hi
Here is the patch to add backtrace info to debug assertion failure
output.
Example:
/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/vector:188:
In function:
std::__debug::vector<_Tp, _Allocator>::vector(_InputIterator,
_InputIterator, const _Allocator&) [with _InputIterator =
std::reverse_iterator<__gnu_debug::_Safe_tagged_iterator<__gnu_cxx::__normal_iterator<int*,
std::vector<int> >, std::__debug::vector<int>,
std::random_access_iterator_tag> >; <template-parameter-2-2> =
void; _Tp
= int; _Allocator = std::allocator<int>]
Backtrace:
./debug_neg.exe() [0x4020c1]
./debug_neg.exe() [0x400e59]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)
[0x7f13fc56e830]
./debug_neg.exe() [0x400eb9]
I tried to use add2line on the output address and it worked fine.
Tested under Linux x86_64.
I'll commit tomorrow if not told otherwise.
* src/c++11/debug.cc [_GLIBCXX_HAVE_EXECINFO_H]: Include execinfo.h.
[_GLIBCXX_HAVE_EXECINFO_H](_Error_formatter::_M_error): Render
backtrace.
Did you look into using libbacktrace? That resolves the addresses and
prints nice symbols. See the output of AddressSantizer for what it
looks like (I think that uses libbacktrace).