From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.hazardy.de (mail.hazardy.de [78.94.181.132]) by sourceware.org (Postfix) with ESMTPS id ED5CA3838F33; Tue, 13 Dec 2022 21:02:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED5CA3838F33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hazardy.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hazardy.de Received: from NB-372.intranet.mimot.com (unknown [78.94.181.132]) by mail.hazardy.de (Postfix) with ESMTPSA id EC82E700496; Tue, 13 Dec 2022 22:02:53 +0100 (CET) From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, frs.dumont@gmail.com Subject: [PATCH] libstdc++: Deliver names of C functions in Date: Tue, 13 Dec 2022 22:02:47 +0100 Message-Id: <20221213210247.50375-1-gcc@hazardy.de> X-Mailer: git-send-email 2.38.1 In-Reply-To: <7973b22e-791b-a61e-e354-3e6f02e5a731@gmail.com> References: <7973b22e-791b-a61e-e354-3e6f02e5a731@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Björn Schäpers One could add (), these are not part of __name. One could also try to check upfront if __cxa_demangle should be called at all. -- >8 -- Tested on i686-w64-mingw32. __cxa_demangle is only to demangle C++ names, for all C functions, extern "C" functions, and including main it returns -2, in that case just adapt the given name. Otherwise it's kept empty, which doesn't look nice in the stacktrace. libstdc++-v3/ChangeLog: * include/std/stacktrace (stacktrace_entry::_S_demangle): Use raw __name if __cxa_demangle could not demangle it. Signed-off-by: Björn Schäpers --- libstdc++-v3/include/std/stacktrace | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace index 83c6463b0d8..5baf2dcdaca 100644 --- a/libstdc++-v3/include/std/stacktrace +++ b/libstdc++-v3/include/std/stacktrace @@ -219,6 +219,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION &__status); if (__status == 0) __s = __str; + else + __s = __name; __builtin_free(__str); return __s; } -- 2.38.1