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