diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index d4a221abb08..bf8dba99ecd 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -624,6 +624,27 @@ rust_language::value_print_inner } } +/* See language.h. */ + +void +rust_language::value_print + (struct value *val, struct ui_file *stream, + const struct value_print_options *options) const +{ + value_print_options opts = *options; + opts.deref_ref = true; + + struct type *type = check_typedef (value_type (val)); + if (type->is_pointer_or_reference ()) + { + gdb_printf (stream, "("); + type_print (value_type (val), "", stream, -1); + gdb_printf (stream, ") "); + } + + return common_val_print (val, stream, 0, &opts, this); +} + static void diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h index 0e89b8822cb..514494a2c82 100644 --- a/gdb/rust-lang.h +++ b/gdb/rust-lang.h @@ -125,6 +125,11 @@ public: /* See language.h. */ + void value_print (struct value *val, struct ui_file *stream, + const struct value_print_options *options) const override; + + /* See language.h. */ + struct block_symbol lookup_symbol_nonlocal (const char *name, const struct block *block, const domain_enum domain) const override