From: Richard Biener <richard.guenther@gmail.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libiberty: Invoke D demangler when --format=auto
Date: Tue, 2 Apr 2024 09:02:36 +0200 [thread overview]
Message-ID: <CAFiYyc28+hg7iNG4jWVgVY4AzV2r=iTJq6LXH9ptYZVatdu_vA@mail.gmail.com> (raw)
In-Reply-To: <20240330201013.1755786-1-tom@tromey.com>
On Sat, Mar 30, 2024 at 9:11 PM Tom Tromey <tom@tromey.com> 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=31580
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30276
>
> libiberty
> * cplus-dem.c (cplus_demangle): Try the D demangler with
> "auto" format.
> * testsuite/d-demangle-expected: Add --format=auto 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/gdb.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 PR30276
> -# '[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 = dlang_demangle (mangled, options);
> if (ret)
> diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/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=dlang
> _D8demangle9anonymous03fooZ
> demangle.anonymous.foo
> +#
> +# Test that 'auto' works.
> +--format=auto
> +_D8demangle9anonymous03fooZ
> +demangle.anonymous.foo
> --
> 2.43.0
>
prev parent reply other threads:[~2024-04-02 7:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-30 20:10 Tom Tromey
2024-04-02 7:02 ` Richard Biener [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFiYyc28+hg7iNG4jWVgVY4AzV2r=iTJq6LXH9ptYZVatdu_vA@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).