From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id CEE13385840C for ; Tue, 2 Apr 2024 07:02:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CEE13385840C 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 CEE13385840C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712041372; cv=none; b=hOg81Z6S87kyvt/YUjZ9sIEYeaMwV78fmntCpCdIasHrseJbSeWMyJJcKvB45K3MFvnNbEK2vKfzykDW5CezXISfQtuMwGInTvqJ26Me1KWx+PjJCyMddz74FZqCZCxUUyfgJVyvjQ4WxbzFj+AhnjpwUfBmXiK/yT81ZwCZVyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712041372; c=relaxed/simple; bh=5relz3WcyTGPUFjEuFEULv9FyC9MLmU1c7qyWSsRX9E=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=O1Vpl/0JvKZ5c3kDekIelzRyaK4mF5I334JrIQJGWIC8F+TlJs2gNNRncXJ/gmdUoisD7RzWGQMoXo70B0I3FNQUDFwbb4Gtx06V73cyZlySdJajD7/tDneey5ugAxNBWpXEP8fMg7X0tm4GcJLLcYohragVj3juj1Oni/fNtlI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2d48d75ab70so70609221fa.0 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=gcc.gnu.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=DeQG3+y5dFWGj4ZcJgkueb+nqyM6z/f+Tt+OqPgT5cOjPeCLZ81w5g9r7lendaD9nB XdPTbU2mL+x/y1sDdgWc3oF220+fRoLl/GEQIilPXNrlCjJ3gsL74a6BVrufddaH312o Ule4uoz+iPDWjDCI7nPv1rtUw5In2AjNhlbe+u9RWkSSM04FLkiM/J0EzB+1e1eYn5p6 IQ3P2HxAyjg5GaG65XUjZoutxErdYCcR7rPe3i6A8G5VRf2K+XyhdwkjlOGLAh0mNvJb CZiBq22S8+sb/jJiyyjZXX1nuyrQ53/r3FxkQBXFq9tXRwrSwM2OWyR80KJWc9zhL3+T XTkw== 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=qrF6FcKVSKBDWWShGetpTjG6NyHF80fCTklAVhCOlqXdkULp9QrAwQ0FGS1dCDwDEm a7hMWy8bbW8DilhZlEMjwEeRLcWJ52kWeMt0EvpmuxKmd6/axdnRqgQNp+1yGBUIBtk7 ivnto09UenNddzlQ1j+zuFkWfIwxGrkxBa+L2G81F8ykvVWTwqrkKuw8oP1/shMNEklF /5gvrTbQaze1/LJMI/fF6gBulOzM0xK+OimMc/RendNSyCnompZXWCysOMX3a5YUG2DE ULzjw8IsgyVv6rwXzszRLxKikKWcW7ja5h2FtR+bf7dgaY6iaAU4Gcpaba8/IkDfsX26 3GWg== X-Forwarded-Encrypted: i=1; AJvYcCUObLQ2ZtJR4wEc6B/R8KrdgKIBMzVJdDlJt9L2XRC7LpuUYLzzlMYI/PZ3ikRUghoh5hv8zhI1j9s/sH8mQhYCBMlwK8FY2A== X-Gm-Message-State: AOJu0YyjV19rcGYn4NKiN6MzH5nh5VzUBGy3T8Twehgvp818kLC1F4wr GP5zkaylnQXkXVNA57C79Fn5Vwqcis5xR2kgvLlEuKQv3l9/3QaFvGssUSvm47M6nIMIF/8W04w JAMDJzfn6KvaoeTplmiEOsIybWb74hrh/ 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=-7.8 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=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: 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 >