Debug Mode ENH 3/4: Add backtrace
François Dumont
frs.dumont@gmail.com
Mon May 7 20:20:00 GMT 2018
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.
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_backtrace.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180507/2966a47e/attachment.bin>
More information about the Libstdc++
mailing list