diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-01 11:07:52 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-17 09:25:09 +0100 |
commit | 9a49ad8c522a1ce83645d477bf6ced574c3bf651 (patch) | |
tree | d7094bdb142f991e9147938c8ea7553b62fcab49 | |
parent | eff93b4d48eb0e79b7879475bb47eec55dbb41be (diff) | |
download | binutils-9a49ad8c522a1ce83645d477bf6ced574c3bf651.zip binutils-9a49ad8c522a1ce83645d477bf6ced574c3bf651.tar.gz binutils-9a49ad8c522a1ce83645d477bf6ced574c3bf651.tar.bz2 |
gdb: Convert language la_compute_program field to a method
This commit changes the language_data::la_compute_program 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_compute_program
initializer.
* c-lang.c (c_language_data): Likewise.
(c_language::compute_program): New member function.
(cplus_language_data): Delete la_compute_program initializer.
(cplus_language::compute_program): New member function.
(asm_language_data): Delete la_compute_program initializer.
(minimal_language_data): Likewise.
* c-lang.h (c_compute_program): Update comment.
(cplus_compute_program): Likewise.
* compile/compile-c-support.c (c_compute_program): Likewise.
(cplus_compute_program): Likewise.
* compile/compile.c (compile_to_object): Update call to
la_compute_program.
* d-lang.c (d_language_data): Delete la_compute_program
initializer.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_compute_program field.
(language_defn::compute_program): New member function.
* m2-lang.c (m2_language_data): Delete la_compute_program
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/ChangeLog | 31 | ||||
-rw-r--r-- | gdb/ada-lang.c | 1 | ||||
-rw-r--r-- | gdb/c-lang.c | 24 | ||||
-rw-r--r-- | gdb/c-lang.h | 4 | ||||
-rw-r--r-- | gdb/compile/compile-c-support.c | 4 | ||||
-rw-r--r-- | gdb/compile/compile.c | 4 | ||||
-rw-r--r-- | gdb/d-lang.c | 1 | ||||
-rw-r--r-- | gdb/f-lang.c | 1 | ||||
-rw-r--r-- | gdb/go-lang.c | 1 | ||||
-rw-r--r-- | gdb/language.c | 2 | ||||
-rw-r--r-- | gdb/language.h | 42 | ||||
-rw-r--r-- | gdb/m2-lang.c | 1 | ||||
-rw-r--r-- | gdb/objc-lang.c | 1 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 1 | ||||
-rw-r--r-- | gdb/p-lang.c | 1 | ||||
-rw-r--r-- | gdb/rust-lang.c | 1 |
16 files changed, 79 insertions, 41 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2aafc0a..ae93dd6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,36 @@ 2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com> + * ada-lang.c (ada_language_data): Delete la_compute_program + initializer. + * c-lang.c (c_language_data): Likewise. + (c_language::compute_program): New member function. + (cplus_language_data): Delete la_compute_program initializer. + (cplus_language::compute_program): New member function. + (asm_language_data): Delete la_compute_program initializer. + (minimal_language_data): Likewise. + * c-lang.h (c_compute_program): Update comment. + (cplus_compute_program): Likewise. + * compile/compile-c-support.c (c_compute_program): Likewise. + (cplus_compute_program): Likewise. + * compile/compile.c (compile_to_object): Update call to + la_compute_program. + * d-lang.c (d_language_data): Delete la_compute_program + initializer. + * f-lang.c (f_language_data): Likewise. + * go-lang.c (go_language_data): Likewise. + * language.c (unknown_language_data): Likewise. + (auto_language_data): Likewise. + * language.h (language_data): Delete la_compute_program field. + (language_defn::compute_program): New member function. + * m2-lang.c (m2_language_data): Delete la_compute_program + 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-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. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 96cb865..5caa171 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13922,7 +13922,6 @@ extern const struct language_data ada_language_data = ada_watch_location_expression, ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */ &ada_varobj_ops, - NULL, ada_is_string_type, "(...)" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/c-lang.c b/gdb/c-lang.c index bb49706..9d72c0e 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -919,7 +919,6 @@ extern const struct language_data c_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &c_varobj_ops, - c_compute_program, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; @@ -947,6 +946,16 @@ public: } /* See language.h. */ + std::string compute_program (compile_instance *inst, + const char *input, + struct gdbarch *gdbarch, + const struct block *expr_block, + CORE_ADDR expr_pc) const override + { + return c_compute_program (inst, input, gdbarch, expr_block, expr_pc); + } + + /* See language.h. */ void print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, @@ -1025,7 +1034,6 @@ extern const struct language_data cplus_language_data = c_watch_location_expression, cp_get_symbol_name_matcher, &cplus_varobj_ops, - cplus_compute_program, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; @@ -1123,6 +1131,16 @@ public: } /* See language.h. */ + std::string compute_program (compile_instance *inst, + const char *input, + struct gdbarch *gdbarch, + const struct block *expr_block, + CORE_ADDR expr_pc) const override + { + return cplus_compute_program (inst, input, gdbarch, expr_block, expr_pc); + } + + /* See language.h. */ unsigned int search_name_hash (const char *name) const override { return cp_search_name_hash (name); @@ -1209,7 +1227,6 @@ extern const struct language_data asm_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; @@ -1280,7 +1297,6 @@ extern const struct language_data minimal_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/c-lang.h b/gdb/c-lang.h index 3e07dc9..31ec6f2 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -172,7 +172,7 @@ extern compile_instance *cplus_get_compile_context (); /* This takes the user-supplied text and returns a new bit of code to compile. - This is used as the la_compute_program language method; see that + This is used as the compute_program language method; see that for a description of the arguments. */ extern std::string c_compute_program (compile_instance *inst, @@ -183,7 +183,7 @@ extern std::string c_compute_program (compile_instance *inst, /* This takes the user-supplied text and returns a new bit of code to compile. - This is used as the la_compute_program language method; see that + This is used as the compute_program language method; see that for a description of the arguments. */ extern std::string cplus_compute_program (compile_instance *inst, diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c index 8499300..5e4da67 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -660,7 +660,7 @@ typedef compile_program<compile_cplus_instance, cplus_add_code_header, c_add_code_footer, cplus_add_input> cplus_compile_program; -/* The la_compute_program method for C. */ +/* The compute_program method for C. */ std::string c_compute_program (compile_instance *inst, @@ -675,7 +675,7 @@ c_compute_program (compile_instance *inst, return program.compute (input, expr_block, expr_pc); } -/* The la_compute_program method for C++. */ +/* The compute_program method for C++. */ std::string cplus_compute_program (compile_instance *inst, diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index 3a3afa8..0c29a04 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -724,8 +724,8 @@ compile_to_object (struct command_line *cmd, const char *cmd_string, error (_("Neither a simple expression, or a multi-line specified.")); std::string code - = current_language->la_compute_program (compiler.get (), input, gdbarch, - expr_block, expr_pc); + = current_language->compute_program (compiler.get (), input, gdbarch, + expr_block, expr_pc); if (compile_debug) fprintf_unfiltered (gdb_stdlog, "debug output:\n\n%s", code.c_str ()); diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 6dacf8c..ad16f99 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -162,7 +162,6 @@ extern const struct language_data d_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 07ee2c8..d748db8 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -622,7 +622,6 @@ extern const struct language_data f_language_data = c_watch_location_expression, cp_get_symbol_name_matcher, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, f_is_string_type_p, "(...)" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 7b8d4a5..9196cd3 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -547,7 +547,6 @@ extern const struct language_data go_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, go_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/language.c b/gdb/language.c index ade5109..2b2584f 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -776,7 +776,6 @@ extern const struct language_data unknown_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, default_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; @@ -851,7 +850,6 @@ extern const struct language_data auto_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, default_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/language.h b/gdb/language.h index 36fc2c5..523a7a9 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -354,26 +354,6 @@ struct language_data /* Various operations on varobj. */ const struct lang_varobj_ops *la_varobj_ops; - /* This method must be defined if 'la_get_gcc_context' is defined. - If 'la_get_gcc_context' is not defined, then this method is - ignored. - - This takes the user-supplied text and returns a new bit of code - to compile. - - INST is the compiler instance being used. - INPUT is the user's input text. - GDBARCH is the architecture to use. - EXPR_BLOCK is the block in which the expression is being - parsed. - EXPR_PC is the PC at which the expression is being parsed. */ - - std::string (*la_compute_program) (compile_instance *inst, - const char *input, - struct gdbarch *gdbarch, - const struct block *expr_block, - CORE_ADDR expr_pc); - /* Return true if TYPE is a string type. */ bool (*la_is_string_type_p) (struct type *type); @@ -476,6 +456,28 @@ struct language_defn : language_data return nullptr; } + /* This method must be overridden if 'get_compile_instance' is + overridden. + + This takes the user-supplied text and returns a new bit of code + to compile. + + INST is the compiler instance being used. + INPUT is the user's input text. + GDBARCH is the architecture to use. + EXPR_BLOCK is the block in which the expression is being + parsed. + EXPR_PC is the PC at which the expression is being parsed. */ + + virtual std::string compute_program (compile_instance *inst, + const char *input, + struct gdbarch *gdbarch, + const struct block *expr_block, + CORE_ADDR expr_pc) const + { + gdb_assert_not_reached ("language_defn::compute_program"); + } + /* Hash the given symbol search name. */ virtual unsigned int search_name_hash (const char *name) const; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 6cb3f7d..87bf1eb 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -381,7 +381,6 @@ extern const struct language_data m2_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, m2_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 631b205..8b23c55 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -356,7 +356,6 @@ extern const struct language_data objc_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index ab19acf..00f88c6 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1035,7 +1035,6 @@ extern const struct language_data opencl_language_data = c_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, c_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 2f77d7a..869c89e 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -412,7 +412,6 @@ extern const struct language_data pascal_language_data = c_watch_location_expression, NULL, /* la_compare_symbol_for_completion */ &default_varobj_ops, - NULL, pascal_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index ada721f..296bfe1 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2067,7 +2067,6 @@ extern const struct language_data rust_language_data = rust_watch_location_expression, NULL, /* la_get_symbol_name_matcher */ &default_varobj_ops, - NULL, rust_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ }; |