]>
Commit | Line | Data |
---|---|---|
2c00a5a8 | 1 | // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 |
1a4d82fc JJ |
2 | // min-lldb-version: 310 |
3 | ||
9346a6ac AL |
4 | // This test case checks if function arguments already have the correct value |
5 | // when breaking at the first line of the function, that is if the function | |
6 | // prologue has already been executed at the first line. Note that because of | |
7 | // the __morestack part of the prologue GDB incorrectly breaks at before the | |
8 | // arguments have been properly loaded when setting the breakpoint via the | |
9 | // function name. | |
1a4d82fc JJ |
10 | |
11 | // compile-flags:-g | |
12 | ||
13 | // === GDB TESTS =================================================================================== | |
14 | ||
15 | // gdb-command:run | |
16 | ||
17 | // IMMEDIATE ARGS | |
18 | // gdb-command:print a | |
19 | // gdb-check:$1 = 1 | |
20 | // gdb-command:print b | |
21 | // gdb-check:$2 = true | |
22 | // gdb-command:print c | |
23 | // gdb-check:$3 = 2.5 | |
24 | // gdb-command:continue | |
25 | ||
26 | // NON IMMEDIATE ARGS | |
27 | // gdb-command:print a | |
c30ab7b3 SL |
28 | // gdbg-check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10} |
29 | // gdbt-check:$4 = function_arg_initialization::BigStruct {a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10} | |
1a4d82fc | 30 | // gdb-command:print b |
c30ab7b3 SL |
31 | // gdbg-check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18} |
32 | // gdbt-check:$5 = function_arg_initialization::BigStruct {a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18} | |
1a4d82fc JJ |
33 | // gdb-command:continue |
34 | ||
35 | // BINDING | |
36 | // gdb-command:print a | |
37 | // gdb-check:$6 = 19 | |
38 | // gdb-command:print b | |
39 | // gdb-check:$7 = 20 | |
40 | // gdb-command:print c | |
41 | // gdb-check:$8 = 21.5 | |
42 | // gdb-command:continue | |
43 | ||
44 | // ASSIGNMENT | |
45 | // gdb-command:print a | |
46 | // gdb-check:$9 = 22 | |
47 | // gdb-command:print b | |
48 | // gdb-check:$10 = 23 | |
49 | // gdb-command:print c | |
50 | // gdb-check:$11 = 24.5 | |
51 | // gdb-command:continue | |
52 | ||
53 | // FUNCTION CALL | |
54 | // gdb-command:print x | |
55 | // gdb-check:$12 = 25 | |
56 | // gdb-command:print y | |
57 | // gdb-check:$13 = 26 | |
58 | // gdb-command:print z | |
59 | // gdb-check:$14 = 27.5 | |
60 | // gdb-command:continue | |
61 | ||
62 | // EXPR | |
63 | // gdb-command:print x | |
64 | // gdb-check:$15 = 28 | |
65 | // gdb-command:print y | |
66 | // gdb-check:$16 = 29 | |
67 | // gdb-command:print z | |
68 | // gdb-check:$17 = 30.5 | |
69 | // gdb-command:continue | |
70 | ||
71 | // RETURN EXPR | |
72 | // gdb-command:print x | |
73 | // gdb-check:$18 = 31 | |
74 | // gdb-command:print y | |
75 | // gdb-check:$19 = 32 | |
76 | // gdb-command:print z | |
77 | // gdb-check:$20 = 33.5 | |
78 | // gdb-command:continue | |
79 | ||
80 | // ARITHMETIC EXPR | |
81 | // gdb-command:print x | |
82 | // gdb-check:$21 = 34 | |
83 | // gdb-command:print y | |
84 | // gdb-check:$22 = 35 | |
85 | // gdb-command:print z | |
86 | // gdb-check:$23 = 36.5 | |
87 | // gdb-command:continue | |
88 | ||
89 | // IF EXPR | |
90 | // gdb-command:print x | |
91 | // gdb-check:$24 = 37 | |
92 | // gdb-command:print y | |
93 | // gdb-check:$25 = 38 | |
94 | // gdb-command:print z | |
95 | // gdb-check:$26 = 39.5 | |
96 | // gdb-command:continue | |
97 | ||
98 | // WHILE EXPR | |
99 | // gdb-command:print x | |
100 | // gdb-check:$27 = 40 | |
101 | // gdb-command:print y | |
102 | // gdb-check:$28 = 41 | |
103 | // gdb-command:print z | |
104 | // gdb-check:$29 = 42 | |
105 | // gdb-command:continue | |
106 | ||
107 | // LOOP EXPR | |
108 | // gdb-command:print x | |
109 | // gdb-check:$30 = 43 | |
110 | // gdb-command:print y | |
111 | // gdb-check:$31 = 44 | |
112 | // gdb-command:print z | |
113 | // gdb-check:$32 = 45 | |
114 | // gdb-command:continue | |
115 | ||
116 | ||
117 | // === LLDB TESTS ================================================================================== | |
118 | ||
119 | // lldb-command:run | |
120 | ||
121 | // IMMEDIATE ARGS | |
122 | // lldb-command:print a | |
123 | // lldb-check:[...]$0 = 1 | |
124 | // lldb-command:print b | |
125 | // lldb-check:[...]$1 = true | |
126 | // lldb-command:print c | |
127 | // lldb-check:[...]$2 = 2.5 | |
128 | // lldb-command:continue | |
129 | ||
130 | // NON IMMEDIATE ARGS | |
131 | // lldb-command:print a | |
132 | // lldb-check:[...]$3 = BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 } | |
133 | // lldb-command:print b | |
134 | // lldb-check:[...]$4 = BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 } | |
135 | // lldb-command:continue | |
136 | ||
137 | // BINDING | |
138 | // lldb-command:print a | |
139 | // lldb-check:[...]$5 = 19 | |
140 | // lldb-command:print b | |
141 | // lldb-check:[...]$6 = 20 | |
142 | // lldb-command:print c | |
143 | // lldb-check:[...]$7 = 21.5 | |
144 | // lldb-command:continue | |
145 | ||
146 | // ASSIGNMENT | |
147 | // lldb-command:print a | |
148 | // lldb-check:[...]$8 = 22 | |
149 | // lldb-command:print b | |
150 | // lldb-check:[...]$9 = 23 | |
151 | // lldb-command:print c | |
152 | // lldb-check:[...]$10 = 24.5 | |
153 | // lldb-command:continue | |
154 | ||
155 | // FUNCTION CALL | |
156 | // lldb-command:print x | |
157 | // lldb-check:[...]$11 = 25 | |
158 | // lldb-command:print y | |
159 | // lldb-check:[...]$12 = 26 | |
160 | // lldb-command:print z | |
161 | // lldb-check:[...]$13 = 27.5 | |
162 | // lldb-command:continue | |
163 | ||
164 | // EXPR | |
165 | // lldb-command:print x | |
166 | // lldb-check:[...]$14 = 28 | |
167 | // lldb-command:print y | |
168 | // lldb-check:[...]$15 = 29 | |
169 | // lldb-command:print z | |
170 | // lldb-check:[...]$16 = 30.5 | |
171 | // lldb-command:continue | |
172 | ||
173 | // RETURN EXPR | |
174 | // lldb-command:print x | |
175 | // lldb-check:[...]$17 = 31 | |
176 | // lldb-command:print y | |
177 | // lldb-check:[...]$18 = 32 | |
178 | // lldb-command:print z | |
179 | // lldb-check:[...]$19 = 33.5 | |
180 | // lldb-command:continue | |
181 | ||
182 | // ARITHMETIC EXPR | |
183 | // lldb-command:print x | |
184 | // lldb-check:[...]$20 = 34 | |
185 | // lldb-command:print y | |
186 | // lldb-check:[...]$21 = 35 | |
187 | // lldb-command:print z | |
188 | // lldb-check:[...]$22 = 36.5 | |
189 | // lldb-command:continue | |
190 | ||
191 | // IF EXPR | |
192 | // lldb-command:print x | |
193 | // lldb-check:[...]$23 = 37 | |
194 | // lldb-command:print y | |
195 | // lldb-check:[...]$24 = 38 | |
196 | // lldb-command:print z | |
197 | // lldb-check:[...]$25 = 39.5 | |
198 | // lldb-command:continue | |
199 | ||
200 | // WHILE EXPR | |
201 | // lldb-command:print x | |
202 | // lldb-check:[...]$26 = 40 | |
203 | // lldb-command:print y | |
204 | // lldb-check:[...]$27 = 41 | |
205 | // lldb-command:print z | |
206 | // lldb-check:[...]$28 = 42 | |
207 | // lldb-command:continue | |
208 | ||
209 | // LOOP EXPR | |
210 | // lldb-command:print x | |
211 | // lldb-check:[...]$29 = 43 | |
212 | // lldb-command:print y | |
213 | // lldb-check:[...]$30 = 44 | |
214 | // lldb-command:print z | |
215 | // lldb-check:[...]$31 = 45 | |
216 | // lldb-command:continue | |
217 | ||
218 | ||
219 | #![allow(unused_variables)] | |
b039eaaf | 220 | #![feature(omit_gdb_pretty_printer_section)] |
1a4d82fc JJ |
221 | #![omit_gdb_pretty_printer_section] |
222 | ||
c34b1796 | 223 | fn immediate_args(a: isize, b: bool, c: f64) { |
3157f602 | 224 | zzz(); // #break |
1a4d82fc JJ |
225 | } |
226 | ||
227 | struct BigStruct { | |
228 | a: u64, | |
229 | b: u64, | |
230 | c: u64, | |
231 | d: u64, | |
232 | e: u64, | |
233 | f: u64, | |
234 | g: u64, | |
235 | h: u64 | |
236 | } | |
237 | ||
238 | fn non_immediate_args(a: BigStruct, b: BigStruct) { | |
3157f602 | 239 | zzz(); // #break |
1a4d82fc JJ |
240 | } |
241 | ||
242 | fn binding(a: i64, b: u64, c: f64) { | |
85aaf69f | 243 | let x = 0; // #break |
e1599b0c | 244 | println!() |
1a4d82fc JJ |
245 | } |
246 | ||
247 | fn assignment(mut a: u64, b: u64, c: f64) { | |
248 | a = b; // #break | |
e1599b0c | 249 | println!() |
1a4d82fc JJ |
250 | } |
251 | ||
252 | fn function_call(x: u64, y: u64, z: f64) { | |
3157f602 | 253 | zzz(); // #break |
1a4d82fc JJ |
254 | } |
255 | ||
256 | fn identifier(x: u64, y: u64, z: f64) -> u64 { | |
257 | x // #break | |
258 | } | |
259 | ||
260 | fn return_expr(x: u64, y: u64, z: f64) -> u64 { | |
261 | return x; // #break | |
262 | } | |
263 | ||
264 | fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 { | |
265 | x + y // #break | |
266 | } | |
267 | ||
268 | fn if_expr(x: u64, y: u64, z: f64) -> u64 { | |
269 | if x + y < 1000 { // #break | |
270 | x | |
271 | } else { | |
272 | y | |
273 | } | |
274 | } | |
275 | ||
276 | fn while_expr(mut x: u64, y: u64, z: u64) -> u64 { | |
277 | while x + y > 1000 { // #break | |
278 | x += z | |
279 | } | |
280 | return x; | |
281 | } | |
282 | ||
283 | fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 { | |
5bcae85e SL |
284 | loop { |
285 | x += z; // #break | |
1a4d82fc JJ |
286 | |
287 | if x + y > 1000 { | |
288 | return x; | |
289 | } | |
290 | } | |
291 | } | |
292 | ||
293 | fn main() { | |
294 | immediate_args(1, true, 2.5); | |
295 | ||
296 | non_immediate_args( | |
297 | BigStruct { | |
298 | a: 3, | |
299 | b: 4, | |
300 | c: 5, | |
301 | d: 6, | |
302 | e: 7, | |
303 | f: 8, | |
304 | g: 9, | |
305 | h: 10 | |
306 | }, | |
307 | BigStruct { | |
308 | a: 11, | |
309 | b: 12, | |
310 | c: 13, | |
311 | d: 14, | |
312 | e: 15, | |
313 | f: 16, | |
314 | g: 17, | |
315 | h: 18 | |
316 | } | |
317 | ); | |
318 | ||
319 | binding(19, 20, 21.5); | |
320 | assignment(22, 23, 24.5); | |
321 | function_call(25, 26, 27.5); | |
322 | identifier(28, 29, 30.5); | |
323 | return_expr(31, 32, 33.5); | |
324 | arithmetic_expr(34, 35, 36.5); | |
325 | if_expr(37, 38, 39.5); | |
326 | while_expr(40, 41, 42); | |
327 | loop_expr(43, 44, 45); | |
328 | } | |
3157f602 XL |
329 | |
330 | fn zzz() {()} |