2019-08-25 03:01:46 +00:00
|
|
|
// This test makes sure that the LLDB pretty printer does not throw an exception
|
2023-10-19 21:46:28 +00:00
|
|
|
// for nested closures and coroutines.
|
2019-08-25 03:01:46 +00:00
|
|
|
|
2020-04-14 19:10:58 +00:00
|
|
|
// Require a gdb that can read DW_TAG_variant_part.
|
2019-08-25 03:01:46 +00:00
|
|
|
//@ min-gdb-version: 8.2
|
|
|
|
|
|
|
|
//@ compile-flags:-g
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print g
|
2022-01-19 16:56:53 +00:00
|
|
|
// gdb-check:$1 = issue_57822::main::{closure_env#1} {f: issue_57822::main::{closure_env#0} {x: 1}}
|
2019-08-25 03:01:46 +00:00
|
|
|
|
|
|
|
// gdb-command:print b
|
2023-10-19 21:46:28 +00:00
|
|
|
// gdb-check:$2 = issue_57822::main::{coroutine_env#3}::Unresumed{a: issue_57822::main::{coroutine_env#2}::Unresumed{y: 2}}
|
2019-08-25 03:01:46 +00:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v g
|
|
|
|
// lldbg-check:(issue_57822::main::{closure_env#1}) g = { f = { x = 1 } }
|
2019-08-25 03:01:46 +00:00
|
|
|
|
2024-03-15 14:05:57 +00:00
|
|
|
// lldb-command:v b
|
|
|
|
// lldbg-check:(issue_57822::main::{coroutine_env#3}) b =
|
2019-08-25 03:01:46 +00:00
|
|
|
|
2023-10-19 21:46:28 +00:00
|
|
|
#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
|
2019-08-25 03:01:46 +00:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
use std::ops::Coroutine;
|
2019-08-25 03:01:46 +00:00
|
|
|
use std::pin::Pin;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut x = 1;
|
|
|
|
let f = move || x;
|
|
|
|
let g = move || f();
|
|
|
|
|
|
|
|
let mut y = 2;
|
|
|
|
let mut a = move || {
|
|
|
|
y += 1;
|
|
|
|
yield;
|
|
|
|
};
|
|
|
|
let mut b = move || {
|
2020-01-25 19:03:10 +00:00
|
|
|
Pin::new(&mut a).resume(());
|
2019-08-25 03:01:46 +00:00
|
|
|
yield;
|
|
|
|
};
|
|
|
|
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2022-01-19 16:56:53 +00:00
|
|
|
fn zzz() {
|
|
|
|
()
|
|
|
|
}
|