top | item 35568351

(no title)

Hnus | 2 years ago

Can you debug zig in any MS/jetbrains IDEs? I type in nvim but debug in whatever has the best experience. I think I asked this question like 2 years ago and was told you can write tests, use lsp server or look at assembly.. has situation improved?

discuss

order

jcalabro|2 years ago

I use VS Code on Linux to debug Zig. Haven't tried the others you mentioned, but it just emits standard DWARF symbols, so I'm guessing if you can debug C/C++ you could probably also do Zig with minimal changes? I just use the lldb VS code plugin[0], which works out of the box for me with no issues.

https://github.com/vadimcn/codelldb

hiccuphippo|2 years ago

I've been able to debug Zig in Windows by simply opening the .exe file with Visual Studio. I didn't explore much what can be done in it but it is possible.

flohofwoe|2 years ago

At least DWARF is supported (e.g. any gdb or lldb frontend works, e.g. what various VSCode extensions like CodeLLDB offer). Not sure about PDB support on Windows actually.

This also means you can transparently debug-step from Zig into C code and back, which is kinda expected but it never gets old for me :)

sciolistse|2 years ago

Not so sure about any real IDEs, lldb has worked fine for the (fairly small) zig programs I've worked on and the "CodeLLDB" vscode extension worked. Of course with the move from LLVM i assume lldb will stop working, and vscode may not be a good enough debugging experience.

flohofwoe|2 years ago

AFAIK the LLVM backend won't go away in the standard Zig distribution even with the new non-LLVM backend.

But even without LLVM backend I would expect that Zig will be able to produce DWARF debug information.

duckqlz|2 years ago

The best debugging experience imo is using gdb and rr within nvim. Works for zig, c, rust, etc. with minimal configuration in nvim. The less I leave vim the more productive I can be. Same thing probably goes for emacs although I will never admit it.

immrammc|2 years ago

I’d love if you could elaborate on your setup. Are you using something like nvim-dap from within neovim or something else? I’m still trying to improve my debug experience in neovim.