diff options
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r-- | gdb/rust-lang.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 898edda..dce184c 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2122,6 +2122,20 @@ rust_sniff_from_mangled_name (const char *mangled, char **demangled) +/* 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, @@ -2176,6 +2190,7 @@ static const struct language_defn rust_language_defn = default_print_array_index, default_pass_by_reference, c_get_string, + rust_watch_location_expression, NULL, /* la_get_symbol_name_cmp */ iterate_over_symbols, &default_varobj_ops, |