Use watchpoint's language when re-parsing expression
[deliverable/binutils-gdb.git] / gdb / rust-lang.c
index 898eddaba24ad53184abaf20be4df72ce873aec2..dce184ced0ebb2ed052c2f5616d0a5800901e27b 100644 (file)
@@ -2122,6 +2122,20 @@ rust_sniff_from_mangled_name (const char *mangled, char **demangled)
 
 \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,
@@ -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,
This page took 0.030424 seconds and 4 git commands to generate.