]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/function-prologue-stepping-regular.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / function-prologue-stepping-regular.rs
1 // This test case checks if function arguments already have the correct value when breaking at the
2 // beginning of a function.
3
4 // min-lldb-version: 310
5 // ignore-gdb
6 // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
7 // compile-flags:-g
8
9 // lldb-command:breakpoint set --name immediate_args
10 // lldb-command:breakpoint set --name non_immediate_args
11 // lldb-command:breakpoint set --name binding
12 // lldb-command:breakpoint set --name assignment
13 // lldb-command:breakpoint set --name function_call
14 // lldb-command:breakpoint set --name identifier
15 // lldb-command:breakpoint set --name return_expr
16 // lldb-command:breakpoint set --name arithmetic_expr
17 // lldb-command:breakpoint set --name if_expr
18 // lldb-command:breakpoint set --name while_expr
19 // lldb-command:breakpoint set --name loop_expr
20 // lldb-command:run
21
22 // IMMEDIATE ARGS
23 // lldb-command:print a
24 // lldb-check:[...]$0 = 1
25 // lldb-command:print b
26 // lldb-check:[...]$1 = true
27 // lldb-command:print c
28 // lldb-check:[...]$2 = 2.5
29 // lldb-command:continue
30
31 // NON IMMEDIATE ARGS
32 // lldb-command:print a
33 // lldb-check:[...]$3 = { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 }
34 // lldb-command:print b
35 // lldb-check:[...]$4 = { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 }
36 // lldb-command:continue
37
38 // BINDING
39 // lldb-command:print a
40 // lldb-check:[...]$5 = 19
41 // lldb-command:print b
42 // lldb-check:[...]$6 = 20
43 // lldb-command:print c
44 // lldb-check:[...]$7 = 21.5
45 // lldb-command:continue
46
47 // ASSIGNMENT
48 // lldb-command:print a
49 // lldb-check:[...]$8 = 22
50 // lldb-command:print b
51 // lldb-check:[...]$9 = 23
52 // lldb-command:print c
53 // lldb-check:[...]$10 = 24.5
54 // lldb-command:continue
55
56 // FUNCTION CALL
57 // lldb-command:print x
58 // lldb-check:[...]$11 = 25
59 // lldb-command:print y
60 // lldb-check:[...]$12 = 26
61 // lldb-command:print z
62 // lldb-check:[...]$13 = 27.5
63 // lldb-command:continue
64
65 // EXPR
66 // lldb-command:print x
67 // lldb-check:[...]$14 = 28
68 // lldb-command:print y
69 // lldb-check:[...]$15 = 29
70 // lldb-command:print z
71 // lldb-check:[...]$16 = 30.5
72 // lldb-command:continue
73
74 // RETURN EXPR
75 // lldb-command:print x
76 // lldb-check:[...]$17 = 31
77 // lldb-command:print y
78 // lldb-check:[...]$18 = 32
79 // lldb-command:print z
80 // lldb-check:[...]$19 = 33.5
81 // lldb-command:continue
82
83 // ARITHMETIC EXPR
84 // lldb-command:print x
85 // lldb-check:[...]$20 = 34
86 // lldb-command:print y
87 // lldb-check:[...]$21 = 35
88 // lldb-command:print z
89 // lldb-check:[...]$22 = 36.5
90 // lldb-command:continue
91
92 // IF EXPR
93 // lldb-command:print x
94 // lldb-check:[...]$23 = 37
95 // lldb-command:print y
96 // lldb-check:[...]$24 = 38
97 // lldb-command:print z
98 // lldb-check:[...]$25 = 39.5
99 // lldb-command:continue
100
101 // WHILE EXPR
102 // lldb-command:print x
103 // lldb-check:[...]$26 = 40
104 // lldb-command:print y
105 // lldb-check:[...]$27 = 41
106 // lldb-command:print z
107 // lldb-check:[...]$28 = 42
108 // lldb-command:continue
109
110 // LOOP EXPR
111 // lldb-command:print x
112 // lldb-check:[...]$29 = 43
113 // lldb-command:print y
114 // lldb-check:[...]$30 = 44
115 // lldb-command:print z
116 // lldb-check:[...]$31 = 45
117 // lldb-command:continue
118
119 #![allow(unused_variables)]
120 #![feature(omit_gdb_pretty_printer_section)]
121 #![omit_gdb_pretty_printer_section]
122
123 fn immediate_args(a: isize, b: bool, c: f64) {
124     ()
125 }
126
127 struct BigStruct {
128     a: u64,
129     b: u64,
130     c: u64,
131     d: u64,
132     e: u64,
133     f: u64,
134     g: u64,
135     h: u64
136 }
137
138 fn non_immediate_args(a: BigStruct, b: BigStruct) {
139     ()
140 }
141
142 fn binding(a: i64, b: u64, c: f64) {
143     let x = 0;
144 }
145
146 fn assignment(mut a: u64, b: u64, c: f64) {
147     a = b;
148 }
149
150 fn function_call(x: u64, y: u64, z: f64) {
151     println!("Hi!")
152 }
153
154 fn identifier(x: u64, y: u64, z: f64) -> u64 {
155     x
156 }
157
158 fn return_expr(x: u64, y: u64, z: f64) -> u64 {
159     return x;
160 }
161
162 fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
163     x + y
164 }
165
166 fn if_expr(x: u64, y: u64, z: f64) -> u64 {
167     if x + y < 1000 {
168         x
169     } else {
170         y
171     }
172 }
173
174 fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
175     while x + y < 1000 {
176         x += z
177     }
178     return x;
179 }
180
181 fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
182     loop {
183         x += z;
184
185         if x + y > 1000 {
186             return x;
187         }
188     }
189 }
190
191 fn main() {
192     immediate_args(1, true, 2.5);
193
194     non_immediate_args(
195         BigStruct {
196             a: 3,
197             b: 4,
198             c: 5,
199             d: 6,
200             e: 7,
201             f: 8,
202             g: 9,
203             h: 10
204         },
205         BigStruct {
206             a: 11,
207             b: 12,
208             c: 13,
209             d: 14,
210             e: 15,
211             f: 16,
212             g: 17,
213             h: 18
214         }
215     );
216
217     binding(19, 20, 21.5);
218     assignment(22, 23, 24.5);
219     function_call(25, 26, 27.5);
220     identifier(28, 29, 30.5);
221     return_expr(31, 32, 33.5);
222     arithmetic_expr(34, 35, 36.5);
223     if_expr(37, 38, 39.5);
224     while_expr(40, 41, 42);
225     loop_expr(43, 44, 45);
226 }