aboutsummaryrefslogtreecommitdiff
path: root/gdb/language.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-05-26 15:04:07 -0600
committerTom Tromey <tom@tromey.com>2016-06-23 21:11:48 -0600
commit8b302db80cb07f5f3264b50e1b51fdb8ecb29183 (patch)
tree6ce81a7c2ddd979e3a6560a1fa588a572fe5f596 /gdb/language.h
parent56618e20bc50e55b49ed224df2a2a7e0840056fe (diff)
downloadgdb-8b302db80cb07f5f3264b50e1b51fdb8ecb29183.zip
gdb-8b302db80cb07f5f3264b50e1b51fdb8ecb29183.tar.gz
gdb-8b302db80cb07f5f3264b50e1b51fdb8ecb29183.tar.bz2
Move logic out of symbol_find_demangled_name
This patch moves most of the demangling logic out of symbol_find_demangled_name into the various language_defn objects. The simplest way to do this seemed to be to add a new method to language_defn. This is shame given the existing la_demangle, but given Ada's unusual needs, and the differing demangling options between languages, la_demangle didn't seem to fit. In order to make this work, I made enum language order-sensitive. This helps preserve the current ordering of demangling operations. 2016-06-23 Tom Tromey <tom@tromey.com> * symtab.c (symbol_find_demangled_name): Loop over languages and use language_sniff_from_mangled_name. * rust-lang.c (rust_sniff_from_mangled_name): New function. (rust_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_sniff_from_mangled_name): New function. (objc_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_sniff_from_mangled_name>: New field. (language_sniff_from_mangled_name): Declare. * language.c (language_sniff_from_mangled_name): New function. (unknown_language_defn, auto_language_defn, local_language_defn): Update. * jv-lang.c (java_sniff_from_mangled_name): New function. (java_language_defn): Use it. * go-lang.c (go_sniff_from_mangled_name): New function. (go_language_defn): Use it. * f-lang.c (f_language_defn): Update. * defs.h (enum language): Reorder. * d-lang.c (d_sniff_from_mangled_name): New function. (d_language_defn): Use it. * cp-support.h (gdb_sniff_from_mangled_name): Declare. * cp-support.c (gdb_sniff_from_mangled_name): New function. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * ada-lang.c (ada_sniff_from_mangled_name): New function. (ada_language_defn): Use it.
Diffstat (limited to 'gdb/language.h')
-rw-r--r--gdb/language.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/language.h b/gdb/language.h
index d57c60e..d6f932e 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -292,6 +292,22 @@ 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.
+
+ *DEMANGLED will be set by this function.
+
+ If this function returns 0, then *DEMANGLED must always be set
+ to NULL.
+
+ If this function returns 1, the implementation may set this to
+ a xmalloc'd string holding the demangled form. However, it is
+ not required to. The string, if any, is owned by the caller.
+
+ The resulting string should be of the form that will be
+ installed into a symbol. */
+ int (*la_sniff_from_mangled_name) (const char *mangled, char **demangled);
+
/* Return class name of a mangled method name or NULL. */
char *(*la_class_name_from_physname) (const char *physname);
@@ -565,6 +581,13 @@ extern CORE_ADDR skip_language_trampoline (struct frame_info *, CORE_ADDR pc);
extern char *language_demangle (const struct language_defn *current_language,
const char *mangled, int options);
+/* A wrapper for la_sniff_from_mangled_name. The arguments and result
+ are as for the method. */
+
+extern int language_sniff_from_mangled_name (const struct language_defn *lang,
+ const char *mangled,
+ char **demangled);
+
/* Return class name from physname, or NULL. */
extern char *language_class_name_from_physname (const struct language_defn *,
const char *physname);