diff options
author | Tom Tromey <tom@tromey.com> | 2020-08-05 09:52:55 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-08-05 09:52:55 -0600 |
commit | 57d02173a25465a5400fad3764568cefb8eae9ab (patch) | |
tree | bd831e59218b4bbbcd9cbd1c730d56233c00e577 /gdb/regcache.h | |
parent | e8a387fb5f91cdb9674f19703c0e7bfbaf895a84 (diff) | |
download | gdb-57d02173a25465a5400fad3764568cefb8eae9ab.zip gdb-57d02173a25465a5400fad3764568cefb8eae9ab.tar.gz gdb-57d02173a25465a5400fad3764568cefb8eae9ab.tar.bz2 |
Fix variant part regressions with older Rust compiler
Older Rust compilers used special field names, rather than DWARF
features, to express the variant parts of Rust enums. This is handled
in gdb through a quirk recognizer that rewrites the types.
Tom de Vries pointed out in PR rust/26197 that the variant part
rewrite regressed this code. This patch fixes the problems:
* Univariant enums were not handled properly. Now we simply call
alloc_rust_variant for these as well.
* There was an off-by-one error in the handling of ordinary enums.
* Ordinary enums should have the size of their member types reset to
match the size of the enclosing enum. (It's not clear to me if this
is truly necessary, but it placates a test, and this is just legacy
handling in any case.)
Tested with Rust 1.12.0, 1.14.0, 1.19.0, 1.36.0, and 1.45.0 on x86-64
Fedora 32. There were some unrelated failures with 1.14.0 and 1.19,0;
but considering that these are fairly old releases, I don't plan to
look into them unless someone complains.
Note that this patch will not fix all the issues in the PR. In that
PR, Tom is using a somewhat unusual build of Rust -- in particular it
uses an older (pre-DWARF variant part) LLVM with a newer Rust. I
believe this compiler doesn't correctly implement the old-style name
fallback; the details are in the bug.
gdb/ChangeLog
2020-08-05 Tom Tromey <tromey@adacore.com>
PR rust/26197:
* dwarf2/read.c (alloc_rust_variant): Handle univariant case.
(quirk_rust_enum): Call alloc_rust_variant for univariant case.
Fix off-by-one and type size errors in ordinary case.
Diffstat (limited to 'gdb/regcache.h')
0 files changed, 0 insertions, 0 deletions