Search code examples
debuggingrustclionlldb

Does CLion possible evaluate a function when debugging Rust code?


A snip of Rust code:

pub fn main() {
    let a = "hello";
    let b = a.len();
    let c =b;
    println!("len:{}",c)
}

When debugging in CLion, Is it possible to evaluate a function? For example, debug the code step by step, now the code is running to the last line println!... and the current step stops here, by adding the expression a.len() to the watch a variable window, the IDE can't evaluate the a.len(). It says: error: no field named len

CLion can't evaluate an expression on Rust code


Solution

  • This is the same reason you can't make conditional breakpoints for Rust code:

    Can't create a conditional breakpoint in VSCode-LLDB with Rust