This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/3] Move logic out of symbol_find_demangled_name
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Mon, 13 Jun 2016 14:35:04 +0100
- Subject: Re: [RFA 3/3] Move logic out of symbol_find_demangled_name
- Authentication-results: sourceware.org; auth=none
- References: <1465051760-25840-1-git-send-email-tom at tromey dot com> <1465051760-25840-4-git-send-email-tom at tromey dot com> <86mvmywgj1 dot fsf at gmail dot com> <8760tl6xbf dot fsf at tromey dot com> <9b062e13-3541-b122-2da8-1c61fe7fe55b at redhat dot com> <871t496nk4 dot fsf at tromey dot com>
On 06/07/2016 04:11 PM, Tom Tromey wrote:
> Pedro> Before, this would set language to language_cplus, even if the
> Pedro> symbol's language was Rust.
> [...]
> Pedro> However, this no longer forces C++, is that intended?
>
> I think the old code was in error.
Actually, AFAICS, the new code does the same thing, because the C++ version
and the Rust version are exactly the same. From your latest patch:
+/* See cp-support.h. */
+
+int
+gdb_sniff_from_mangled_name (const char *mangled, char **demangled)
+{
+ *demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
+ return *demangled != NULL;
+}
+/* la_sniff_from_mangled_name for Rust. */
+
+static int
+rust_sniff_from_mangled_name (const char *mangled, char **demangled)
+{
+ *demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
+ return *demangled != NULL;
+}
+
... and, the C++ version always wins, because C++ is listed first
in the languages enum. Sounds like rust_sniff_from_mangled_name is
not reachable.
I think this warrants at least a comment somewhere.
IIUC, from Rust 1.9 onward, Rust uses C++ mangling, so basically
there's no way to tell a C++ symbol from a Rust symbol from the
mangled name alone. Correct?
Thanks,
Pedro Alves