This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 3/3] Move logic out of symbol_find_demangled_name


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]