Skip to content

Inlining breaks LLDB expression evaluator #35487

Closed

Description

@vadimcn

Compile this code with -Copt-level=0:

#[inline(never)]
fn zzz() {}

#[inline(always)]
fn inlined_fn() {
    let a = 1;
    zzz(); // #break
}

fn main() {
    inlined_fn();
}

In LLDB, set a breakpoint on line 8, then run the program.
After breaking, type print a'. Result:

error: use of undeclared identifier 'a'
error: 1 error parsing expression

Interestingly, the frame variable command shows the expected value: (int) a = 1.

Meta:
LLDB version: lldb-360.1.25 (OSX XCode 8)
Rustc version: rustc 1.10.0 (cfcb716 2016-07-03) x86_64-apple-darwin

Activity

  1. added
    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)
    on Aug 8, 2016
  2. vadimcn commented on Aug 8, 2016

    @vadimcn
    ContributorAuthor

    Note: this is very likely an LLDB bug, because an equivalent C++ code exhibits the same behavior.

    __attribute__((noinline))
    void zzz() {}
    
    __attribute__((always_inline))
    void inlined_fn() { 
        {
        int a = 1;
        zzz(); // #break
        }
    }
    
    int main() {
        inlined_fn();
        return 0;
    }

    The extra lexical scope in inlined_fn is important - without it, evaluation produces the correct result: (int) $0 = 1

    GDB works correctly.

  3. michaelwoerister commented on Aug 8, 2016

    @michaelwoerister
    Member

    That makes me sad :(

  4. Mark-Simulacrum commented on May 14, 2017

    @Mark-Simulacrum
    Member

    So if this is an LLDB bug, then it seems like there's no use in us tracking it. As such, I'm going to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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