While stepping in the debugger through a source code, I noticed the LLDB does not update the shadowed variables. As a result, both the "Variables" tab in the debugger panel and editor inline debugger hints show wrong values. The same is when I use the 'p' command in the LLDB tab.
The first occurrence of a variable is displayed in blue as just allocated and a correct value assigned. The later shadowed declarations are not treated as new instantiations, nor even the existing instantiation updated with "new" values. The binary code works correctly. Only the debugger shows the wrong values.
fn foo() {
...
let t = 10;
...
let t = 16; <-- the debugger still shows '10'
..
}
Steps to reproduce
The example from the Rust Book about shadowed variables compiled and stepped in the debugger.
I ran into this same issue. Lead me down the wrong path of looking into some weird reference counting issue, before I figured it out. For now, just going to try and not shadow variables.
Environment
Problem description
https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing
While stepping in the debugger through a source code, I noticed the LLDB does not update the shadowed variables. As a result, both the "Variables" tab in the debugger panel and editor inline debugger hints show wrong values. The same is when I use the 'p' command in the LLDB tab. The first occurrence of a variable is displayed in blue as just allocated and a correct value assigned. The later shadowed declarations are not treated as new instantiations, nor even the existing instantiation updated with "new" values. The binary code works correctly. Only the debugger shows the wrong values.
Steps to reproduce
The example from the Rust Book about shadowed variables compiled and stepped in the debugger.