diff options
-rw-r--r-- | gdb/ChangeLog | 33 | ||||
-rw-r--r-- | gdb/ada-lang.c | 8 | ||||
-rw-r--r-- | gdb/c-lang.c | 11 | ||||
-rw-r--r-- | gdb/d-lang.c | 8 | ||||
-rw-r--r-- | gdb/f-lang.c | 19 | ||||
-rw-r--r-- | gdb/go-lang.c | 8 | ||||
-rw-r--r-- | gdb/language.c | 28 | ||||
-rw-r--r-- | gdb/language.h | 9 | ||||
-rw-r--r-- | gdb/m2-lang.c | 1 | ||||
-rw-r--r-- | gdb/objc-lang.c | 8 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 1 | ||||
-rw-r--r-- | gdb/p-lang.c | 1 | ||||
-rw-r--r-- | gdb/rust-lang.c | 8 |
13 files changed, 111 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bf690af..1390be1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,38 @@ 2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com> + * ada-lang.c (ada_language_data): Delete la_demangle initializer. + (ada_language::demangle): New member function. + * c-lang.c (c_language_data): Delete la_demangle initializer. + (cplus_language_data): Delete la_demangle initializer. + (cplus_language::demangle): New member function. + (asm_language_data): Delete la_demangle initializer. + (minimal_language_data): Delete la_demangle initializer. + * d-lang.c (d_language_data): Delete la_demangle initializer. + (d_language::demangle): New member function. + * f-lang.c (f_language_data): Delete la_demangle initializer. + (f_language::demangle): New member function. + * go-lang.c (go_language_data): Delete la_demangle initializer. + (go_language::demangle): New member function. + * language.c (language_demangle): Update. + (unk_lang_demangle): Delete. + (unknown_language_data): Delete la_demangle initializer. + (unknown_language::demangle): New member function. + (auto_language_data): Delete la_demangle initializer. + (auto_language::demangle): New member function. + * language.h (language_data): Delete la_demangle field. + (language_defn::demangle): New function. + * m2-lang.c (m2_language_data): Delete la_demangle initializer. + * objc-lang.c (objc_language_data): Delete la_demangle + initializer. + (objc_language::demangle): New member function. + * opencl-lang.c (opencl_language_data): Delete la_demangle + initializer. + * p-lang.c (pascal_language_data): Likewise. + * rust-lang.c (rust_language_data): Likewise. + (rust_language::demangle): New member function. + +2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com> + * ada-lang.c (ada_language_data): Delete la_print_type initializer. (ada_language::print_type): New member function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index f84f02f..42e5709 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13926,7 +13926,6 @@ extern const struct language_data ada_language_data = NULL, /* name_of_this */ true, /* la_store_sym_names_in_linkage_form_p */ ada_lookup_symbol_nonlocal, /* Looking up non-local symbols. */ - ada_la_decode, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ ada_op_print_tab, /* expression operators for printing */ @@ -14108,6 +14107,13 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + return ada_la_decode (mangled, options); + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override diff --git a/gdb/c-lang.c b/gdb/c-lang.c index abcdc52..de7a1bd 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -912,7 +912,6 @@ extern const struct language_data c_language_data = NULL, /* name_of_this */ true, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ @@ -1022,7 +1021,6 @@ extern const struct language_data cplus_language_data = "this", /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - gdb_demangle, /* Language specific symbol demangler */ cp_class_name_from_physname, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ @@ -1146,6 +1144,13 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + return gdb_demangle (mangled, options); + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override @@ -1188,7 +1193,6 @@ extern const struct language_data asm_language_data = NULL, /* name_of_this */ true, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ @@ -1263,7 +1267,6 @@ extern const struct language_data minimal_language_data = NULL, /* name_of_this */ true, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 815b597..fb56e1e 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -155,7 +155,6 @@ extern const struct language_data d_language_data = "this", false, /* la_store_sym_names_in_linkage_form_p */ d_lookup_symbol_nonlocal, - d_demangle, /* Language specific symbol demangler. */ NULL, /* Language specific class_name_from_physname. */ d_op_print_tab, /* Expression operators for printing. */ @@ -254,6 +253,13 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + return d_demangle (mangled, options); + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 1b0fec6..bd5f78c 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -615,13 +615,6 @@ extern const struct language_data f_language_data = NULL, /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - - /* We could support demangling here to provide module namespaces - also for inferiors with only minimal symbol table (ELF symbols). - Just the mangling standard is not standardized across compilers - and there is no DW_AT_producer available for inferiors with only - the ELF symbols to check the mangling kind. */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ f_op_print_tab, /* expression operators for printing */ @@ -692,6 +685,18 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + /* We could support demangling here to provide module namespaces + also for inferiors with only minimal symbol table (ELF symbols). + Just the mangling standard is not standardized across compilers + and there is no DW_AT_producer available for inferiors with only + the ELF symbols to check the mangling kind. */ + return nullptr; + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 1ec5347..6bd87aa 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -540,7 +540,6 @@ extern const struct language_data go_language_data = NULL, /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, - go_demangle, /* Language specific symbol demangler. */ NULL, /* Language specific class_name_from_physname. */ go_op_print_tab, /* Expression operators for printing. */ @@ -628,6 +627,13 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + return go_demangle (mangled, options); + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override diff --git a/gdb/language.c b/gdb/language.c index c8f0349..c447eab 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -589,8 +589,8 @@ char * language_demangle (const struct language_defn *current_language, const char *mangled, int options) { - if (current_language != NULL && current_language->la_demangle) - return current_language->la_demangle (mangled, options); + if (current_language != NULL) + return current_language->demangle (mangled, options); return NULL; } @@ -749,12 +749,6 @@ static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc) return 0; } -/* Unknown languages just use the cplus demangler. */ -static char *unk_lang_demangle (const char *mangled, int options) -{ - return gdb_demangle (mangled, options); -} - static char *unk_lang_class_name (const char *mangled) { return NULL; @@ -800,7 +794,6 @@ extern const struct language_data unknown_language_data = "this", /* name_of_this */ true, /* store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - unk_lang_demangle, /* Language specific symbol demangler */ unk_lang_class_name, /* Language specific class_name_from_physname */ unk_op_print_tab, /* expression operators for printing */ @@ -840,6 +833,14 @@ public: { error (_("unimplemented unknown_language::print_type called")); } + + /* See language.h. */ + + char *demangle (const char *mangled, int options) const override + { + /* The unknown language just uses the C++ demangler. */ + return gdb_demangle (mangled, options); + } }; /* Single instance of the unknown language class. */ @@ -871,7 +872,6 @@ extern const struct language_data auto_language_data = "this", /* name_of_this */ false, /* store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - unk_lang_demangle, /* Language specific symbol demangler */ unk_lang_class_name, /* Language specific class_name_from_physname */ unk_op_print_tab, /* expression operators for printing */ @@ -911,6 +911,14 @@ public: { error (_("unimplemented auto_language::print_type called")); } + + /* See language.h. */ + + char *demangle (const char *mangled, int options) const override + { + /* The auto language just uses the C++ demangler. */ + return gdb_demangle (mangled, options); + } }; /* Single instance of the fake "auto" language. */ diff --git a/gdb/language.h b/gdb/language.h index 8defe95..c456189 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -310,9 +310,6 @@ struct language_data const struct block *, const domain_enum); - /* Return demangled language symbol, or NULL. */ - char *(*la_demangle) (const char *mangled, int options); - /* Return class name of a mangled method name or NULL. */ char *(*la_class_name_from_physname) (const char *physname); @@ -512,6 +509,12 @@ struct language_defn : language_data return false; } + /* Return demangled language symbol version of MANGLED, or NULL. */ + virtual char *demangle (const char *mangled, int options) const + { + return nullptr; + } + /* Print a type using syntax appropriate for this language. */ virtual void print_type (struct type *, const char *, struct ui_file *, int, diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 098a2aa..a83cf14 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -374,7 +374,6 @@ extern const struct language_data m2_language_data = NULL, /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ m2_op_print_tab, /* expression operators for printing */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 0566ce8..1e3d1fd 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -380,7 +380,6 @@ extern const struct language_data objc_language_data = "self", /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - objc_demangle, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ objc_op_print_tab, /* Expression operators for printing */ @@ -422,6 +421,13 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + return objc_demangle (mangled, options); + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index d1ca29d..d98b228 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1028,7 +1028,6 @@ extern const struct language_data opencl_language_data = NULL, /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 9aa03de..50b913e 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -405,7 +405,6 @@ extern const struct language_data pascal_language_data = "this", /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ pascal_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index f78686a..8848e97 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2060,7 +2060,6 @@ extern const struct language_data rust_language_data = NULL, /* name_of_this */ false, /* la_store_sym_names_in_linkage_form_p */ rust_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - gdb_demangle, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ @@ -2136,6 +2135,13 @@ public: /* See language.h. */ + char *demangle (const char *mangled, int options) const override + { + return gdb_demangle (mangled, options); + } + + /* See language.h. */ + void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const override |