diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-01 15:06:43 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-17 09:25:11 +0100 |
commit | f16a9f57b50af64ccb9652d20cc934fc5e80cd20 (patch) | |
tree | 95552dfa5130729f03508ec0ee10235ea1c1113f /gdb/language.c | |
parent | 7e56227dfffddbbb5b648c386c85345929fa0529 (diff) | |
download | gdb-f16a9f57b50af64ccb9652d20cc934fc5e80cd20.zip gdb-f16a9f57b50af64ccb9652d20cc934fc5e80cd20.tar.gz gdb-f16a9f57b50af64ccb9652d20cc934fc5e80cd20.tar.bz2 |
gdb: Convert language la_watch_location_expression field to a method
This commit changes the language_data::la_watch_location_expression
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_watch_location_expression): Rename to
ada_language::watch_location_expression.
(ada_language_data): Delete la_watch_location_expression
initializer.
(ada_language::watch_location_expression): New member function,
implementation from ada_watch_location_expression.
* breakpoint.c (watch_command_1): Update call to
watch_location_expression.
* c-lang.c (c_watch_location_expression): Rename to
language_defn::watch_location_expression.
(c_language_data): Delete la_watch_location_expression
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* c-lang.h (c_watch_location_expression): Delete declaration.
* d-lang.c (d_language_data): Delete la_watch_location_expression
initializer.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (language_defn::watch_location_expression): Member
function implementation from c_watch_location_expression.
(unknown_language_data): Delete la_watch_location_expression
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_watch_location_expression
field.
(language_defn::watch_location_expression): Declare new member
function.
* m2-lang.c (m2_language_data): Delete
la_watch_location_expression 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_watch_location_expression): Rename to
rust_language::watch_location_expression.
(rust_language_data): Delete la_watch_location_expression
initializer.
(rust_language::watch_location_expression): New member function,
implementation from rust_watch_location_expression.
Diffstat (limited to 'gdb/language.c')
-rw-r--r-- | gdb/language.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gdb/language.c b/gdb/language.c index f4e99fc..6320577 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -622,6 +622,19 @@ language_defn::print_array_index (struct type *index_type, LONGEST index, fprintf_filtered (stream, "] = "); } +/* See language.h. */ + +gdb::unique_xmalloc_ptr<char> +language_defn::watch_location_expression (struct type *type, + CORE_ADDR addr) const +{ + /* Generates an expression that assumes a C like syntax is valid. */ + type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type))); + std::string name = type_to_string (type); + return gdb::unique_xmalloc_ptr<char> + (xstrprintf ("* (%s *) %s", name.c_str (), core_addr_to_string (addr))); +} + /* The default implementation of the get_symbol_name_matcher_inner method from the language_defn class. Matches with strncmp_iw. */ @@ -779,7 +792,6 @@ extern const struct language_data unknown_language_data = unk_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ 0, /* String lower bound */ - c_watch_location_expression, &default_varobj_ops, default_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ @@ -850,7 +862,6 @@ extern const struct language_data auto_language_data = unk_op_print_tab, /* expression operators for printing */ 1, /* c-style arrays */ 0, /* String lower bound */ - c_watch_location_expression, &default_varobj_ops, default_is_string_type_p, "{...}" /* la_struct_too_deep_ellipsis */ |