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