Closed
Description
Currently, debug info for the following code will not be correct:
struct Struct {
a: int,
b: float
}
fn struct_fun(by_val: Struct) {
{...}
}
When breaking in struct_fun()
GDB will report that there is no variable with name by_val
. The reason is that by_val
, having a non-immediate type, is really passed by reference as far as LLVM is concerned (see trans::base::copy_args_to_allocas()
). The ty::t
associated with the value, however, is still the non-pointer type. LLVM does not seem to like this during codegen and silently omits the debug info entry for the parameter (see CompileUnit::constructVariableDIE()
in llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
). Consequently, GDB won't find anything for the name by_val
.
A fix will probably involve DIBuilder::createComplexVariable()
.