From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 95E7C3858D32 for ; Sat, 14 Jan 2023 20:37:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 95E7C3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673728666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1bx8F0lUNv7OlZtZKxBggpIxmZCNAA5Bj4NgNtRa09Q=; b=UtcF14rgU71qf7oFDMdD6AyPxfun4HbEs1XN0F/KIAckcnISFdHT4dD6tfSTKlkbc8eg6V NE+gOrJgnNG6Xg7ClDLmZdq0lgq8cuJ6rjMFklQqWUR6EfRuyN2mDG+Xz+64mA0Yvm5bWt prOfsGHFagJtCYfMFR452l9NEGa5CrI= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-232-16qWdlewPbS2Z4ZA3lxz2Q-1; Sat, 14 Jan 2023 15:37:42 -0500 X-MC-Unique: 16qWdlewPbS2Z4ZA3lxz2Q-1 Received: by mail-lf1-f70.google.com with SMTP id u5-20020a056512040500b004d22bdce2c6so1246127lfk.7 for ; Sat, 14 Jan 2023 12:37:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1bx8F0lUNv7OlZtZKxBggpIxmZCNAA5Bj4NgNtRa09Q=; b=eFKj9Ml8LAKijKSIxJ8J4qS2HQfxYfQrRVZHyuIPDTV6gPeT061gmVqrrqryiPKPO+ TR+UQYraeX0kBPDJYr8TlG6o8EM1He4tAVvXua04NTuaiHc7cBWNGRyfbgsYU930x0/M GyalsPB0h5eU5OhXoOKF4cDTzMJX5Fibqp042JeI+19as6CPM4TbWkKqSHM531/xGmLn ChB5cHWDB3nAUvSJfCuDKs2XlTTrrdIXhhV4ZVCR9zY62UA1NYbFaveEndUdaq1W9/S3 3xv76za/XFsXZHS2aL1zukOxvmGoUKzntOYjOQCs+6t2eE2oZUIobXycyjZfYFK1hCIT npcQ== X-Gm-Message-State: AFqh2krVGEfZz1XqTlqMuWzVwsgBXPmIU5VCoiSD8/6IaX5j3URAoO4n bK42bOUa2fyYMu94M5Vme42DzC2jmcL8Xm+KSfvveV/Jg0SdtZo8gKvpPSBOCN4ON6ASesFb6wf +upWAnHQOmAWxPjJP80yZTnJUlBc9M7U= X-Received: by 2002:a05:6512:21d2:b0:4cb:92:9423 with SMTP id d18-20020a05651221d200b004cb00929423mr3899818lft.348.1673728661109; Sat, 14 Jan 2023 12:37:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsbea4KGE8hYMxRrCZ2GLAn7oFOG0J7Qe5ieZSvku0jR9PrFz3zOmoz1Kz0hmRMyFnKvvQj+ecPAVrZqJ7+y6o= X-Received: by 2002:a05:6512:21d2:b0:4cb:92:9423 with SMTP id d18-20020a05651221d200b004cb00929423mr3899815lft.348.1673728660872; Sat, 14 Jan 2023 12:37:40 -0800 (PST) MIME-Version: 1.0 References: <7973b22e-791b-a61e-e354-3e6f02e5a731@gmail.com> <20221213210247.50375-1-gcc@hazardy.de> In-Reply-To: <20221213210247.50375-1-gcc@hazardy.de> From: Jonathan Wakely Date: Sat, 14 Jan 2023 20:37:29 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Deliver names of C functions in To: =?UTF-8?B?QmrDtnJuIFNjaMOkcGVycw==?= Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, frs.dumont@gmail.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 13 Dec 2022 at 21:03, Bj=C3=B6rn Sch=C3=A4pers wro= te: > > From: Bj=C3=B6rn Sch=C3=A4pers > > 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=C3=B6rn Sch=C3=A4pers > --- > libstdc++-v3/include/std/stacktrace | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/s= td/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 =3D=3D 0) > __s =3D __str; > + else > + __s =3D __name; > __builtin_free(__str); > return __s; > } > -- > 2.38.1 >