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.
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
Looking at the llvm IR is useful as well (with the roc flag --emit-llvm-ir
) for certain issues.
Let's add the tips to CONTRIBUTING.md
?
Good idea, I'll do it now
thanks for sharing!
followup - what's the best way to setup the LSP on neovim?
I don't use neovim but this message may help you.
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.
thanks to both!
Last updated: Jul 05 2025 at 12:14 UTC