Skip to content

Debug info after MIR inlining losses track which variables represent arguments #83217

Closed
@tmiasko

Description

@tmiasko

For example:

fn main() {
    println!("{}", f(std::env::args().count(), 1));
}

#[inline]
pub fn f(x: usize, y: usize) -> usize {
    x + y
}

Running rustc -Zinline-mir a.rs -g && gdb ./a currently results in:

(gdb) break a::f
(gdb) run
Breakpoint 1, a::f () at a.rs:7
7	    x + y
(gdb) info args
No arguments.
(gdb) info locals
x = 1
y = 1

It should be more or less as follows:

(gdb) break a::f
(gdb) run
Breakpoint 1, a::f (x=1, y=1) at a.rs:7
7	    x + y
(gdb) info args
x = 1
y = 1
(gdb) info locals
No locals.

@rustbot label +A-mir-opt-inlining +A-debuginfo

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-mir-opt-inliningArea: MIR inliningC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions