aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.rust/simple.rs
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-03-29 11:49:59 -0600
committerTom Tromey <tom@tromey.com>2018-04-17 13:37:44 -0600
commita037790ec570ae9f9bf535cbce25f238f90e8b4a (patch)
tree2c5232fd4fc9b0e6ce9f39a7696f9b46a42ab6c9 /gdb/testsuite/gdb.rust/simple.rs
parentc7dcbf88c6557f35d9e75ae6223a3e61e1f70578 (diff)
downloadbinutils-a037790ec570ae9f9bf535cbce25f238f90e8b4a.zip
binutils-a037790ec570ae9f9bf535cbce25f238f90e8b4a.tar.gz
binutils-a037790ec570ae9f9bf535cbce25f238f90e8b4a.tar.bz2
Fix crash in quirk_rust_enum
I noticed that quirk_rust_enum can crash when presented with a union whose fields are all scalar types. This patch adds a new test case and fixes the bug. Regression tested on Fedora 26 x86-64. 2018-04-17 Tom Tromey <tom@tromey.com> * dwarf2read.c (quirk_rust_enum): Handle unions correctly. 2018-04-17 Tom Tromey <tom@tromey.com> * gdb.rust/simple.rs (Union): New type. (main): New local "u". * gdb.rust/simple.exp (test_one_slice): Add new test case.
Diffstat (limited to 'gdb/testsuite/gdb.rust/simple.rs')
-rw-r--r--gdb/testsuite/gdb.rust/simple.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.rust/simple.rs b/gdb/testsuite/gdb.rust/simple.rs
index b2b5dfe..e5bbe52 100644
--- a/gdb/testsuite/gdb.rust/simple.rs
+++ b/gdb/testsuite/gdb.rust/simple.rs
@@ -80,6 +80,11 @@ struct ParametrizedStruct<T> {
value: T
}
+union Union {
+ f1: i8,
+ f2: u8,
+}
+
fn main () {
let a = ();
let b : [i32; 0] = [];
@@ -153,6 +158,8 @@ fn main () {
value: 0,
};
+ let u = Union { f2: 255 };
+
println!("{}, {}", x.0, x.1); // set breakpoint here
println!("{}", diff2(92, 45));
empty();