aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-08-04 17:07:59 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-09-16 11:04:04 +0100
commitb7c6e27dbbbbe678b2e2f0bf617605e055e1b378 (patch)
tree2a87e1b858d3b041518218a81cf031ba795e4561 /gdb
parent5aba6ebefb9488163c82e198b73ecf0a05a5d1fd (diff)
downloadbinutils-b7c6e27dbbbbe678b2e2f0bf617605e055e1b378.zip
binutils-b7c6e27dbbbbe678b2e2f0bf617605e055e1b378.tar.gz
binutils-b7c6e27dbbbbe678b2e2f0bf617605e055e1b378.tar.bz2
gdb: Convert language_data::la_op_print_tab to a method
Convert language_data::la_op_print_tab member variable to a virtual method language_defn::opcode_print_table. I changed the name in order to make it clearer (I hope) what the method does. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_op_print_tab initializer. (ada_language::opcode_print_table): New member function. * c-lang.c (c_language_data): Remove la_op_print_tab initializer. (c_language::opcode_print_table): New member function. (cplus_language_data): Remove la_op_print_tab initializer. (cplus_language::opcode_print_table): New member function. (asm_language_data): Remove la_op_print_tab initializer. (asm_language::opcode_print_table): New member function. (minimal_language_data): Remove la_op_print_tab initializer. (minimal_language::opcode_print_table): New member function. * d-lang.c (d_language_data): Remove la_op_print_tab initializer. (d_language::opcode_print_table): New member function. * expprint.c (print_subexp_standard): Update call to opcode_print_table. (op_string): Likewise. * f-lang.c (f_language_data): Remove la_op_print_tab initializer. (f_language::opcode_print_table): New member function. * go-lang.c (go_language_data): Remove la_op_print_tab initializer. (go_language::opcode_print_table): New member function. * language.c (unknown_language_data): Remove la_op_print_tab initializer. (unknown_language::opcode_print_table): New member function. (auto_language_data): Remove la_op_print_tab initializer. (auto_language::opcode_print_table): New member function. * language.h (language_data): Remove la_op_print_tab field. (language_defn::opcode_print_table): Declare new member function. * m2-lang.c (m2_language_data): Remove la_op_print_tab initializer. (m2_language::opcode_print_table): New member function. * objc-lang.c (objc_language_data): Remove la_op_print_tab initializer. (objc_language::opcode_print_table): New member function. * opencl-lang.c (opencl_language_data): Remove la_op_print_tab initializer. (opencl_language::opcode_print_table): New member function. * p-lang.c (pascal_language_data): Remove la_op_print_tab initializer. (pascal_language::opcode_print_table): New member function. * rust-lang.c (rust_language_data): Remove la_op_print_tab initializer. (rust_language::opcode_print_table): New member function.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog46
-rw-r--r--gdb/ada-lang.c6
-rw-r--r--gdb/c-lang.c24
-rw-r--r--gdb/d-lang.c6
-rw-r--r--gdb/expprint.c4
-rw-r--r--gdb/f-lang.c6
-rw-r--r--gdb/go-lang.c6
-rw-r--r--gdb/language.c12
-rw-r--r--gdb/language.h7
-rw-r--r--gdb/m2-lang.c6
-rw-r--r--gdb/objc-lang.c6
-rw-r--r--gdb/opencl-lang.c6
-rw-r--r--gdb/p-lang.c6
-rw-r--r--gdb/rust-lang.c6
14 files changed, 127 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d646595..f1fcbcf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,51 @@
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
+ * ada-lang.c (ada_language_data): Remove la_op_print_tab
+ initializer.
+ (ada_language::opcode_print_table): New member function.
+ * c-lang.c (c_language_data): Remove la_op_print_tab initializer.
+ (c_language::opcode_print_table): New member function.
+ (cplus_language_data): Remove la_op_print_tab initializer.
+ (cplus_language::opcode_print_table): New member function.
+ (asm_language_data): Remove la_op_print_tab initializer.
+ (asm_language::opcode_print_table): New member function.
+ (minimal_language_data): Remove la_op_print_tab initializer.
+ (minimal_language::opcode_print_table): New member function.
+ * d-lang.c (d_language_data): Remove la_op_print_tab initializer.
+ (d_language::opcode_print_table): New member function.
+ * expprint.c (print_subexp_standard): Update call to
+ opcode_print_table.
+ (op_string): Likewise.
+ * f-lang.c (f_language_data): Remove la_op_print_tab initializer.
+ (f_language::opcode_print_table): New member function.
+ * go-lang.c (go_language_data): Remove la_op_print_tab
+ initializer.
+ (go_language::opcode_print_table): New member function.
+ * language.c (unknown_language_data): Remove la_op_print_tab
+ initializer.
+ (unknown_language::opcode_print_table): New member function.
+ (auto_language_data): Remove la_op_print_tab initializer.
+ (auto_language::opcode_print_table): New member function.
+ * language.h (language_data): Remove la_op_print_tab field.
+ (language_defn::opcode_print_table): Declare new member function.
+ * m2-lang.c (m2_language_data): Remove la_op_print_tab
+ initializer.
+ (m2_language::opcode_print_table): New member function.
+ * objc-lang.c (objc_language_data): Remove la_op_print_tab
+ initializer.
+ (objc_language::opcode_print_table): New member function.
+ * opencl-lang.c (opencl_language_data): Remove la_op_print_tab
+ initializer.
+ (opencl_language::opcode_print_table): New member function.
+ * p-lang.c (pascal_language_data): Remove la_op_print_tab
+ initializer.
+ (pascal_language::opcode_print_table): New member function.
+ * rust-lang.c (rust_language_data): Remove la_op_print_tab
+ initializer.
+ (rust_language::opcode_print_table): New member function.
+
+2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
+
* ada-lang.c (ada_language_data): Remove la_exp_desc initializer.
(ada_language::expression_ops): New member function.
* c-lang.c (c_language_data): Remove la_exp_desc initializer.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 876125c..edf0d6b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13708,7 +13708,6 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
extern const struct language_data ada_language_data =
{
- ada_op_print_tab, /* expression operators for printing */
};
/* Class representing the Ada language. */
@@ -14210,6 +14209,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &ada_exp_descriptor; }
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return ada_op_print_tab; }
+
protected:
/* See language.h. */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index f29f340..73968ed 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -875,7 +875,6 @@ const struct exp_descriptor exp_descriptor_c =
extern const struct language_data c_language_data =
{
- c_op_print_tab, /* expression operators for printing */
};
/* Class representing the C language. */
@@ -951,6 +950,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_c; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
};
/* Single instance of the C language class. */
@@ -989,7 +993,6 @@ enum cplus_primitive_types {
extern const struct language_data cplus_language_data =
{
- c_op_print_tab, /* expression operators for printing */
};
/* A class for the C++ language. */
@@ -1187,6 +1190,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_c; }
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
+
protected:
/* See language.h. */
@@ -1206,7 +1214,6 @@ static cplus_language cplus_language_defn;
extern const struct language_data asm_language_data =
{
- c_op_print_tab, /* expression operators for printing */
};
/* A class for the ASM language. */
@@ -1269,6 +1276,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_c; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
};
/* The single instance of the ASM language class. */
@@ -1281,7 +1293,6 @@ static asm_language asm_language_defn;
extern const struct language_data minimal_language_data =
{
- c_op_print_tab, /* expression operators for printing */
};
/* A class for the minimal language. */
@@ -1333,6 +1344,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_c; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
};
/* The single instance of the minimal language class. */
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 4b8020e..f996786 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -128,7 +128,6 @@ enum d_primitive_types {
extern const struct language_data d_language_data =
{
- d_op_print_tab, /* Expression operators for printing. */
};
/* Class representing the D language. */
@@ -280,6 +279,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_c; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return d_op_print_tab; }
};
/* Single instance of the D language class. */
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 8cca5b4..5bd9553 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -73,7 +73,7 @@ print_subexp_standard (struct expression *exp, int *pos,
struct value *val;
char *tempstr = NULL;
- op_print_tab = exp->language_defn->la_op_print_tab;
+ op_print_tab = exp->language_defn->opcode_print_table ();
pc = (*pos)++;
opcode = exp->elts[pc].opcode;
switch (opcode)
@@ -669,7 +669,7 @@ op_string (enum exp_opcode op)
int tem;
const struct op_print *op_print_tab;
- op_print_tab = current_language->la_op_print_tab;
+ op_print_tab = current_language->opcode_print_table ();
for (tem = 0; op_print_tab[tem].opcode != OP_NULL; tem++)
if (op_print_tab[tem].opcode == op)
return op_print_tab[tem].string;
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 2bf046d..510d067 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -486,7 +486,6 @@ static const struct exp_descriptor exp_descriptor_f =
extern const struct language_data f_language_data =
{
- f_op_print_tab, /* expression operators for printing */
};
/* Class representing the Fortran language. */
@@ -736,6 +735,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_f; }
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return f_op_print_tab; }
+
protected:
/* See language.h. */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index eacc4de..2b9be93 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -508,7 +508,6 @@ enum go_primitive_types {
extern const struct language_data go_language_data =
{
- go_op_print_tab, /* Expression operators for printing. */
};
/* Class representing the Go language. */
@@ -641,6 +640,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_c; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return go_op_print_tab; }
};
/* Single instance of the Go language class. */
diff --git a/gdb/language.c b/gdb/language.c
index b467512..37aef2c 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -816,7 +816,6 @@ unknown_language_arch_info (struct gdbarch *gdbarch,
extern const struct language_data unknown_language_data =
{
- unk_op_print_tab, /* expression operators for printing */
};
/* Class representing the unknown language. */
@@ -937,6 +936,11 @@ public:
bool store_sym_names_in_linkage_form_p () const override
{ return true; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return unk_op_print_tab; }
};
/* Single instance of the unknown language class. */
@@ -947,7 +951,6 @@ static unknown_language unknown_language_defn;
extern const struct language_data auto_language_data =
{
- unk_op_print_tab, /* expression operators for printing */
};
/* Class representing the fake "auto" language. */
@@ -1063,6 +1066,11 @@ public:
const char *name_of_this () const override
{ return "this"; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return unk_op_print_tab; }
};
/* Single instance of the fake "auto" language. */
diff --git a/gdb/language.h b/gdb/language.h
index cfb3461..2d13cfa 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -168,9 +168,6 @@ extern const char *default_word_break_characters (void);
struct language_data
{
- /* Table for printing expressions. */
-
- const struct op_print *la_op_print_tab;
};
/* Base class from which all other language classes derive. */
@@ -567,6 +564,10 @@ struct language_defn : language_data
virtual const struct exp_descriptor *expression_ops () const;
+ /* Table for printing expressions. */
+
+ virtual const struct op_print *opcode_print_table () const = 0;
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index b41d0b4..1f9c8a8 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -199,7 +199,6 @@ const struct exp_descriptor exp_descriptor_modula2 =
extern const struct language_data m2_language_data =
{
- m2_op_print_tab, /* expression operators for printing */
};
/* Class representing the M2 language. */
@@ -448,6 +447,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_modula2; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return m2_op_print_tab; }
};
/* Single instance of the M2 language. */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index e78e087..b59a45b 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -323,7 +323,6 @@ static const struct op_print objc_op_print_tab[] =
extern const struct language_data objc_language_data =
{
- objc_op_print_tab, /* Expression operators for printing */
};
/* Class representing the Objective-C language. */
@@ -427,6 +426,11 @@ public:
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
};
/* Single instance of the class representing the Objective-C language. */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index e7186eb..df99fdc 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1006,7 +1006,6 @@ const struct exp_descriptor exp_descriptor_opencl =
/* Constant data representing the OpenCL language. */
extern const struct language_data opencl_language_data =
{
- c_op_print_tab, /* expression operators for printing */
};
/* Class representing the OpenCL language. */
@@ -1074,6 +1073,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_opencl; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
};
/* Single instance of the OpenCL language class. */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 1acd591..6a9811d 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -252,7 +252,6 @@ enum pascal_primitive_types {
extern const struct language_data pascal_language_data =
{
- pascal_op_print_tab, /* expression operators for printing */
};
/* Class representing the Pascal language. */
@@ -507,6 +506,11 @@ public:
bool range_checking_on_by_default () const override
{ return true; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return pascal_op_print_tab; }
};
/* Single instance of the Pascal language class. */
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 8c952e3..1971a8d 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1901,7 +1901,6 @@ static const struct exp_descriptor exp_descriptor_rust =
extern const struct language_data rust_language_data =
{
- c_op_print_tab, /* expression operators for printing */
};
/* Class representing the Rust language. */
@@ -2153,6 +2152,11 @@ public:
const struct exp_descriptor *expression_ops () const override
{ return &exp_descriptor_rust; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return c_op_print_tab; }
};
/* Single instance of the Rust language class. */