From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id k6yJA7itC2aK4B8AWB0awg (envelope-from ) for ; Tue, 02 Apr 2024 03:03:20 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QLFgZeMY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DB6551E0C0; Tue, 2 Apr 2024 03:03:19 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id ABCC21E08C for ; Tue, 2 Apr 2024 03:03:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8042A385DC3F for ; Tue, 2 Apr 2024 07:03:16 +0000 (GMT) Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id CBDEE385840A for ; Tue, 2 Apr 2024 07:02:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBDEE385840A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CBDEE385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::236 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712041375; cv=none; b=jZjPknyMu9coe3kvEwFfBxynPaEiJvPod8heT0Q5CfFsrUAYpnt2XObEssS3fasi317utep4pUC85sPR87nJ0WCOJY1VaLtOk8G6EGxIKhz6ewJq8l0NxIwDIVLZThsEyyljSoyL/btCWKjb+1qm8RvfXWNy7ser887q76jyONQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712041375; c=relaxed/simple; bh=5relz3WcyTGPUFjEuFEULv9FyC9MLmU1c7qyWSsRX9E=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Q3gpdEdNnJjh4Ii5X6Q0S452ew1T7/I1IkOu0pgNtGpm9gpEFM/20+KahSLMrwRdkQwJfl1JWiEYI1q+B9fHghzUzP+0OP/HVoVPfyra37HlY5YP5vdXkpTwSpK8lN8KZ2daQG4OW7DeTcpcWJOs90F9AZuuT9IhI6zqyiWAcWI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2d6ee6c9945so35544821fa.3 for ; Tue, 02 Apr 2024 00:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712041368; x=1712646168; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ku9a0B2UncgF2C0jk6vJUuktgr8cTl5YIZIM1Ktly6Q=; b=QLFgZeMYouIMjqQfk6rWs4YjCEHBPQaHsg/jjGKFXldzwhjpOueaRUULNYU7e32KqF S/VxzTOJ921X5paVOPzt+v3oVr2NdnmQ0ET+VSCLXyhZRYMCR4/STcEu4hwXivK6wK+m Bu3p6ljaQHGPGEh9c94y15jskdHZaQKYawnF6YydbIS0Dbcf+kbi2KKw4XDi1TNarNHT d+ZzHNGeSXEXIqsHyYieKaw7sIrQdZN938T3NlSrDrb9s7eZl2fm/EZ3Nvj7dqBHjU7Z ca1viFF0dQw/K+RwsX7RD2NCcbRwu1mE6x9asl/DmasaKCmrh83uLF4LajOsBefUDLrW +5qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712041368; x=1712646168; 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=Ku9a0B2UncgF2C0jk6vJUuktgr8cTl5YIZIM1Ktly6Q=; b=V4lV2EAoT200JD/2vOoy/M0U2DyrEpNoi0GOsAC+tcDjaSaz8ihRZk8uuifuGvY02j /cksaktMcLu5Qa8Jx9VbGUwfKqqmjDEOpmf/ght1eCmsfr7Uays0nSZJSJYSk3x+LH+D EdHoudGLqGBgYWygUZn1xyy7LA77OACWBz5mSNl1EtmYnU1chfdyXUum9lFjkCyvmqeX s5fLZGDKyqnT9S+v0VGFhCbyNol3eUMfpH2RT6nWQQ4mZmh3btGS7poyM5DGk9i8JCZ8 LPxFX0O+9DPjIcWDI+JAzGDpyxVY72dcy0F/XXanO81tunj1YcfvonGux8Y6j+NasQY8 me+g== X-Gm-Message-State: AOJu0YztbPrQUS+Rz5sSLqqZebJgjzvNIRCiRF3WUmYrGPpk5Rjh5bq6 juDgNvaA4EUJTD7bbsMrEqnSn1FBZhf5cq04vwketj/yWkoU0MO7Di5tLV8S6jCNklS6LlVoHlK Ib8fStMci3W50NvGPsLnFvy/yoqE= X-Google-Smtp-Source: AGHT+IEVsq/svHQ2UICL8brKwD98T/Mn2SkaS29PspMQAWOV1XCkrSUqGAQ/m/nGJQd5m+Q3JG26oaz9FRcjqDLj9gA= X-Received: by 2002:a2e:a233:0:b0:2d6:a33c:66f8 with SMTP id i19-20020a2ea233000000b002d6a33c66f8mr6222714ljm.4.1712041367673; Tue, 02 Apr 2024 00:02:47 -0700 (PDT) MIME-Version: 1.0 References: <20240330201013.1755786-1-tom@tromey.com> In-Reply-To: <20240330201013.1755786-1-tom@tromey.com> From: Richard Biener Date: Tue, 2 Apr 2024 09:02:36 +0200 Message-ID: Subject: Re: [PATCH] libiberty: Invoke D demangler when --format=auto To: Tom Tromey Cc: gdb-patches@sourceware.org, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On Sat, Mar 30, 2024 at 9:11=E2=80=AFPM Tom Tromey wrote: > > Investigating GDB PR d/31580 showed that the libiberty demangler > doesn't automatically demangle D mangled names. However, I think it > should -- like C++ and Rust (new-style), D mangled names are readily > distinguished by the leading "_D", and so the likelihood of confusion > is low. The other non-"auto" cases in this code are Ada (where the > encoded form could more easily be confused by ordinary programs) and > Java (which is long gone, but which also shared the C++ mangling and > thus was just an output style preference). > > This patch also fixed another GDB bug, though of course that part > won't apply to the GCC repository. OK. > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31580 > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30276 > > libiberty > * cplus-dem.c (cplus_demangle): Try the D demangler with > "auto" format. > * testsuite/d-demangle-expected: Add --format=3Dauto test. > --- > gdb/testsuite/gdb.dlang/dlang-start-2.exp | 4 +--- > libiberty/cplus-dem.c | 2 +- > libiberty/testsuite/d-demangle-expected | 5 +++++ > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.dlang/dlang-start-2.exp b/gdb/testsuite/gd= b.dlang/dlang-start-2.exp > index 4b3163ec97d..284f841b54a 100644 > --- a/gdb/testsuite/gdb.dlang/dlang-start-2.exp > +++ b/gdb/testsuite/gdb.dlang/dlang-start-2.exp > @@ -79,10 +79,8 @@ if {[gdb_start_cmd] < 0} { > return -1 > } > > -# We should probably have "D main" instead of "_Dmain" here, filed PR302= 76 > -# '[gdb/symtab] function name is _Dmain instead of "D main"' about that. > gdb_test "" \ > - "in _Dmain \\(\\)" \ > + "in D main \\(\\)" \ > "start" > > gdb_test "show language" {"auto; currently d".} > diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c > index 8b92946981f..ee9e84f5d6b 100644 > --- a/libiberty/cplus-dem.c > +++ b/libiberty/cplus-dem.c > @@ -186,7 +186,7 @@ cplus_demangle (const char *mangled, int options) > if (GNAT_DEMANGLING) > return ada_demangle (mangled, options); > > - if (DLANG_DEMANGLING) > + if (DLANG_DEMANGLING || AUTO_DEMANGLING) > { > ret =3D dlang_demangle (mangled, options); > if (ret) > diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuit= e/d-demangle-expected > index 47b059c4298..cfbdf2a52cb 100644 > --- a/libiberty/testsuite/d-demangle-expected > +++ b/libiberty/testsuite/d-demangle-expected > @@ -1470,3 +1470,8 @@ demangle.anonymous > --format=3Ddlang > _D8demangle9anonymous03fooZ > demangle.anonymous.foo > +# > +# Test that 'auto' works. > +--format=3Dauto > +_D8demangle9anonymous03fooZ > +demangle.anonymous.foo > -- > 2.43.0 >