Fix debuginfo generation for the local variable frame for a function with nested functions.

Declare debuginfo directly on the GEP instead of on the frame alloca+offset, . An explicit DW_OP_deref is necessary (tested in LLDB).

Resolves an ICE introduced by PR #1598.
This commit is contained in:
Johan Engelen 2016-07-27 16:55:20 +02:00
parent 6b647bfb0a
commit 197b63a04f
4 changed files with 7 additions and 5 deletions

View file

@ -507,8 +507,10 @@ void DtoCreateNestedContext(FuncDeclaration *fd) {
#else
LLSmallVector<LLValue *, 2> addr;
#endif
gIR->DBuilder.OpOffset(addr, frameType, irLocal->nestedIndex);
gIR->DBuilder.EmitLocalVariable(frame, vd, nullptr, false, false, addr);
// Because we are passing a GEP instead of an alloca to
// llvm.dbg.declare, we have to make the address dereference explicit.
gIR->DBuilder.OpDeref(addr);
gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false, false, addr);
}
}
}