Skip to content

Broken line debug info generated for for loops #20293

@vadimcn

Description

@vadimcn
extern crate test;
fn main() {
    let mut sum = 0;
    for i in range(0, 10i) { // `s<CR>` lands on this line twice
        sum += i;
    }
    test::black_box(sum);
}

Compile, with -g, step line-by-line in gdb.
You'll notice that in the beginning of each loop iteration it takes two s<CR> to advance to the next line. The culprit seems to be a couple of IR instructions in the loop (which apparently store the value into i), that do not have debug line metadata attached to them.

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