+2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * 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.
+
2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_collect_symbol_completion_matches): Rename to
return string_printf ("<%s>", str);
}
-/* la_watch_location_expression for Ada. */
-
-static gdb::unique_xmalloc_ptr<char>
-ada_watch_location_expression (struct type *type, CORE_ADDR addr)
-{
- 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)));
-}
-
/* Assuming V points to an array of S objects, make sure that it contains at
least M objects, updating V and S as necessary. */
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
1, /* String lower bound */
- ada_watch_location_expression,
&ada_varobj_ops,
ada_is_string_type,
"(...)" /* la_struct_too_deep_ellipsis */
}
}
+ /* See language.h. */
+
+ gdb::unique_xmalloc_ptr<char> watch_location_expression
+ (struct type *type, CORE_ADDR addr) const override
+ {
+ 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)));
+ }
+
protected:
/* See language.h. */
CORE_ADDR addr = value_as_address (val.get ());
w->exp_string_reparse
- = current_language->la_watch_location_expression (t, addr).release ();
+ = current_language->watch_location_expression (t, addr).release ();
w->exp_string = xstrprintf ("-location %.*s",
(int) (exp_end - exp_start), exp_start);
return evaluate_subexp_standard (expect_type, exp, pos, noside);
}
\f
-/* la_watch_location_expression for C. */
-
-gdb::unique_xmalloc_ptr<char>
-c_watch_location_expression (struct type *type, CORE_ADDR addr)
-{
- 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)));
-}
-
/* See c-lang.h. */
bool
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&c_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&cplus_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
extern const struct op_print c_op_print_tab[];
-extern gdb::unique_xmalloc_ptr<char> c_watch_location_expression
- (struct type *type, CORE_ADDR addr);
-
/* These are in c-typeprint.c: */
extern void c_type_print_base (struct type *, struct ui_file *,
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
- c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
f_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
1, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
f_is_string_type_p,
"(...)" /* la_struct_too_deep_ellipsis */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
- c_watch_location_expression,
&default_varobj_ops,
go_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
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. */
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 */
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 */
/* Index to use for extracting the first element of a string. */
char string_lower_bound;
- /* Return an expression that can be used for a location
- watchpoint. TYPE is a pointer type that points to the memory
- to watch, and ADDR is the address of the watched memory. */
- gdb::unique_xmalloc_ptr<char> (*la_watch_location_expression)
- (struct type *type, CORE_ADDR addr);
-
/* Various operations on varobj. */
const struct lang_varobj_ops *la_varobj_ops;
(tracker, mode, name_match_type, text, word, "", code);
}
+ /* Return an expression that can be used for a location
+ watchpoint. TYPE is a pointer type that points to the memory
+ to watch, and ADDR is the address of the watched memory. */
+ virtual gdb::unique_xmalloc_ptr<char> watch_location_expression
+ (struct type *type, CORE_ADDR addr) const;
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
m2_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- c_watch_location_expression,
&default_varobj_ops,
pascal_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
\f
-/* la_watch_location_expression for Rust. */
-
-static gdb::unique_xmalloc_ptr<char>
-rust_watch_location_expression (struct type *type, CORE_ADDR addr)
-{
- type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type)));
- std::string name = type_to_string (type);
- return gdb::unique_xmalloc_ptr<char>
- (xstrprintf ("*(%s as *mut %s)", core_addr_to_string (addr),
- name.c_str ()));
-}
-
-\f
-
static const struct exp_descriptor exp_descriptor_rust =
{
rust_print_subexp,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- rust_watch_location_expression,
&default_varobj_ops,
rust_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
rust_internal_print_type (type, varstring, stream, show, level,
flags, false, &podata);
}
+
+ /* See language.h. */
+
+ gdb::unique_xmalloc_ptr<char> watch_location_expression
+ (struct type *type, CORE_ADDR addr) const override
+ {
+ type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type)));
+ std::string name = type_to_string (type);
+ return gdb::unique_xmalloc_ptr<char>
+ (xstrprintf ("*(%s as *mut %s)", core_addr_to_string (addr),
+ name.c_str ()));
+ }
};
/* Single instance of the Rust language class. */