Skip to content

Commit 9e06f25

Browse files
committed
Test debuginfo of different var liveness in generators
1 parent 52e4407 commit 9e06f25

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

src/test/debuginfo/generators.rs

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,52 @@
77
// gdb-command:run
88
// gdb-command:print a
99
// gdb-check:$1 = 5
10-
// gdb-command:print d
10+
// gdb-command:print c
1111
// 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
1226

1327
// === LLDB TESTS ==================================================================================
1428

1529
// lldb-command:run
1630
// lldb-command:print a
1731
// lldbg-check:(int) $0 = 5
1832
// lldbr-check:(int) a = 5
19-
// lldb-command:print d
33+
// lldb-command:print c
2034
// lldbg-check:(int) $1 = 6
21-
// lldbr-check:(int) d = 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
2256

2357
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
2458
#![omit_gdb_pretty_printer_section]
@@ -29,13 +63,24 @@ use std::pin::Pin;
2963
fn main() {
3064
let mut a = 5;
3165
let mut b = || {
32-
let d = 6;
66+
let c = 6; // Live across multiple yield points
67+
68+
let d = 7; // Live across only one yield point
3369
yield;
3470
_zzz(); // #break
3571
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;
3680
};
3781
Pin::new(&mut b).resume();
3882
Pin::new(&mut b).resume();
83+
Pin::new(&mut b).resume();
3984
_zzz(); // #break
4085
}
4186

0 commit comments

Comments
 (0)