From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id 6D11F38582A2 for ; Mon, 4 Jul 2022 19:52:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D11F38582A2 Received: by mail-ej1-x62d.google.com with SMTP id d2so18322019ejy.1 for ; Mon, 04 Jul 2022 12:52:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TPdArQcwYQudVa23eRynwHB96zRm+Ljfn3Fz9AvEOjw=; b=2VYVzOiIR3YRmwB5CZNF1BLOJBNnMxLrMxmQY21MxN+w6skBwOji7AOhqPNW4uv2lp RWgtcPoYFR3kJdlMGEb9t1ZYEYjS66YEE/H5FO6gzYfm59HEBZp3TnFuDmpF8OVdHyXQ 1AZ3DHHGF/of33GD4ClMQPny0irtZwHXjtZ9HikDISONK7+Inkg4f7hJ7d7Zx0AJMI3g q3MJNjr5qpszSK6lcJPWhRjcRIMhI8C9tG390yYIz47bAcSRE2Zj65G7WrQhPZs0xcfI DAZROSacZwUpmDCcze02X4Of6468Owokte5mv0AioJfMU24grNKqsfgEciFQVcT6zKAG NNAw== X-Gm-Message-State: AJIora++nTR1ay0awhZ03gAauW+wVXzU2BE8nX3Lc1le1DfhGelLBloC 97Sc/vx2FdWjgjKv9BtsKfWdQa5mei1BRk7LeqU= X-Google-Smtp-Source: AGRyM1v3VVKBgkMww/Zmw9JNGBPzkEk+a9Ki84qIFuoEHlTXQE2liVchVU0Yu2YFVOLiXnV0f3stcsJ/huCHXtjd83c= X-Received: by 2002:a17:906:2086:b0:715:7983:a277 with SMTP id 6-20020a170906208600b007157983a277mr30335907ejq.386.1656964337238; Mon, 04 Jul 2022 12:52:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 4 Jul 2022 20:52:05 +0100 Message-ID: Subject: Re: WIP _GLIBCXX_DEBUG backtrace To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2022 19:52:20 -0000 On Mon, 4 Jul 2022, 18:21 Fran=C3=A7ois Dumont via Libstdc++, < libstdc++@gcc.gnu.org> wrote: > Hi > > Here is the patch to add backtrace to _GLIBCXX_DEBUG mode. It is using > the recently introduced _GLIBCXX_HAS_STACKTRACE. > > It is only WIP because for the moment I had to add: > > // { dg-options "-lstdc++_libbacktrace" } > > to avoid unresolved symbols. > > How should I handle this ? > > 1. Ask the user to define _GLIBCXX_DEBUG_STACKTRACE to get the backtrace > and so also require to add this linker option. > For now, I think this is the best option. Even when the symbols are in the library I think the backtraces should be optional. Controlled by a compile-time macro and/or an environment variable. > 2. Is it possible to add something in formatter.h to automagically link > libstdc++_libbacktrace ? > Not possible, GCC and Unix linkers don't support doing that. > 3. Add symbols to libstdc++.so ? > The symbols from libstdc++_libbacktrace.a will move to the .so at some point, once the C++23 std::stacktrace implementation is stable. I don't know if that will happen for GCC 13 though, it might be GCC 14. > Output sample: > > > /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/ve= ctor:264: > In function: > void std::debug::vector<_Tp, _Allocator>::assign(_InputIterator, > _InputIterator) [with _InputIterator =3D const int*; > =3D void; _Tp =3D int; _Allocator =3D > std::allocator] > > Backtrace: > 0x40284a void std::debug::vector > >::assign(int const*, int const*) > > /home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/ve= ctor:264 > 0x402bed void gnu_test::check_assign1 std::allocator > >() > /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/util/debug/checks.h:111 > 0x40246c test01() > > /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/23_containers/vector/debug/a= ssign4_neg.cc:26 > 0x40246c main > > /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/23_containers/vector/debug/a= ssign4_neg.cc:31 > > Error: function requires a valid iterator range [first, last). > > Objects involved in the operation: > iterator "first" @ 0x7ffe09e62fd8 { > type =3D int const* (constant iterator); > } > iterator "last" @ 0x7ffe09e62fd0 { > type =3D int const* (constant iterator); > } > XFAIL: 23_containers/vector/debug/assign4_neg.cc execution test > > Fran=C3=A7ois > >