]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/generator-locals.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / generator-locals.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8 // gdb-command:print a
9 // gdb-check:$1 = 5
10 // gdb-command:print c
11 // gdb-check:$2 = 6
12 // gdb-command:print d
13 // gdb-check:$3 = 7
14 // gdb-command:continue
15 // gdb-command:print a
16 // gdb-check:$4 = 7
17 // gdb-command:print c
18 // gdb-check:$5 = 6
19 // gdb-command:print e
20 // gdb-check:$6 = 8
21 // gdb-command:continue
22 // gdb-command:print a
23 // gdb-check:$7 = 8
24 // gdb-command:print c
25 // gdb-check:$8 = 6
26
27 // === LLDB TESTS ==================================================================================
28
29 // lldb-command:run
30 // lldb-command:print a
31 // lldbg-check:(int) $0 = 5
32 // lldbr-check:(int) a = 5
33 // lldb-command:print c
34 // lldbg-check:(int) $1 = 6
35 // lldbr-check:(int) c = 6
36 // lldb-command:print d
37 // lldbg-check:(int) $2 = 7
38 // lldbr-check:(int) d = 7
39 // lldb-command:continue
40 // lldb-command:print a
41 // lldbg-check:(int) $3 = 7
42 // lldbr-check:(int) a = 7
43 // lldb-command:print c
44 // lldbg-check:(int) $4 = 6
45 // lldbr-check:(int) c = 6
46 // lldb-command:print e
47 // lldbg-check:(int) $5 = 8
48 // lldbr-check:(int) e = 8
49 // lldb-command:continue
50 // lldb-command:print a
51 // lldbg-check:(int) $6 = 8
52 // lldbr-check:(int) a = 8
53 // lldb-command:print c
54 // lldbg-check:(int) $7 = 6
55 // lldbr-check:(int) c = 6
56
57 #![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
58 #![omit_gdb_pretty_printer_section]
59
60 use std::ops::Generator;
61 use std::pin::Pin;
62
63 fn main() {
64     let mut a = 5;
65     let mut b = || {
66         let c = 6; // Live across multiple yield points
67
68         let d = 7; // Live across only one yield point
69         yield;
70         _zzz(); // #break
71         a = d;
72
73         let e = 8; // Live across zero yield points
74         _zzz(); // #break
75         a = e;
76
77         yield;
78         _zzz(); // #break
79         a = c;
80     };
81     Pin::new(&mut b).resume(());
82     Pin::new(&mut b).resume(());
83     Pin::new(&mut b).resume(());
84     _zzz(); // #break
85 }
86
87 fn _zzz() {()}