]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/by-value-non-immediate-argument.rs
Rollup merge of #107819 - clubby789:x-py-root, r=jyn514
[rust.git] / tests / debuginfo / by-value-non-immediate-argument.rs
1 // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
2 // min-lldb-version: 310
3
4 // compile-flags:-g
5
6 // === GDB TESTS ===================================================================================
7
8 // gdb-command:run
9
10 // gdb-command:print s
11 // gdbg-check:$1 = {a = 1, b = 2.5}
12 // gdbr-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5}
13 // gdb-command:continue
14
15 // gdb-command:print x
16 // gdbg-check:$2 = {a = 3, b = 4.5}
17 // gdbr-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5}
18 // gdb-command:print y
19 // gdb-check:$3 = 5
20 // gdb-command:print z
21 // gdb-check:$4 = 6.5
22 // gdb-command:continue
23
24 // gdb-command:print a
25 // gdbg-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5}
26 // gdbr-check:$5 = (7, 8, 9.5, 10.5)
27 // gdb-command:continue
28
29 // gdb-command:print a
30 // gdbg-check:$6 = {__0 = 11.5, __1 = 12.5, __2 = 13, __3 = 14}
31 // gdbr-check:$6 = by_value_non_immediate_argument::Newtype (11.5, 12.5, 13, 14)
32 // gdb-command:continue
33
34 // gdb-command:print x
35 // gdbg-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, [...]}}
36 // gdbr-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452}
37 // gdb-command:continue
38
39
40 // === LLDB TESTS ==================================================================================
41
42 // lldb-command:run
43
44 // lldb-command:print s
45 // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
46 // lldb-command:continue
47
48 // lldb-command:print x
49 // lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
50 // lldb-command:print y
51 // lldb-check:[...]$2 = 5
52 // lldb-command:print z
53 // lldb-check:[...]$3 = 6.5
54 // lldb-command:continue
55
56 // lldb-command:print a
57 // lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
58 // lldb-command:continue
59
60 // lldb-command:print a
61 // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
62 // lldb-command:continue
63
64 // lldb-command:print x
65 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
66 // lldb-command:continue
67
68 #![feature(omit_gdb_pretty_printer_section)]
69 #![omit_gdb_pretty_printer_section]
70
71 #[derive(Clone)]
72 struct Struct {
73     a: isize,
74     b: f64
75 }
76
77 #[derive(Clone)]
78 struct StructStruct {
79     a: Struct,
80     b: Struct
81 }
82
83 fn fun(s: Struct) {
84     zzz(); // #break
85 }
86
87 fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
88     zzz(); // #break
89 }
90
91 fn tup(a: (isize, usize, f64, f64)) {
92     zzz(); // #break
93 }
94
95 struct Newtype(f64, f64, isize, usize);
96
97 fn new_type(a: Newtype) {
98     zzz(); // #break
99 }
100
101 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
102 // the size of the discriminant value is machine dependent, this has be taken into account when
103 // datatype layout should be predictable as in this case.
104 enum Enum {
105     Case1 { x: i64, y: i64 },
106     Case2 (i64, i32, i32),
107 }
108
109 fn by_val_enum(x: Enum) {
110     zzz(); // #break
111 }
112
113 fn main() {
114     fun(Struct { a: 1, b: 2.5 });
115     fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
116     tup((7, 8, 9.5, 10.5));
117     new_type(Newtype(11.5, 12.5, 13, 14));
118
119     // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
120     // 0b01111100011111000111110001111100 = 2088533116
121     // 0b0111110001111100 = 31868
122     // 0b01111100 = 124
123     by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });
124 }
125
126 fn zzz() { () }