diff options
author | Doug Evans <dje@google.com> | 2020-02-19 13:54:59 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-02-19 13:59:31 -0700 |
commit | 084104828cba3e80b19a4bad9538d32991312d7a (patch) | |
tree | 39bf9f0d465051e66917d5d5884b3f29031263d1 /gdb/rust-lang.c | |
parent | 623563f79db9c2d576303565f8ba1415c911c452 (diff) | |
download | binutils-084104828cba3e80b19a4bad9538d32991312d7a.zip binutils-084104828cba3e80b19a4bad9538d32991312d7a.tar.gz binutils-084104828cba3e80b19a4bad9538d32991312d7a.tar.bz2 |
rust/25535 Apply embedded offset to enum variant calculation
Hopefully straightforward (and I didn't miss anything ...).
gdb/ChangeLog
2020-02-19 Doug Evans <dje@google.com>
PR rust/25535
* rust-lang.c (rust_print_enum): Apply embedded_offset to
rust_enum_variant calculation.
gdb/testsuite/ChangeLog
2020-02-19 Doug Evans <dje@google.com>
PR rust/25535
* gdb.rust/simple.exp: Add test.
* gdb.rust/simple.rs: Add test.
Diffstat (limited to 'gdb/rust-lang.c')
-rw-r--r-- | gdb/rust-lang.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 9123bf2..18dc6a5 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -481,7 +481,8 @@ rust_print_enum (struct type *type, int embedded_offset, } const gdb_byte *valaddr = value_contents_for_printing (val); - struct field *variant_field = rust_enum_variant (type, valaddr); + struct field *variant_field = rust_enum_variant (type, + valaddr + embedded_offset); embedded_offset += FIELD_BITPOS (*variant_field) / 8; struct type *variant_type = FIELD_TYPE (*variant_field); |