1 // min-lldb-version: 310
2 // ignore-gdb-version: 7.11.90 - 7.12.9
3 // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
7 // === GDB TESTS ===================================================================================
9 // gdb-command:set print union on
12 // gdb-command:print case1
13 // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = {x = 2088533116, y = 2088533116, z = 31868}}, {RUST$ENUM$DISR = Case1, [...]}}
14 // gdbr-check:$1 = struct_in_enum::Regular::Case1(0, struct_in_enum::Struct {x: 2088533116, y: 2088533116, z: 31868})
16 // gdb-command:print case2
17 // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 1229782938247303441, __2 = 4369}}
18 // gdbr-check:$2 = struct_in_enum::Regular::Case2(0, 1229782938247303441, 4369)
20 // gdb-command:print univariant
21 // gdbg-check:$3 = {{__0 = {x = 123, y = 456, z = 789}}}
22 // gdbr-check:$3 = struct_in_enum::Univariant::TheOnlyCase(struct_in_enum::Struct {x: 123, y: 456, z: 789})
25 // === LLDB TESTS ==================================================================================
29 // lldb-command:print case1
30 // lldb-check:[...]$0 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 })
31 // lldb-command:print case2
32 // lldb-check:[...]$1 = Case2(0, 1229782938247303441, 4369)
34 // lldb-command:print univariant
35 // lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 })
37 #![allow(unused_variables)]
38 #![feature(omit_gdb_pretty_printer_section)]
39 #![omit_gdb_pretty_printer_section]
41 use self::Regular::{Case1, Case2};
42 use self::Univariant::TheOnlyCase;
50 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
51 // the size of the discriminant value is machine dependent, this has be taken into account when
52 // datatype layout should be predictable as in this case.
64 // In order to avoid endianness trouble all of the following test values consist of a single
65 // repeated byte. This way each interpretation of the union should look the same, no matter if
66 // this is a big or little endian machine.
68 // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
69 // 0b01111100011111000111110001111100 = 2088533116
70 // 0b0111110001111100 = 31868
72 let case1 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 });
74 // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
75 // 0b00010001000100010001000100010001 = 286331153
76 // 0b0001000100010001 = 4369
78 let case2 = Case2(0, 1229782938247303441, 4369);
80 let univariant = TheOnlyCase(Struct { x: 123, y: 456, z: 789 });