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: Yao Qi <qiyaoltc at gmail dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 06 Jun 2016 15:14:42 +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>
Tom Tromey <tom@tromey.com> writes:
> I'm not especially fond of the new name, "la_demangle_for_symbol".
>
How about "la_sniff_by_symbol"? IMO, symbol_find_demangled_name does
two things, set the language of symbol, and get the demangled name.
It is quite similar to frame unwinder sniffer and frame unwinding.
> --- a/gdb/language.h
> +++ b/gdb/language.h
> @@ -292,6 +292,19 @@ struct language_defn
> /* Return demangled language symbol, or NULL. */
> char *(*la_demangle) (const char *mangled, int options);
>
> + /* Demangle a symbol according to this language's rules. Unlike
> + la_demangle, this does not take any options. The return value
> + should either be NULL if the name cannot be demangled, or an
> + xmalloc'd string, to be owned by the caller.
> +
> + If this function returns non-NULL, then it can be assumed that
> + MANGLED represents a mangled symbol for this language. If this
> + function returns NULL, then normally the converse is true, but
> + RECOGNIZED can be set to 1 to override this.
> +
> + RECOGNIZED must be initialized to 0 by the caller. */
> + char *(*la_demangle_for_symbol) (const char *mangled, int *recognized);
Why don't we return int to indicate the name can be demangled or not and
put the demangled name in the second parameter if it can be?
--
Yao (éå)