Skip to content

debuginfo: by-value function parameters are not described correctly.  #8512

Closed
@michaelwoerister

Description

@michaelwoerister

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions