diff options
author | Tom Tromey <tom@tromey.com> | 2019-10-03 17:21:52 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-10-03 20:56:22 -0600 |
commit | 77c2dba3e843694fae090e237ccdf1b8f65b94e6 (patch) | |
tree | 8076f2237aa8155c67f4adbad3c5e40317969d0d /sim/m32c/main.c | |
parent | f0e21cb80940c065dcc373c29dc33388cf948dbc (diff) | |
download | gdb-77c2dba3e843694fae090e237ccdf1b8f65b94e6.zip gdb-77c2dba3e843694fae090e237ccdf1b8f65b94e6.tar.gz gdb-77c2dba3e843694fae090e237ccdf1b8f65b94e6.tar.bz2 |
Avoid crash on single-field union in Rust
PR rust/24976 points out a crash in gdb when a single-field union is
used in Rust.
The immediate problem was a NULL pointer dereference in
quirk_rust_enum. However, that code is also erroneously treating a
single-field union as if it were a univariant enum. Looking at the
output of an older Rust compiler, it turns out that univariant enums
are distinguished by having a single *anonymous* field. This patch
changes quirk_rust_enum to limit its fixup to this case.
Tested with a new-enough version of the Rust compiler to cause the
crash; plus by using an older executable that uses the old univariant
encoding.
gdb/ChangeLog
2019-10-03 Tom Tromey <tom@tromey.com>
PR rust/24976:
* dwarf2read.c (quirk_rust_enum): Handle single-element unions.
gdb/testsuite/ChangeLog
2019-10-03 Tom Tromey <tom@tromey.com>
PR rust/24976:
* gdb.rust/simple.rs (Union2): New type.
(main): Use Union2.
* gdb.rust/simple.exp: Add test.
Diffstat (limited to 'sim/m32c/main.c')
0 files changed, 0 insertions, 0 deletions