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.
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.
11 // ignore-android: FIXME(#10381)
12 // min-lldb-version: 310
14 // This test case checks if function arguments already have the correct value when breaking at the
15 // first line of the function, that is if the function prologue has already been executed at the
16 // first line. Note that because of the __morestack part of the prologue GDB incorrectly breaks at
17 // before the arguments have been properly loaded when setting the breakpoint via the function name.
21 // === GDB TESTS ===================================================================================
26 // gdb-command:print a
28 // gdb-command:print b
29 // gdb-check:$2 = true
30 // gdb-command:print c
32 // gdb-command:continue
35 // gdb-command:print a
36 // gdb-check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10}
37 // gdb-command:print b
38 // gdb-check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18}
39 // gdb-command:continue
42 // gdb-command:print a
44 // gdb-command:print b
46 // gdb-command:print c
47 // gdb-check:$8 = 21.5
48 // gdb-command:continue
51 // gdb-command:print a
53 // gdb-command:print b
55 // gdb-command:print c
56 // gdb-check:$11 = 24.5
57 // gdb-command:continue
60 // gdb-command:print x
62 // gdb-command:print y
64 // gdb-command:print z
65 // gdb-check:$14 = 27.5
66 // gdb-command:continue
69 // gdb-command:print x
71 // gdb-command:print y
73 // gdb-command:print z
74 // gdb-check:$17 = 30.5
75 // gdb-command:continue
78 // gdb-command:print x
80 // gdb-command:print y
82 // gdb-command:print z
83 // gdb-check:$20 = 33.5
84 // gdb-command:continue
87 // gdb-command:print x
89 // gdb-command:print y
91 // gdb-command:print z
92 // gdb-check:$23 = 36.5
93 // gdb-command:continue
96 // gdb-command:print x
98 // gdb-command:print y
100 // gdb-command:print z
101 // gdb-check:$26 = 39.5
102 // gdb-command:continue
105 // gdb-command:print x
106 // gdb-check:$27 = 40
107 // gdb-command:print y
108 // gdb-check:$28 = 41
109 // gdb-command:print z
110 // gdb-check:$29 = 42
111 // gdb-command:continue
114 // gdb-command:print x
115 // gdb-check:$30 = 43
116 // gdb-command:print y
117 // gdb-check:$31 = 44
118 // gdb-command:print z
119 // gdb-check:$32 = 45
120 // gdb-command:continue
123 // === LLDB TESTS ==================================================================================
128 // lldb-command:print a
129 // lldb-check:[...]$0 = 1
130 // lldb-command:print b
131 // lldb-check:[...]$1 = true
132 // lldb-command:print c
133 // lldb-check:[...]$2 = 2.5
134 // lldb-command:continue
136 // NON IMMEDIATE ARGS
137 // lldb-command:print a
138 // lldb-check:[...]$3 = BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 }
139 // lldb-command:print b
140 // lldb-check:[...]$4 = BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 }
141 // lldb-command:continue
144 // lldb-command:print a
145 // lldb-check:[...]$5 = 19
146 // lldb-command:print b
147 // lldb-check:[...]$6 = 20
148 // lldb-command:print c
149 // lldb-check:[...]$7 = 21.5
150 // lldb-command:continue
153 // lldb-command:print a
154 // lldb-check:[...]$8 = 22
155 // lldb-command:print b
156 // lldb-check:[...]$9 = 23
157 // lldb-command:print c
158 // lldb-check:[...]$10 = 24.5
159 // lldb-command:continue
162 // lldb-command:print x
163 // lldb-check:[...]$11 = 25
164 // lldb-command:print y
165 // lldb-check:[...]$12 = 26
166 // lldb-command:print z
167 // lldb-check:[...]$13 = 27.5
168 // lldb-command:continue
171 // lldb-command:print x
172 // lldb-check:[...]$14 = 28
173 // lldb-command:print y
174 // lldb-check:[...]$15 = 29
175 // lldb-command:print z
176 // lldb-check:[...]$16 = 30.5
177 // lldb-command:continue
180 // lldb-command:print x
181 // lldb-check:[...]$17 = 31
182 // lldb-command:print y
183 // lldb-check:[...]$18 = 32
184 // lldb-command:print z
185 // lldb-check:[...]$19 = 33.5
186 // lldb-command:continue
189 // lldb-command:print x
190 // lldb-check:[...]$20 = 34
191 // lldb-command:print y
192 // lldb-check:[...]$21 = 35
193 // lldb-command:print z
194 // lldb-check:[...]$22 = 36.5
195 // lldb-command:continue
198 // lldb-command:print x
199 // lldb-check:[...]$23 = 37
200 // lldb-command:print y
201 // lldb-check:[...]$24 = 38
202 // lldb-command:print z
203 // lldb-check:[...]$25 = 39.5
204 // lldb-command:continue
207 // lldb-command:print x
208 // lldb-check:[...]$26 = 40
209 // lldb-command:print y
210 // lldb-check:[...]$27 = 41
211 // lldb-command:print z
212 // lldb-check:[...]$28 = 42
213 // lldb-command:continue
216 // lldb-command:print x
217 // lldb-check:[...]$29 = 43
218 // lldb-command:print y
219 // lldb-check:[...]$30 = 44
220 // lldb-command:print z
221 // lldb-check:[...]$31 = 45
222 // lldb-command:continue
225 #![allow(unused_variables)]
226 #![omit_gdb_pretty_printer_section]
228 fn immediate_args(a: int, b: bool, c: f64) {
229 ::std::io::print("") // #break
243 fn non_immediate_args(a: BigStruct, b: BigStruct) {
244 ::std::io::print("") // #break
247 fn binding(a: i64, b: u64, c: f64) {
248 let x = 0i; // #break
252 fn assignment(mut a: u64, b: u64, c: f64) {
257 fn function_call(x: u64, y: u64, z: f64) {
258 std::io::stdio::print("Hi!") // #break
261 fn identifier(x: u64, y: u64, z: f64) -> u64 {
265 fn return_expr(x: u64, y: u64, z: f64) -> u64 {
269 fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
273 fn if_expr(x: u64, y: u64, z: f64) -> u64 {
274 if x + y < 1000 { // #break
281 fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
282 while x + y > 1000 { // #break
288 fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
299 immediate_args(1, true, 2.5);
324 binding(19, 20, 21.5);
325 assignment(22, 23, 24.5);
326 function_call(25, 26, 27.5);
327 identifier(28, 29, 30.5);
328 return_expr(31, 32, 33.5);
329 arithmetic_expr(34, 35, 36.5);
330 if_expr(37, 38, 39.5);
331 while_expr(40, 41, 42);
332 loop_expr(43, 44, 45);