diff options
author | Tom Tromey <tom@tromey.com> | 2021-05-14 19:54:35 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-05-14 20:01:12 -0600 |
commit | 887e71588b295a4d4f4bd7480b1a8c8507dfddb8 (patch) | |
tree | 7a40b0b55efa561569dd468ca7a45453e1faadc8 /gdb/rust-lang.c | |
parent | 2fbe9507bfba58a6a000d231fe735bad1f245b55 (diff) | |
download | gdb-887e71588b295a4d4f4bd7480b1a8c8507dfddb8.zip gdb-887e71588b295a4d4f4bd7480b1a8c8507dfddb8.tar.gz gdb-887e71588b295a4d4f4bd7480b1a8c8507dfddb8.tar.bz2 |
Fix Python pretty-printing bug in Rust
An upstream Rust bug notes notes that the Python pretty-printing
feature is broken for values that appear as members of certain types
in Rust.
The bug here is that some of the Rust value-printing code calls
value_print_inner, a method on rust_language. This bypasses the
common code that calls into Python.
I'm checking this in.
gdb/ChangeLog
2021-05-14 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_language::val_print_struct)
(rust_language::print_enum): Use common_val_print, not
value_print_inner.
gdb/testsuite/ChangeLog
2021-05-14 Tom Tromey <tom@tromey.com>
* gdb.rust/pp.exp: New file.
* gdb.rust/pp.py: New file.
* gdb.rust/pp.rs: New file.
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r-- | gdb/rust-lang.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 8c4d209..3b15bb2 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -386,7 +386,8 @@ rust_language::val_print_struct fputs_filtered (": ", stream); } - value_print_inner (value_field (val, i), stream, recurse + 1, &opts); + common_val_print (value_field (val, i), stream, recurse + 1, &opts, + this); } if (options->prettyformat) @@ -464,7 +465,8 @@ rust_language::print_enum (struct value *val, struct ui_file *stream, styled_string (variable_name_style.style (), TYPE_FIELD_NAME (variant_type, j))); - value_print_inner (value_field (val, j), stream, recurse + 1, &opts); + common_val_print (value_field (val, j), stream, recurse + 1, &opts, + this); } if (is_tuple) |