2020-04-14 12:10:58 -07:00
|
|
|
// Require a gdb that can read DW_TAG_variant_part.
|
2019-04-12 17:03:03 -07:00
|
|
|
// min-gdb-version: 8.2
|
|
|
|
|
2021-04-30 20:02:53 +08:00
|
|
|
// LLDB without native Rust support cannot read DW_TAG_variant_part,
|
|
|
|
// so it prints nothing for generators. But those tests are kept to
|
|
|
|
// ensure that LLDB won't crash at least (like #57822).
|
|
|
|
|
2019-04-12 17:03:03 -07:00
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
// gdb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// gdb-check:$1 = generator_objects::main::{generator_env#0}::Unresumed{_ref__a: 0x[...]}
|
2019-04-12 17:03:03 -07:00
|
|
|
// gdb-command:continue
|
|
|
|
// gdb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// gdb-check:$2 = generator_objects::main::{generator_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]}
|
2019-04-12 17:03:03 -07:00
|
|
|
// gdb-command:continue
|
|
|
|
// gdb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// gdb-check:$3 = generator_objects::main::{generator_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]}
|
2019-04-12 17:03:03 -07:00
|
|
|
// gdb-command:continue
|
|
|
|
// gdb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// gdb-check:$4 = generator_objects::main::{generator_env#0}::Returned{_ref__a: 0x[...]}
|
2019-04-12 17:03:03 -07:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
// lldb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// lldbg-check:(generator_objects::main::{generator_env#0}) $0 =
|
2019-04-12 17:03:03 -07:00
|
|
|
// lldb-command:continue
|
|
|
|
// lldb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// lldbg-check:(generator_objects::main::{generator_env#0}) $1 =
|
2019-04-12 17:03:03 -07:00
|
|
|
// lldb-command:continue
|
|
|
|
// lldb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// lldbg-check:(generator_objects::main::{generator_env#0}) $2 =
|
2019-04-12 17:03:03 -07:00
|
|
|
// lldb-command:continue
|
|
|
|
// lldb-command:print b
|
2022-01-19 17:56:53 +01:00
|
|
|
// lldbg-check:(generator_objects::main::{generator_env#0}) $3 =
|
2019-04-12 17:03:03 -07:00
|
|
|
|
|
|
|
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
|
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
|
|
|
|
use std::ops::Generator;
|
|
|
|
use std::pin::Pin;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut a = 5;
|
|
|
|
let mut b = || {
|
|
|
|
let mut c = 6;
|
|
|
|
let mut d = 7;
|
|
|
|
|
|
|
|
yield;
|
|
|
|
a += 1;
|
|
|
|
c += 1;
|
|
|
|
d += 1;
|
|
|
|
|
|
|
|
yield;
|
|
|
|
println!("{} {} {}", a, c, d);
|
|
|
|
};
|
|
|
|
_zzz(); // #break
|
2020-01-25 20:03:10 +01:00
|
|
|
Pin::new(&mut b).resume(());
|
2019-04-12 17:03:03 -07:00
|
|
|
_zzz(); // #break
|
2020-01-25 20:03:10 +01:00
|
|
|
Pin::new(&mut b).resume(());
|
2019-04-12 17:03:03 -07:00
|
|
|
_zzz(); // #break
|
2020-01-25 20:03:10 +01:00
|
|
|
Pin::new(&mut b).resume(());
|
2019-04-12 17:03:03 -07:00
|
|
|
_zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2022-01-19 17:56:53 +01:00
|
|
|
fn _zzz() {
|
|
|
|
()
|
|
|
|
}
|