about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-03-21 14:35:54 -0700
committerTyler Mandry <tmandry@gmail.com>2019-04-25 10:12:57 -0700
commit9e06f2520088a3ad77018f1f5d4c8d3b90497fb1 (patch)
tree9ff2db76d97142fa07dca1b994bc0ae57fb7b761
parent52e4407d46e687c17f49ab3046a56ab172c49709 (diff)
downloadrust-9e06f2520088a3ad77018f1f5d4c8d3b90497fb1.tar.gz
rust-9e06f2520088a3ad77018f1f5d4c8d3b90497fb1.zip
Test debuginfo of different var liveness in generators
-rw-r--r--src/test/debuginfo/generators.rs53
1 files changed, 49 insertions, 4 deletions
diff --git a/src/test/debuginfo/generators.rs b/src/test/debuginfo/generators.rs
index 35a67217f16..59dbfecc39f 100644
--- a/src/test/debuginfo/generators.rs
+++ b/src/test/debuginfo/generators.rs
@@ -7,8 +7,22 @@
 // gdb-command:run
 // gdb-command:print a
 // gdb-check:$1 = 5
-// gdb-command:print d
+// gdb-command:print c
 // gdb-check:$2 = 6
+// gdb-command:print d
+// gdb-check:$3 = 7
+// gdb-command:continue
+// gdb-command:print a
+// gdb-check:$4 = 7
+// gdb-command:print c
+// gdb-check:$5 = 6
+// gdb-command:print e
+// gdb-check:$6 = 8
+// gdb-command:continue
+// gdb-command:print a
+// gdb-check:$7 = 8
+// gdb-command:print c
+// gdb-check:$8 = 6
 
 // === LLDB TESTS ==================================================================================
 
@@ -16,9 +30,29 @@
 // lldb-command:print a
 // lldbg-check:(int) $0 = 5
 // lldbr-check:(int) a = 5
-// lldb-command:print d
+// lldb-command:print c
 // lldbg-check:(int) $1 = 6
-// lldbr-check:(int) d = 6
+// lldbr-check:(int) c = 6
+// lldb-command:print d
+// lldbg-check:(int) $2 = 7
+// lldbr-check:(int) d = 7
+// lldb-command:continue
+// lldb-command:print a
+// lldbg-check:(int) $3 = 7
+// lldbr-check:(int) a = 7
+// lldb-command:print c
+// lldbg-check:(int) $4 = 6
+// lldbr-check:(int) c = 6
+// lldb-command:print e
+// lldbg-check:(int) $5 = 8
+// lldbr-check:(int) e = 8
+// lldb-command:continue
+// lldb-command:print a
+// lldbg-check:(int) $6 = 8
+// lldbr-check:(int) a = 8
+// lldb-command:print c
+// lldbg-check:(int) $7 = 6
+// lldbr-check:(int) c = 6
 
 #![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
 #![omit_gdb_pretty_printer_section]
@@ -29,13 +63,24 @@ use std::pin::Pin;
 fn main() {
     let mut a = 5;
     let mut b = || {
-        let d = 6;
+        let c = 6; // Live across multiple yield points
+
+        let d = 7; // Live across only one yield point
         yield;
         _zzz(); // #break
         a = d;
+
+        let e = 8; // Live across zero yield points
+        _zzz(); // #break
+        a = e;
+
+        yield;
+        _zzz(); // #break
+        a = c;
     };
     Pin::new(&mut b).resume();
     Pin::new(&mut b).resume();
+    Pin::new(&mut b).resume();
     _zzz(); // #break
 }