vscode-lldb doesn't evaluate rust expressions
Asked Answered
L

0

7

When debugging my code in vscode I noticed that it can't seem to find any functions I call. I tried adding to main.rs:

pub fn factorial(n: usize) -> usize {
    if n == 0 {
        1
    } else {
        n * factorial(n - 1)
    }
}

then I set a breakpoint at the start of the program and typed in the Debug Console

p factorial(5)

but I just get

error: could not find item.

If I write

p crate::factorial(5)

I get error: could not find decl "factorial"

What's the correct way to do it? I can't find any examples anywhere.

Leucine answered 2/1, 2021 at 20:24 Comment(2)
Unrelated, but assuming this subsequent question implies you found a solution to your previous question, then you could post the answer, for future people having the same issue :)Pleistocene
Nope. I just decided to go ahead and post my follow-up question anyway. I was hoping if I got a quick answer to the previous one I could make this one not about vscode, but since I didn't I didn't botherLeucine

© 2022 - 2024 — McMap. All rights reserved.