aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-05-01 17:33:22 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-02 13:53:10 +0100
commit15e5fd35569d555ca53f074c571d4a3d06da67b0 (patch)
tree49ec3f10077bb48996a59c472b36f87660caf3f6 /gdb/findvar.c
parent5bd40f2a3feb273e92b640544f6e5307c8124d90 (diff)
downloadgdb-15e5fd35569d555ca53f074c571d4a3d06da67b0.zip
gdb-15e5fd35569d555ca53f074c571d4a3d06da67b0.tar.gz
gdb-15e5fd35569d555ca53f074c571d4a3d06da67b0.tar.bz2
gdb: Convert language la_read_var_value field to a method
This commit changes the language_data::la_read_var_value function pointer member variable into a member function of language_defn. An interesting aspect of this change is that the implementation of language_defn::read_var_value is actually in findvar.c. This is partly historical, the new language_defn::read_var_value is a rename of default_read_var_value, which was already in that file, but also, that is the file that contains the helper functions needed by the read_var_value method, so it makes sens that the method implementation should continue to live there (I think). There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_read_var_value): Delete function, move implementation to... (ada_language::read_var_value): ...here. (ada_language_data): Delete la_read_var_value initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * findvar.c (default_read_var_value): Rename to... (language_defn::read_var_value): ...this. * findvar.c (read_var_value): Update header comment, and change to call member function instead of function pointer. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Delete la_read_var_value initializer. (auto_language_data): Likewise. * language.h (struct language_data): Delete la_read_var_value field. (language_defn::read_var_value): New member function. (default_read_var_value): Delete declaration. * m2-lang.c (m2_language_data): Delete la_read_var_value 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. * value.h (default_read_var_value): Delete declaration.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 40cbe8b..c7cd31c 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -578,12 +578,12 @@ get_hosting_frame (struct symbol *var, const struct block *var_block,
return frame;
}
-/* A default implementation for the "la_read_var_value" hook in
- the language vector which should work in most situations. */
+/* See language.h. */
struct value *
-default_read_var_value (struct symbol *var, const struct block *var_block,
- struct frame_info *frame)
+language_defn::read_var_value (struct symbol *var,
+ const struct block *var_block,
+ struct frame_info *frame) const
{
struct value *v;
struct type *type = SYMBOL_TYPE (var);
@@ -801,7 +801,7 @@ default_read_var_value (struct symbol *var, const struct block *var_block,
return v;
}
-/* Calls VAR's language la_read_var_value hook with the given arguments. */
+/* Calls VAR's language read_var_value hook with the given arguments. */
struct value *
read_var_value (struct symbol *var, const struct block *var_block,
@@ -810,9 +810,8 @@ read_var_value (struct symbol *var, const struct block *var_block,
const struct language_defn *lang = language_def (var->language ());
gdb_assert (lang != NULL);
- gdb_assert (lang->la_read_var_value != NULL);
- return lang->la_read_var_value (var, var_block, frame);
+ return lang->read_var_value (var, var_block, frame);
}
/* Install default attributes for register values. */