]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/enum-thinlto.rs
Rollup merge of #107700 - jyn514:tools-builder, r=Mark-Simulacrum
[rust.git] / tests / debuginfo / enum-thinlto.rs
1 // Require a gdb that can read DW_TAG_variant_part.
2 // min-gdb-version: 8.2
3
4 // compile-flags:-g -Z thinlto
5
6 // === GDB TESTS ===================================================================================
7
8 // gdb-command:run
9
10 // gdb-command:print *abc
11 // gdbr-check:$1 = enum_thinlto::ABC::TheA{x: 0, y: 8970181431921507452}
12
13 // === LLDB TESTS ==================================================================================
14
15 // lldb-command:run
16
17 // lldb-command:print *abc
18 // lldbg-check:(enum_thinlto::ABC) $0 =
19 // lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452)
20
21 #![allow(unused_variables)]
22 #![feature(omit_gdb_pretty_printer_section)]
23 #![omit_gdb_pretty_printer_section]
24
25 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
26 // the size of the discriminant value is machine dependent, this has be taken into account when
27 // datatype layout should be predictable as in this case.
28 #[derive(Debug)]
29 enum ABC {
30     TheA { x: i64, y: i64 },
31     TheB (i64, i32, i32),
32 }
33
34 fn main() {
35     let abc = ABC::TheA { x: 0, y: 0x7c7c_7c7c_7c7c_7c7c };
36
37     f(&abc);
38 }
39
40 fn f(abc: &ABC) {
41     zzz(); // #break
42
43     println!("{:?}", abc);
44 }
45
46 fn zzz() {()}