Stream: beginners

Topic: Rust Debug Setup


view this post on Zulip Isak Jones (he) (W1'21) (Jun 27 2024 at 15:23):

Hey everyone - any advice on debugging roc-related Rust code in general?

I'm trying to optimize my local dev setup for small contributions, and just the codelldb debugger extension working, which took setting profile.dev.debug=1 in the Cargo.toml. Do other contributors even rely on the debugger?

i'm curious, what tips to people have for debugging compiler code?

For context, I'm developing with Nix in Neovim with the rustaceanvim plugin.

view this post on Zulip Anton (Jun 28 2024 at 09:55):

I also use codelldb but with vscode, I never needed to change anything in Cargo.toml though.
Sometimes I use the cursor.sh editor to help me find specific code given a vague description.
I use valgrind on a binary (built with --linker=legacy) and sometimes gdb for segmentation faults.
The flags at the end here are very useful as well.

This debugging tool is on my wishlist :p

view this post on Zulip Anton (Jun 28 2024 at 10:02):

Looking at the llvm IR is useful as well (with the roc flag --emit-llvm-ir) for certain issues.

view this post on Zulip Kiryl Dziamura (Jun 28 2024 at 10:09):

Let's add the tips to CONTRIBUTING.md?

view this post on Zulip Anton (Jun 28 2024 at 10:26):

Good idea, I'll do it now

view this post on Zulip Anton (Jun 28 2024 at 12:34):

PR#6848

view this post on Zulip Isak Jones (he) (W1'21) (Jun 28 2024 at 19:59):

thanks for sharing!

view this post on Zulip Isak Jones (he) (W1'21) (Jul 02 2024 at 15:41):

followup - what's the best way to setup the LSP on neovim?

view this post on Zulip Anton (Jul 02 2024 at 15:51):

I don't use neovim but this message may help you.

view this post on Zulip Ryan Barth (Jul 02 2024 at 17:34):

Hey Isak, I have been using neovim on this project and my setup has worked pretty well. I will give you one hint. A lot of the current nvim_lsp_config setup guides use Mason. Make sure you set it up with PATH = "append":

require('mason').setup { PATH = "append" }

This projects sets the rust toolchain so you want to make sure nvim uses the rust-analyzer provided by rustup and not masos so the versions all match up. Using PATH = "append" make sure that the mason installed version is the last place the editor goes looking for an installed language server.

view this post on Zulip Isak Jones (he) (W1'21) (Jul 02 2024 at 19:11):

thanks to both!


Last updated: Jul 05 2025 at 12:14 UTC