Skip to content

Debugger step-over runs backward #141344

Open
@vlad20012

Description

@vlad20012

Setup

main.rs:

fn main() {
    let a = 2; // 1
    let b = 3; // 3
    if b > 0 {
        let b = 10; // 2
        println!("a + b = {}", a + b);
    }
    println!("a = {}", b);
}

Reproducing in terminal:

cargo build
lldb-19 target/debug/debugger-bug

(lldb) breakpoint set --file main.rs --line 2
Breakpoint 1: where = debugger-bug`debugger_bug::main::h53ce27eca21116c8 + 7 at main.rs:2:9, address = 0x0000000000015aa7
(lldb) run
Process 551489 launched: '/home/vlad20012/RustroverProjects/debugger-bug/target/debug/debugger-bug' (x86_64)
Process 551489 stopped
* thread #1, name = 'debugger-bug', stop reason = breakpoint 1.1
    frame #0: 0x0000555555569aa7 debugger-bug`debugger_bug::main::h53ce27eca21116c8 at main.rs:2:9
   1    fn main() {
-> 2        let a = 2;
   3        let b = 3;
   4        if b > 0 {
   5            let b = 10;
   6            println!("a + b = {}", a + b);
   7        }
(lldb) step
Process 551489 stopped
* thread #1, name = 'debugger-bug', stop reason = step in
    frame #0: 0x0000555555569ab2 debugger-bug`debugger_bug::main::h53ce27eca21116c8 at main.rs:5:13
   2        let a = 2;
   3        let b = 3;
   4        if b > 0 {
-> 5            let b = 10;
   6            println!("a + b = {}", a + b);
   7        }
   8        println!("a = {}", b);
(lldb) step
Process 551489 stopped
* thread #1, name = 'debugger-bug', stop reason = step in
    frame #0: 0x0000555555569abd debugger-bug`debugger_bug::main::h53ce27eca21116c8 at main.rs:3:13
   1    fn main() {
   2        let a = 2;
-> 3        let b = 3;
   4        if b > 0 {
   5            let b = 10;
   6            println!("a + b = {}", a + b);
   7        }

Reproducing in RustRover:

Screencast.from.2025-05-21.15-04-15.mp4

Env

LLDB:

lldb version 19.1.7

Rust:

rustc 1.89.0-nightly (bc82152 2025-05-20)
or
rustc 1.87.0 (17067e9 2025-05-09)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-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