Skip to content

Commit e7d6675

Browse files
committed
Update generator upvar debug info
1 parent be39893 commit e7d6675

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/librustc_codegen_ssa/mir/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,17 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
586586
return;
587587
}
588588

589+
let pin_did = tcx.lang_items().pin_type();
589590
// Or is it the closure environment?
590591
let (closure_layout, env_ref) = match arg.layout.ty.sty {
591592
ty::RawPtr(ty::TypeAndMut { ty, .. }) |
592593
ty::Ref(_, ty, _) => (bx.layout_of(ty), true),
594+
ty::Adt(def, substs) if Some(def.did) == pin_did => {
595+
match substs.type_at(0).sty {
596+
ty::Ref(_, ty, _) => (bx.layout_of(ty), true),
597+
_ => (arg.layout, false),
598+
}
599+
}
593600
_ => (arg.layout, false)
594601
};
595602

src/test/debuginfo/generators.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// min-lldb-version: 310
2+
3+
// compile-flags:-g
4+
5+
// === GDB TESTS ===================================================================================
6+
7+
// gdb-command:run
8+
// gdb-command:print a
9+
// gdb-check:$1 = 5
10+
11+
// === LLDB TESTS ==================================================================================
12+
13+
// lldb-command:run
14+
// lldb-command:print a
15+
// lldbg-check:(int) $0 = 5
16+
// lldbr-check:(int) a = 5
17+
18+
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait, pin)]
19+
#![omit_gdb_pretty_printer_section]
20+
21+
use std::ops::Generator;
22+
use std::pin::Pin;
23+
24+
fn main() {
25+
let mut a = 5;
26+
let mut b = || {
27+
yield;
28+
_zzz(); // #break
29+
a = 6;
30+
};
31+
Pin::new(&mut b).resume();
32+
Pin::new(&mut b).resume();
33+
_zzz(); // #break
34+
}
35+
36+
fn _zzz() {()}

0 commit comments

Comments
 (0)