1 // ignore-tidy-linelength
3 // Require a gdb or lldb that can read DW_TAG_variant_part.
4 // min-gdb-version: 8.2
9 // === GDB TESTS ===================================================================================
13 // gdb-command:print *the_a_ref
14 // gdbr-check:$1 = borrowed_enum::ABC::TheA{x: 0, y: 8970181431921507452}
16 // gdb-command:print *the_b_ref
17 // gdbr-check:$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153)
19 // gdb-command:print *univariant_ref
20 // gdbr-check:$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434)
23 // === LLDB TESTS ==================================================================================
27 // lldb-command:print *the_a_ref
28 // lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { TheA: 0, TheB: 8970181431921507452 }
29 // lldb-command:print *the_b_ref
30 // lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 }
31 // lldb-command:print *univariant_ref
32 // lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { = 4820353753753434 } }
34 #![allow(unused_variables)]
35 #![feature(omit_gdb_pretty_printer_section)]
36 #![omit_gdb_pretty_printer_section]
38 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
39 // the size of the discriminant value is machine dependent, this has be taken into account when
40 // datatype layout should be predictable as in this case.
42 TheA { x: i64, y: i64 },
46 // This is a special case since it does not have the implicit discriminant field.
53 // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
54 // 0b01111100011111000111110001111100 = 2088533116
55 // 0b0111110001111100 = 31868
57 let the_a = ABC::TheA { x: 0, y: 8970181431921507452 };
58 let the_a_ref: &ABC = &the_a;
60 // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
61 // 0b00010001000100010001000100010001 = 286331153
62 // 0b0001000100010001 = 4369
64 let the_b = ABC::TheB (0, 286331153, 286331153);
65 let the_b_ref: &ABC = &the_b;
67 let univariant = Univariant::TheOnlyCase(4820353753753434);
68 let univariant_ref: &Univariant = &univariant;