aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-08-04 15:59:52 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-09-16 11:04:03 +0100
commitb63a3f3fc4e998b4efd5fd49aa0eb044e9cee261 (patch)
tree314d88378bc6f02e7679166ec0bdda40d0ecd88e /gdb
parent1ac14a04025b105c1975ceb3b07245c811518bcb (diff)
downloadgdb-b63a3f3fc4e998b4efd5fd49aa0eb044e9cee261.zip
gdb-b63a3f3fc4e998b4efd5fd49aa0eb044e9cee261.tar.gz
gdb-b63a3f3fc4e998b4efd5fd49aa0eb044e9cee261.tar.bz2
gdb: Convert language_data::la_varobj_ops to a method
Convert language_data::la_varobj_ops member variable to a virtual method language_defn::varobj_ops. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_varobj_ops initializer. (ada_language::varobj_ops): New member function. * c-lang.c (c_language_data): Remove la_varobj_ops initializer. (cplus_language_data): Likewise. (cplus_language::varobj_ops): New member function. (asm_language_data): Remove la_varobj_ops initializer. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (language_defn::varobj_ops): New function. (unknown_language_data): Remove la_varobj_ops initializer. (auto_language_data): Likewise. * language.h (language_data): Remove la_varobj_ops field. (language_defn::varobj_ops): Declare new member function. * m2-lang.c (m2_language_data): Remove la_varobj_ops 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. * varobj.c (varobj_create): Update call to varobj_ops. * varobj.h (default_varobj_ops): Delete define.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog28
-rw-r--r--gdb/ada-lang.c6
-rw-r--r--gdb/c-lang.c9
-rw-r--r--gdb/d-lang.c1
-rw-r--r--gdb/f-lang.c1
-rw-r--r--gdb/go-lang.c1
-rw-r--r--gdb/language.c12
-rw-r--r--gdb/language.h8
-rw-r--r--gdb/m2-lang.c1
-rw-r--r--gdb/objc-lang.c1
-rw-r--r--gdb/opencl-lang.c1
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/rust-lang.c1
-rw-r--r--gdb/varobj.c2
-rw-r--r--gdb/varobj.h2
15 files changed, 54 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4478628..666dd1a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,33 @@
2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
+ * ada-lang.c (ada_language_data): Remove la_varobj_ops
+ initializer.
+ (ada_language::varobj_ops): New member function.
+ * c-lang.c (c_language_data): Remove la_varobj_ops
+ initializer.
+ (cplus_language_data): Likewise.
+ (cplus_language::varobj_ops): New member function.
+ (asm_language_data): Remove la_varobj_ops initializer.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * f-lang.c (f_language_data): Likewise.
+ * go-lang.c (go_language_data): Likewise.
+ * language.c (language_defn::varobj_ops): New function.
+ (unknown_language_data): Remove la_varobj_ops
+ initializer.
+ (auto_language_data): Likewise.
+ * language.h (language_data): Remove la_varobj_ops field.
+ (language_defn::varobj_ops): Declare new member function.
+ * m2-lang.c (m2_language_data): Remove la_varobj_ops 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.
+ * varobj.c (varobj_create): Update call to varobj_ops.
+ * varobj.h (default_varobj_ops): Delete define.
+
+2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com>
+
* ada-lang.c (ada_language_data): Remove la_macro_expansion
initializer.
* c-lang.c (c_language_data): Likewise.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 43b3af1..20fbf33 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13710,7 +13710,6 @@ extern const struct language_data ada_language_data =
{
&ada_exp_descriptor,
ada_op_print_tab, /* expression operators for printing */
- &ada_varobj_ops,
};
/* Class representing the Ada language. */
@@ -14202,6 +14201,11 @@ public:
bool store_sym_names_in_linkage_form_p () const override
{ return true; }
+ /* See language.h. */
+
+ const struct lang_varobj_ops *varobj_ops () const override
+ { return &ada_varobj_ops; }
+
protected:
/* See language.h. */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index a478dd8..9b21da1 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -877,7 +877,6 @@ extern const struct language_data c_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &c_varobj_ops,
};
/* Class representing the C language. */
@@ -988,7 +987,6 @@ extern const struct language_data cplus_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &cplus_varobj_ops,
};
/* A class for the C++ language. */
@@ -1176,6 +1174,11 @@ public:
enum macro_expansion macro_expansion () const override
{ return macro_expansion_c; }
+ /* See language.h. */
+
+ const struct lang_varobj_ops *varobj_ops () const override
+ { return &cplus_varobj_ops; }
+
protected:
/* See language.h. */
@@ -1197,7 +1200,6 @@ extern const struct language_data asm_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* A class for the ASM language. */
@@ -1269,7 +1271,6 @@ extern const struct language_data minimal_language_data =
{
&exp_descriptor_c,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* A class for the minimal language. */
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 3487022..95175af 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -130,7 +130,6 @@ extern const struct language_data d_language_data =
{
&exp_descriptor_c,
d_op_print_tab, /* Expression operators for printing. */
- &default_varobj_ops,
};
/* Class representing the D language. */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index cd596b5..d333055 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -488,7 +488,6 @@ extern const struct language_data f_language_data =
{
&exp_descriptor_f,
f_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Fortran language. */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 92d2819..c37e918 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -510,7 +510,6 @@ extern const struct language_data go_language_data =
{
&exp_descriptor_c,
go_op_print_tab, /* Expression operators for printing. */
- &default_varobj_ops,
};
/* Class representing the Go language. */
diff --git a/gdb/language.c b/gdb/language.c
index d255035..bcffd3e 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -764,6 +764,16 @@ language_defn::get_symbol_name_matcher_inner
return default_symbol_name_matcher;
}
+/* See language.h. */
+
+const struct lang_varobj_ops *
+language_defn::varobj_ops () const
+{
+ /* The ops for the C language are suitable for the vast majority of the
+ supported languages. */
+ return &c_varobj_ops;
+}
+
/* Return true if TYPE is a string type, otherwise return false. This
default implementation only detects TYPE_CODE_STRING. */
@@ -800,7 +810,6 @@ extern const struct language_data unknown_language_data =
{
&exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the unknown language. */
@@ -933,7 +942,6 @@ extern const struct language_data auto_language_data =
{
&exp_descriptor_standard,
unk_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the fake "auto" language. */
diff --git a/gdb/language.h b/gdb/language.h
index a2a970e..414488d 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -176,9 +176,6 @@ struct language_data
/* Table for printing expressions. */
const struct op_print *la_op_print_tab;
-
- /* Various operations on varobj. */
- const struct lang_varobj_ops *la_varobj_ops;
};
/* Base class from which all other language classes derive. */
@@ -565,6 +562,11 @@ struct language_defn : language_data
virtual enum macro_expansion macro_expansion () const
{ return macro_expansion_no; }
+ /* Return a structure containing various operations on varobj specific
+ for this language. */
+
+ virtual const struct lang_varobj_ops *varobj_ops () const;
+
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 ac251af..c5206bb 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -201,7 +201,6 @@ extern const struct language_data m2_language_data =
{
&exp_descriptor_modula2,
m2_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the M2 language. */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 2246e12..523902a 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -325,7 +325,6 @@ extern const struct language_data objc_language_data =
{
&exp_descriptor_standard,
objc_op_print_tab, /* Expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Objective-C language. */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 8f19f25..38dc73d 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1008,7 +1008,6 @@ extern const struct language_data opencl_language_data =
{
&exp_descriptor_opencl,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the OpenCL language. */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index aa2b9fc..6dd0b98 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -254,7 +254,6 @@ extern const struct language_data pascal_language_data =
{
&exp_descriptor_standard,
pascal_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Pascal language. */
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 2c82ddb..96abca1 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1903,7 +1903,6 @@ extern const struct language_data rust_language_data =
{
&exp_descriptor_rust,
c_op_print_tab, /* expression operators for printing */
- &default_varobj_ops,
};
/* Class representing the Rust language. */
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 3358be4..85530e3 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -386,7 +386,7 @@ varobj_create (const char *objname,
}
/* Set language info */
- var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
+ var->root->lang_ops = var->root->exp->language_defn->varobj_ops ();
install_new_value (var.get (), value, 1 /* Initial assignment */);
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 3e6abaa..7831e76 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -233,8 +233,6 @@ extern const struct lang_varobj_ops c_varobj_ops;
extern const struct lang_varobj_ops cplus_varobj_ops;
extern const struct lang_varobj_ops ada_varobj_ops;
-#define default_varobj_ops c_varobj_ops
-
/* Non-zero if we want to see trace of varobj level stuff. */
extern unsigned int varobjdebug;