rustvisual-studio-codelldb

How do I inspect local variables or use the watch window with Rust code using VSCode and LLDB?


I am trying to debug a Rust application using VSCode, but I am unable to inspect any local variables or use the watch window (see attached).

All breakpoints work fine, I just cannot view any variables, etc.

The LLDB is what is shown in VSCODE plugin, but when I do lldb --version from the terminal it says: lldb version 3.8.0 ( revision ).

I get no errors when starting lldb from the terminal. All breakpoints are hit while debugging, I just cannot see any of the variable values.

For the sake of completeness, I verified python scripting support as a Prerequisite listed on: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb

**

python-lldb-3.8 is already the newest version

**

No local or watch


Solution

  • The correct solution was to install LLDB 3.9. I can now inspect local variables, use the watch window, and see values via tooltips.

    Here are the steps:

    1. Install LLVM 3.9. I found the accepted answer in this SE post to be the easiest way.
    2. Update Python LLDB to this version as per the vscode-lldb wiki. For example, I ran sudo apt-get install python-lldb-3.9
      1. Since LLVM now is invoked as llvm-3.9 (instead of just llvm) then VSCode may not recognize it and complain that LLVM is not installed or supported. My solution (yours may vary) was to remove then reinstall the VSCode extensions "LLDB Debugger 0.7.3" and "Native Debug 0.21.2"

    Once this was done and VSCode was restarted, I started to debug with F5 then VSCode gave me an alert that a different LLDB was found (3.9) and asked to update to new executable - say yes and you should be good to go.

    Results:

    debugging session