2024-02-22 06:10:29 -06:00
|
|
|
//@ compile-flags:-g
|
2018-11-07 03:33:35 -06:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:$1 = 5
|
2019-03-21 16:35:54 -05:00
|
|
|
// gdb-command:print c
|
2018-11-07 15:45:21 -06:00
|
|
|
// gdb-check:$2 = 6
|
2019-03-21 16:35:54 -05:00
|
|
|
// 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
|
2018-11-07 03:33:35 -06:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
|
|
|
// lldb-check:(int) a = 5
|
|
|
|
// lldb-command:v c
|
|
|
|
// lldb-check:(int) c = 6
|
|
|
|
// lldb-command:v d
|
|
|
|
// lldb-check:(int) d = 7
|
2019-03-21 16:35:54 -05:00
|
|
|
// lldb-command:continue
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
|
|
|
// lldb-check:(int) a = 7
|
|
|
|
// lldb-command:v c
|
|
|
|
// lldb-check:(int) c = 6
|
|
|
|
// lldb-command:v e
|
|
|
|
// lldb-check:(int) e = 8
|
2019-03-21 16:35:54 -05:00
|
|
|
// lldb-command:continue
|
2024-03-15 09:05:57 -05:00
|
|
|
// lldb-command:v a
|
|
|
|
// lldb-check:(int) a = 8
|
|
|
|
// lldb-command:v c
|
|
|
|
// lldb-check:(int) c = 6
|
2018-11-07 03:33:35 -06:00
|
|
|
|
2024-04-11 08:15:34 -05:00
|
|
|
#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)]
|
2018-11-07 03:33:35 -06:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
|
2023-10-19 11:06:43 -05:00
|
|
|
use std::ops::Coroutine;
|
2018-11-07 03:33:35 -06:00
|
|
|
use std::pin::Pin;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut a = 5;
|
2024-04-11 08:15:34 -05:00
|
|
|
let mut b = #[coroutine]
|
|
|
|
|| {
|
2019-03-21 16:35:54 -05:00
|
|
|
let c = 6; // Live across multiple yield points
|
|
|
|
|
|
|
|
let d = 7; // Live across only one yield point
|
2018-11-07 03:33:35 -06:00
|
|
|
yield;
|
|
|
|
_zzz(); // #break
|
2018-11-07 15:45:21 -06:00
|
|
|
a = d;
|
2019-03-21 16:35:54 -05:00
|
|
|
|
|
|
|
let e = 8; // Live across zero yield points
|
|
|
|
_zzz(); // #break
|
|
|
|
a = e;
|
|
|
|
|
|
|
|
yield;
|
|
|
|
_zzz(); // #break
|
|
|
|
a = c;
|
2018-11-07 03:33:35 -06:00
|
|
|
};
|
2020-01-25 13:03:10 -06:00
|
|
|
Pin::new(&mut b).resume(());
|
|
|
|
Pin::new(&mut b).resume(());
|
|
|
|
Pin::new(&mut b).resume(());
|
2018-11-07 03:33:35 -06:00
|
|
|
_zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2024-04-11 08:15:34 -05:00
|
|
|
fn _zzz() {
|
|
|
|
()
|
|
|
|
}
|