1 // Require a gdb that can read DW_TAG_variant_part.
2 // min-gdb-version: 8.2
4 // LLDB without native Rust support cannot read DW_TAG_variant_part,
5 // so it prints nothing for generators. But those tests are kept to
6 // ensure that LLDB won't crash at least (like #57822).
10 // === GDB TESTS ===================================================================================
13 // gdb-command:print b
14 // gdb-check:$1 = generator_objects::main::{generator_env#0}::Unresumed{_ref__a: 0x[...]}
15 // gdb-command:continue
16 // gdb-command:print b
17 // gdb-check:$2 = generator_objects::main::{generator_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]}
18 // gdb-command:continue
19 // gdb-command:print b
20 // gdb-check:$3 = generator_objects::main::{generator_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]}
21 // gdb-command:continue
22 // gdb-command:print b
23 // gdb-check:$4 = generator_objects::main::{generator_env#0}::Returned{_ref__a: 0x[...]}
25 // === LLDB TESTS ==================================================================================
28 // lldb-command:print b
29 // lldbg-check:(generator_objects::main::{generator_env#0}) $0 =
30 // lldb-command:continue
31 // lldb-command:print b
32 // lldbg-check:(generator_objects::main::{generator_env#0}) $1 =
33 // lldb-command:continue
34 // lldb-command:print b
35 // lldbg-check:(generator_objects::main::{generator_env#0}) $2 =
36 // lldb-command:continue
37 // lldb-command:print b
38 // lldbg-check:(generator_objects::main::{generator_env#0}) $3 =
40 // === CDB TESTS ===================================================================================
44 // cdb-check: b : Unresumed [Type: enum2$<generator_objects::main::generator_env$0>]
45 // cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
49 // cdb-check: b : Suspend0 [Type: enum2$<generator_objects::main::generator_env$0>]
50 // cdb-check: [+0x[...]] c : 6 [Type: int]
51 // cdb-check: [+0x[...]] d : 7 [Type: int]
52 // cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
56 // cdb-check: b : Suspend1 [Type: enum2$<generator_objects::main::generator_env$0>]
57 // cdb-check: [+0x[...]] c : 7 [Type: int]
58 // cdb-check: [+0x[...]] d : 8 [Type: int]
59 // cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
63 // cdb-check: b : Returned [Type: enum2$<generator_objects::main::generator_env$0>]
64 // cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
66 #![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
67 #![omit_gdb_pretty_printer_section]
69 use std::ops::Generator;
84 println!("{} {} {}", a, c, d);
87 Pin::new(&mut b).resume(());
89 Pin::new(&mut b).resume(());
91 Pin::new(&mut b).resume(());