Message ID | 20221213210247.50375-1-gcc@hazardy.de |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp360079wrn; Tue, 13 Dec 2022 13:03:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ICnx6HCfIPGeYAy1dg8dcdEcLKVzEmU1hEfpz/fpWcGISja8h9MmJUj0AewU25Y+j8VvU X-Received: by 2002:a17:906:da0f:b0:7c1:540c:e214 with SMTP id fi15-20020a170906da0f00b007c1540ce214mr12926897ejb.47.1670965433846; Tue, 13 Dec 2022 13:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670965433; cv=none; d=google.com; s=arc-20160816; b=Hd3MMKWYoVZZ133Pm3Q+kRWdenrl23uxP8qcfU/hH2N8eXcP/PjMUXWy67LJtIMf/w 3DVLSUHf28MaTdVYa87f/sBG+L4szLm9dthky8xcPVv9O68Fy/ItmpY3eW69rZnxo9/6 vG3q/HLANc1kiUfbyYAHLCbX4W2vGJHX/SlX0ZFw2IekNPRn6EP8IU266Z7i4s7eXant v29ZikxEtFNBe1LH2wxKpZkftiqVmygxPsea7OS3jszTXQoHNsBetLeYchDC0UDZiFNP 7WBfJyuEdTsb9mpBczFm1HazsBql7gPh7ExfgVhIV3jx/u0rSa0RL1zmcxtVvfiQcyd0 4I+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dmarc-filter:delivered-to; bh=oGRm4uqL1poS7DJbmC4QA9m2hvBBs9Q5oDapRunA4YU=; b=h9d3QxBoIMX+WLNIAMyT1DOwe68n1BNawEOPMf3ITrxkVFW2arOr82n78FqVCtpvQh epWAmTjc7FtO83GWmvC9gKHL0Trk5s/XyMB2xLxKALliYxXvyoSEVYQB4MYlm2T06J1O j08fws/ipE/su/Dh2IiGqph+g7DqVGJQF3yKAgwn9w02JIzSkgwazr/g/OKT3MDEErlO huxYyEBKOFggAZxiEUDXKgzglaxorgmXPXT3LIsVkkp6KM+Tutjy+sI+zUH0JXnOdt6e uDTuZIiUM5juuQGReO0KNKrl/AiCxYzJnD+FRN1nsiFVZhbaJNqEVIN/oMu3uDmbuIuu ilpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o12-20020a170906974c00b00730936657d1si9253311ejy.552.2022.12.13.13.03.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Dec 2022 13:03:53 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A9383838CD3 for <ouuuleilei@gmail.com>; Tue, 13 Dec 2022 21:03:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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_Sch=C3=A4pers?= <gcc@hazardy.de> To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, frs.dumont@gmail.com Subject: [PATCH] libstdc++: Deliver names of C functions in <stacktrace> 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752134250699758610?= X-GMAIL-MSGID: =?utf-8?q?1752134250699758610?= |
Series |
libstdc++: Deliver names of C functions in <stacktrace>
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Björn Schäpers
Dec. 13, 2022, 9:02 p.m. UTC
From: Björn Schäpers <bjoern@hazardy.de> 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 <bjoern@hazardy.de> --- libstdc++-v3/include/std/stacktrace | 2 ++ 1 file changed, 2 insertions(+)
Comments
On Tue, 13 Dec 2022 at 21:03, Björn Schäpers <gcc@hazardy.de> wrote: > > From: Björn Schäpers <bjoern@hazardy.de> > > One could add (), these are not part of __name. One could also try to > check upfront if __cxa_demangle should be called at all. Thanks for the patch, I'll push this. I think we do want to check whether to call __cxa_demangle, because otherwise an extern "C" function called simply "g" will get demangled to "__float128" and that's not right! So I think we should check whether the function name starts with "_Z" which indicates a C++ function name. That can be improved later though. > > -- >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 <bjoern@hazardy.de> > --- > 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 >
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; }