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.
+2018-04-17 Tom Tromey <tom@tromey.com>
+
+ * dwarf2read.c (quirk_rust_enum): Handle unions correctly.
+
2018-04-17 Andreas Arnez <arnez@linux.vnet.ibm.com>
* symtab.c (print_symbol_info): Skip printing filename and line
2018-04-17 Andreas Arnez <arnez@linux.vnet.ibm.com>
* symtab.c (print_symbol_info): Skip printing filename and line
{
disr_type = TYPE_FIELD_TYPE (type, i);
{
disr_type = TYPE_FIELD_TYPE (type, i);
- if (TYPE_NFIELDS (disr_type) == 0)
+ if (TYPE_CODE (disr_type) != TYPE_CODE_STRUCT)
+ {
+ /* All fields of a true enum will be structs. */
+ return;
+ }
+ else if (TYPE_NFIELDS (disr_type) == 0)
{
/* Could be data-less variant, so keep going. */
{
/* Could be data-less variant, so keep going. */
}
else if (strcmp (TYPE_FIELD_NAME (disr_type, 0),
"RUST$ENUM$DISR") != 0)
}
else if (strcmp (TYPE_FIELD_NAME (disr_type, 0),
"RUST$ENUM$DISR") != 0)
+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.
+
2018-04-16 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.base/dbx.exp (test_whereis): Adjust regexp to added line
2018-04-16 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.base/dbx.exp (test_whereis): Adjust regexp to added line
gdb_test "print parametrized" \
" = simple::ParametrizedStruct<i32> \\{next: simple::ParametrizedEnum<\[a-z:\]*Box<simple::ParametrizedStruct<i32>>>::Val\\{val: $hex\\}, value: 0\\}"
gdb_test "print parametrized" \
" = simple::ParametrizedStruct<i32> \\{next: simple::ParametrizedEnum<\[a-z:\]*Box<simple::ParametrizedStruct<i32>>>::Val\\{val: $hex\\}, value: 0\\}"
+gdb_test "print u" " = simple::Union {f1: -1, f2: 255}"
load_lib gdb-python.exp
if {[skip_python_tests]} {
load_lib gdb-python.exp
if {[skip_python_tests]} {
+union Union {
+ f1: i8,
+ f2: u8,
+}
+
fn main () {
let a = ();
let b : [i32; 0] = [];
fn main () {
let a = ();
let b : [i32; 0] = [];
+ let u = Union { f2: 255 };
+
println!("{}, {}", x.0, x.1); // set breakpoint here
println!("{}", diff2(92, 45));
empty();
println!("{}, {}", x.0, x.1); // set breakpoint here
println!("{}", diff2(92, 45));
empty();