aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-06-01 10:53:05 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-17 09:25:09 +0100
commiteff93b4d48eb0e79b7879475bb47eec55dbb41be (patch)
tree4f6d1c1c724b5faf2a1d2966e8401b271e2f12fc
parentde54374205650be71237ce51ef7981d30ddd78dc (diff)
downloadgdb-eff93b4d48eb0e79b7879475bb47eec55dbb41be.zip
gdb-eff93b4d48eb0e79b7879475bb47eec55dbb41be.tar.gz
gdb-eff93b4d48eb0e79b7879475bb47eec55dbb41be.tar.bz2
gdb: Convert language la_class_name_from_physname field to a method
This commit changes the language_data::la_class_name_from_physname function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data) Delete la_class_name_from_physname initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (cplus_language::class_name_from_physname): New member function. (asm_language_data): Delete la_class_name_from_physname initializer. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * dwarf2/read.c (guess_partial_die_structure_name): Update to call method on language_defn class. (guess_full_die_structure_name): Likewise. * f-lang.c (f_language_data): Delete la_class_name_from_physname initializer. * go-lang.c (go_language_data): Likewise. * language.c (language_class_name_from_physname): Delete. (unk_lang_class_name): Delete. (unknown_language_data): Delete la_class_name_from_physname initializer. (auto_language_data): Likewise. * language.h (language_data): Delete la_class_name_from_physname field. (language_defn::class_name_from_physname): New function. (language_class_name_from_physname): Delete declaration. * m2-lang.c (m2_language_data): Delete la_class_name_from_physname initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
-rw-r--r--gdb/ChangeLog33
-rw-r--r--gdb/ada-lang.c2
-rw-r--r--gdb/c-lang.c15
-rw-r--r--gdb/d-lang.c2
-rw-r--r--gdb/dwarf2/read.c7
-rw-r--r--gdb/f-lang.c2
-rw-r--r--gdb/go-lang.c2
-rw-r--r--gdb/language.c19
-rw-r--r--gdb/language.h13
-rw-r--r--gdb/m2-lang.c2
-rw-r--r--gdb/objc-lang.c2
-rw-r--r--gdb/opencl-lang.c2
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/rust-lang.c2
14 files changed, 49 insertions, 55 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f9d989d..2aafc0a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,36 @@
+2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_language_data) Delete
+ la_class_name_from_physname initializer.
+ * c-lang.c (c_language_data): Likewise.
+ (cplus_language_data): Likewise.
+ (cplus_language::class_name_from_physname): New member function.
+ (asm_language_data): Delete la_class_name_from_physname
+ initializer.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * dwarf2/read.c (guess_partial_die_structure_name): Update to call
+ method on language_defn class.
+ (guess_full_die_structure_name): Likewise.
+ * f-lang.c (f_language_data): Delete la_class_name_from_physname
+ initializer.
+ * go-lang.c (go_language_data): Likewise.
+ * language.c (language_class_name_from_physname): Delete.
+ (unk_lang_class_name): Delete.
+ (unknown_language_data): Delete la_class_name_from_physname
+ initializer.
+ (auto_language_data): Likewise.
+ * language.h (language_data): Delete la_class_name_from_physname
+ field.
+ (language_defn::class_name_from_physname): New function.
+ (language_class_name_from_physname): Delete declaration.
+ * m2-lang.c (m2_language_data): Delete la_class_name_from_physname
+ initializer.
+ * objc-lang.c (objc_language_data): Likewise.
+ * opencl-lang.c (opencl_language_data): Likewise.
+ * p-lang.c (pascal_language_data): Likewise.
+ * rust-lang.c (rust_language_data): Likewise.
+
2020-06-16 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (STATUS_NAME): New macro.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c5e28c5..96cb865 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13914,8 +13914,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. */
- NULL, /* Language specific
- class_name_from_physname */
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
1, /* String lower bound */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 53137e8..bb49706 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -911,8 +911,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
- class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@@ -1019,8 +1017,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 */
- cp_class_name_from_physname, /* Language specific
- class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@@ -1163,6 +1159,13 @@ public:
{
return cplus_skip_trampoline (fi, pc);
}
+
+ /* See language.h. */
+
+ char *class_name_from_physname (const char *physname) const override
+ {
+ return cp_class_name_from_physname (physname);
+ }
};
/* The single instance of the C++ language class. */
@@ -1198,8 +1201,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
- class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@@ -1271,8 +1272,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
- class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 81e3aac..6dacf8c 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -154,8 +154,6 @@ extern const struct language_data d_language_data =
"this",
false, /* la_store_sym_names_in_linkage_form_p */
d_lookup_symbol_nonlocal,
- NULL, /* Language specific
- class_name_from_physname. */
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e3073fe..d15eba9 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -18874,8 +18874,8 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
&& child_pdi->linkage_name != NULL)
{
gdb::unique_xmalloc_ptr<char> actual_class_name
- (language_class_name_from_physname (cu->language_defn,
- child_pdi->linkage_name));
+ (cu->language_defn->class_name_from_physname
+ (child_pdi->linkage_name));
if (actual_class_name != NULL)
{
struct objfile *objfile = cu->per_objfile->objfile;
@@ -21715,8 +21715,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
if (linkage_name != NULL)
{
gdb::unique_xmalloc_ptr<char> actual_name
- (language_class_name_from_physname (cu->language_defn,
- linkage_name));
+ (cu->language_defn->class_name_from_physname (linkage_name));
const char *name = NULL;
if (actual_name != NULL)
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 90a794e..07ee2c8 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -614,8 +614,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 */
- NULL, /* Language specific
- class_name_from_physname */
f_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
1, /* String lower bound */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 6a60e18..7b8d4a5 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -539,8 +539,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,
- NULL, /* Language specific
- class_name_from_physname. */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
diff --git a/gdb/language.c b/gdb/language.c
index ba4d96c..ade5109 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -589,16 +589,6 @@ language_demangle (const struct language_defn *current_language,
return NULL;
}
-/* Return class name from physname or NULL. */
-char *
-language_class_name_from_physname (const struct language_defn *lang,
- const char *physname)
-{
- if (lang != NULL && lang->la_class_name_from_physname)
- return lang->la_class_name_from_physname (physname);
- return NULL;
-}
-
/* Return information about whether TYPE should be passed
(and returned) by reference at the language level. */
@@ -739,11 +729,6 @@ unk_lang_value_print (struct value *val, struct ui_file *stream,
"function unk_lang_value_print called."));
}
-static char *unk_lang_class_name (const char *mangled)
-{
- return NULL;
-}
-
static const struct op_print unk_op_print_tab[] =
{
{NULL, OP_NULL, PREC_NULL, 0}
@@ -783,8 +768,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_class_name, /* Language specific
- class_name_from_physname */
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
@@ -860,8 +843,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_class_name, /* Language specific
- class_name_from_physname */
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
diff --git a/gdb/language.h b/gdb/language.h
index 05ad132..36fc2c5 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -304,9 +304,6 @@ struct language_data
const struct block *,
const domain_enum);
- /* Return class name of a mangled method name or NULL. */
- char *(*la_class_name_from_physname) (const char *physname);
-
/* Table for printing expressions. */
const struct op_print *la_op_print_tab;
@@ -523,6 +520,12 @@ struct language_defn : language_data
return (CORE_ADDR) 0;
}
+ /* Return class name of a mangled method name or NULL. */
+ virtual char *class_name_from_physname (const char *physname) const
+ {
+ return nullptr;
+ }
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
@@ -677,10 +680,6 @@ 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);
-/* Return class name from physname, or NULL. */
-extern char *language_class_name_from_physname (const struct language_defn *,
- const char *physname);
-
/* Splitting strings into words. */
extern const char *default_word_break_characters (void);
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 3e1b74e..6cb3f7d 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -373,8 +373,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
- class_name_from_physname */
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index ff028fc..631b205 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -348,8 +348,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 */
- NULL, /* Language specific
- class_name_from_physname */
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
0, /* String lower bound */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index eaf61c3..ab19acf 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1027,8 +1027,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
- class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index f3d10d0..2f77d7a 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -404,7 +404,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 class_name_from_physname */
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 449dfca..ada721f 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -2059,8 +2059,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 */
- NULL, /* Language specific
- class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */