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


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 (éå)


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