From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120922 invoked by alias); 8 May 2018 15:27:17 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 120893 invoked by uid 89); 8 May 2018 15:27:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=enh, Dumont, franois, ENH X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 May 2018 15:27:07 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC9DA81E1A; Tue, 8 May 2018 15:27:05 +0000 (UTC) Received: from localhost (unknown [10.33.36.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E373100190C; Tue, 8 May 2018 15:27:04 +0000 (UTC) Date: Tue, 08 May 2018 15:27:00 -0000 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: Debug Mode ENH 3/4: Add backtrace Message-ID: <20180508152703.GO20930@redhat.com> References: <0dd654b0-6299-766d-e218-d3a5d4f1a886@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0dd654b0-6299-766d-e218-d3a5d4f1a886@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00058.txt.bz2 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 >    std::vector >, std::__debug::vector, >    std::random_access_iterator_tag> >; = >void; _Tp >    = int; _Allocator = std::allocator] > >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).