From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Use rust_demangle
Date: Sat, 22 Apr 2017 06:17:00 -0000 [thread overview]
Message-ID: <87mvb93r0l.fsf@tromey.com> (raw)
In-Reply-To: <d3572ea6536064caffbafee22580997f@polymtl.ca> (Simon Marchi's message of "Fri, 21 Apr 2017 23:52:06 -0400")
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> It looks like you got the wrong PR number, I think it should be 20367.
Oops. Thanks for catching that.
Simon> Here for example, could you provide an example of when things go wrong
Simon> (a Rust symbol wrongfully demangled as a C++ symbol)?
Sure, there's one in the patch:
_ZN34_$LT$bc..X$u20$as$u20$bc..What$GT$4what17hec04869420f7eb7fE
The C++ demangler thinks it understands this and transforms it to
_$LT$bc..X$u20$as$u20$bc..What$GT$::what::hec04869420f7eb7f
However, it's actually the Rust symbol:
<bc::X as bc::What>::what
The issue here is that Rust chose a C++-like mangling. This was
probably a mistake. Maybe something can be done about it, maybe not --
but meanwhile I think it's nice if gdb can try to cope.
>> * ... and, in light of this change, "set demangle-style" seems a bit
>> weird because it allows the setting of styles to things obviously
>> not related to C++ at all, hence a change in demangle.c.
Simon> If other languages have mangling too, why shouldn't we be able to set
Simon> the mangling to that style? For example, why shouldn't we be able to
Simon> do "set demangle-style rust"?
In my view, "set demangle-style" is not very useful.
If you do set it, it affects future symbols only. It doesn't affect the
ones already read. And, if you set it to something nonsensical, like
"java", then other parts of the C++ support will break, because
cp-name-parser only understands the C++ form.
Also it mixes the mangled form (like "Lucid") with the output form (like
"Java"), which seems odd.
>> +char *
>> +gdb_demangle_cxx (const char *mangled, int options)
>> +{
>> + int style = (DMGL_GNU | DMGL_LUCID | DMGL_ARM
>> + | DMGL_HP | DMGL_EDG | DMGL_GNU_V3);
>> +
>> + if ((current_demangling_style & DMGL_AUTO) == 0)
>> + style &= current_demangling_style;
Simon> This deserves a comment, what does it accomplish? Restrict the style
Simon> to a restricted set of styles?
Yes, it tries to obey "set demangle-style". However, if demangle-style
is "auto", then there's no need to do anything else.
Simon> Shouldn't this be libiberty_demangers[i].demangling_style_name?
Yeah.
I'll make the other changes.
Tom
prev parent reply other threads:[~2017-04-22 6:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 12:31 Tom Tromey
2017-04-22 3:54 ` Simon Marchi
2017-04-22 6:17 ` Tom Tromey [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=87mvb93r0l.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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