If you are developing using Rust on Windows with a WSL2, adding support for debugging is very easy. If you haven’t started using WSL2(Windows subsystem for Linux 2) yet, you can follow my previous post on how to Install and setup Rust development environment on WSL2.

Install Debug Tools

cargo init rustapp
cd rustapp
code .

For a linux backend(WSL2 in this case), install the CodeLLDB extension on Visual Studio Code.

Install the CodeLLDB extension

Configure the debugger

Save launch.json debug config

Start Debugging

Debugger pauses at the breakpoint

You can step through the code using the standard debug commands or by using the Debug control buttons in VsCode.

Debugging supports looking into collections, watching variables and exposes the call stack

And that’s it! Have fun developing with Rust. 😃

Personal views

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store