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