+2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * 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.
+
2020-06-02 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_print_array_index): Delete function, move
}
}
-/* Implement the "la_read_var_value" language_defn method for Ada. */
-
-static struct value *
-ada_read_var_value (struct symbol *var, const struct block *var_block,
- struct frame_info *frame)
-{
- /* The only case where default_read_var_value is not sufficient
- is when VAR is a renaming... */
- if (frame != nullptr)
- {
- const struct block *frame_block = get_frame_block (frame, NULL);
- if (frame_block != nullptr && ada_is_renaming_symbol (var))
- return ada_read_renaming_var_value (var, frame_block);
- }
-
- /* This is a typical case where we expect the default_read_var_value
- function to work. */
- return default_read_var_value (var, var_block, frame);
-}
-
static const char *ada_extensions[] =
{
".adb", ".ads", ".a", ".ada", ".dg", NULL
ada_print_typedef, /* Print a typedef using appropriate syntax */
ada_value_print_inner, /* la_value_print_inner */
ada_value_print, /* Print a top-level value */
- ada_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
LA_VALUE_PRINT (index_value, stream, options);
fprintf_filtered (stream, " => ");
}
+
+ /* Implement the "read_var_value" language_defn method for Ada. */
+
+ struct value *read_var_value (struct symbol *var,
+ const struct block *var_block,
+ struct frame_info *frame) const override
+ {
+ /* The only case where default_read_var_value is not sufficient
+ is when VAR is a renaming... */
+ if (frame != nullptr)
+ {
+ const struct block *frame_block = get_frame_block (frame, NULL);
+ if (frame_block != nullptr && ada_is_renaming_symbol (var))
+ return ada_read_renaming_var_value (var, frame_block);
+ }
+
+ /* This is a typical case where we expect the default_read_var_value
+ function to work. */
+ return language_defn::read_var_value (var, var_block, frame);
+ }
};
/* Single instance of the Ada language class. */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
cplus_skip_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
true, /* la_store_sym_names_in_linkage_form_p */
syntax. */
d_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline. */
"this",
false, /* la_store_sym_names_in_linkage_form_p */
f_print_typedef, /* Print a typedef using appropriate syntax */
f_value_print_innner, /* la_value_print_inner */
c_value_print, /* FIXME */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
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);
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,
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. */
syntax. */
go_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline. */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
default_print_typedef, /* Print a typedef using appropriate syntax */
unk_lang_value_print_inner, /* la_value_print_inner */
unk_lang_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
unk_lang_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
true, /* store_sym_names_in_linkage_form_p */
default_print_typedef, /* Print a typedef using appropriate syntax */
unk_lang_value_print_inner, /* la_value_print_inner */
unk_lang_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
unk_lang_trampoline, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* store_sym_names_in_linkage_form_p */
void (*la_value_print) (struct value *, struct ui_file *,
const struct value_print_options *);
- /* Given a symbol VAR, the corresponding block VAR_BLOCK (if any) and a
- stack frame id FRAME, read the value of the variable and return (pointer
- to a) struct value containing the value.
-
- VAR_BLOCK is needed if there's a possibility for VAR to be outside
- FRAME. This is what happens if FRAME correspond to a nested function
- and VAR is defined in the outer function. If callers know that VAR is
- located in FRAME or is global/static, NULL can be passed as VAR_BLOCK.
-
- Throw an error if the variable cannot be found. */
-
- struct value *(*la_read_var_value) (struct symbol *var,
- const struct block *var_block,
- struct frame_info *frame);
-
/* PC is possibly an unknown languages trampoline.
If that PC falls in a trampoline belonging to this language,
return the address of the first pc in the real function, or 0
struct ui_file *stream,
const value_print_options *options) const;
+ /* Given a symbol VAR, the corresponding block VAR_BLOCK (if any) and a
+ stack frame id FRAME, read the value of the variable and return (pointer
+ to a) struct value containing the value.
+
+ VAR_BLOCK is needed if there's a possibility for VAR to be outside
+ FRAME. This is what happens if FRAME correspond to a nested function
+ and VAR is defined in the outer function. If callers know that VAR is
+ located in FRAME or is global/static, NULL can be passed as VAR_BLOCK.
+
+ Throw an error if the variable cannot be found. */
+
+ virtual struct value *read_var_value (struct symbol *var,
+ const struct block *var_block,
+ struct frame_info *frame) const;
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
m2_print_typedef, /* Print a typedef using appropriate syntax */
m2_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
objc_skip_trampoline, /* Language specific skip_trampoline */
"self", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
c_print_typedef, /* Print a typedef using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
pascal_print_typedef, /* Print a typedef using appropriate syntax */
pascal_value_print_inner, /* la_value_print_inner */
pascal_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
"this", /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
rust_print_typedef, /* Print a typedef using appropriate syntax */
rust_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
- default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
NULL, /* name_of_this */
false, /* la_store_sym_names_in_linkage_form_p */
const struct block *var_block,
struct frame_info *frame);
-extern struct value *default_read_var_value (struct symbol *var,
- const struct block *var_block,
- struct frame_info *frame);
-
extern struct value *allocate_value (struct type *type);
extern struct value *allocate_value_lazy (struct type *type);
extern void value_contents_copy (struct value *dst, LONGEST dst_offset,