mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
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.
This commit is contained in:
@ -2006,20 +2006,6 @@ rust_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||
|
||||
|
||||
|
||||
/* 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 ()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const struct exp_descriptor exp_descriptor_rust =
|
||||
{
|
||||
rust_print_subexp,
|
||||
@ -2062,7 +2048,6 @@ extern const struct language_data rust_language_data =
|
||||
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 */
|
||||
@ -2143,6 +2128,18 @@ public:
|
||||
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. */
|
||||
|
Reference in New Issue
Block a user