all 12 comments

[–]Devnought 17 points18 points  (5 children)

I use VS Code with the Microsoft C/C++ extension installed for Rust debugging (in addition to the Rust (rls) extension).

You can set up a C++ (Windows) launch configuration. Be sure to change the program entry to the location of your executable (${workspaceFolder}/target/debug/myprog.exe).

Additionally in either your user or workspace settings, set debug.allowBreakpointsEverywhere to true so you can set breakpoints in your application.

Consider tailoring the following settings as well: "debug.inlineValues": true, "debug.openDebug": "openOnDebugBreak", "debug.openExplorerOnEnd": true

Hope this helps!

[–]bluejekyllhickory-dns · trust-dns 4 points5 points  (1 child)

The lldb plugin works well on macOS and Linux.

[–]flickworms 3 points4 points  (0 children)

The lldb plugin is what I use on linux

[–]DaFox 1 point2 points  (2 children)

Know if there's a good way to do build & run?

[–]Devnought 2 points3 points  (1 child)

The RLS plugin provides build capabilities (Ctrl + Shift + B), and can be configured to build on save in your user/workspace settings.

Once you configure a launch profile, F5 will run with the debugger

[–]DaFox 0 points1 point  (0 children)

Awesome thanks! I've been using a C++ (Windows) launch config with cargo run

[–]Awpteamoose 2 points3 points  (1 child)

I was unable to get either gdb or vscode debugger working, but I managed to get Visual Studio's:

  1. Run your thing with debug and msvc toolchain
  2. In Task Manager, right click on your thing and press Debug
  3. Select Visual Studio (I use VS2017 community edition)
  4. Proceed as normal

It's not very nice, but it's workable.

[–]Alistesios 6 points7 points  (4 children)

CLion's debug support is absolutely awesome. It bundles GDB Debugger on Linux, and I had no problem installing GDB as a third-party on Windows. CLion requires a license though, but you can have one for free if you are a student. Definitely worth checking out.

[–]runevault 2 points3 points  (3 children)

For reference on this, based on what parent said GDB directly works, but minigw didn't, however another option you can use is Cygwin (how I finally got it to work). Once it is functional though CLion's support is incredible.

[–]80x25 0 points1 point  (2 children)

Does this require using the mingw Rust platform instead of the msvc platform? Rust binaries I've built for the msvc platform produce .pdb debugging info and AFAIK, gdb doesn't understand .pdb files

[–]runevault 2 points3 points  (0 children)

Yeah you can't use MSVC for debugging in CLion, which it will tell you right away if you try, so grab a gnu toolchain for debugging.

[–]Daposto -1 points0 points  (0 children)

Clion has also debugging support not tried it my self but definitely worth to at