# Debugging Zig (with a debugger)

**URL:** <https://ziggit.dev/t/debugging-zig-with-a-debugger/7160>\
**Category:** Explain\
**Tags:** build-system, debugger\
**Created:** [December 4, 2024, 5:11pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160 "2024-12-04T17:11:53Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![mnemnion](https://ziggit.dev/user_avatar/ziggit.dev/mnemnion/32/2478_2.png) [@mnemnion](https://ziggit.dev/u/mnemnion)\
**Post date:** [December 7, 2024, 8:01pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/21 "2024-12-07T20:01:00Z")

</div>

> [@Eisenhauer](#):
>
> To me, one of the selling points of Zig is its interoperability with other Languages, especially C.
> 
> In practice, reuse across programming languages is an important usecase. Debuggers therefore already need to support several languages simultaneously within the same target binary.

I agree with this sentiment, at the same time, there’s nothing stopping the next debugger from being written in Zig. It could support everything which GDB and LLDB cover already, as well as providing better hooks for languages those two aren’t doing as good a job with.

This would be many human-years of labor, of course, and just patching and extending LLDB might be easier. But a debugger is exactly the kind of low-level system-oriented programming which Zig excels at. Sometimes the right thing to do is start fresh, with a system which doesn’t fundamentally assume it will be looking at either C or C++, an architecture which lets languages register specifics in an extensible way which covers bases for the next language as well.

LLVM itself was Chris Lattner realizing that it would be more practical to re-engineer the entire C/C++ compilation chain from end to end, rather than try to get GCC to work the way he thought it should. There’s precedent.

---

<div class="post-metadata">

**Author:** ![g41797](https://ziggit.dev/user_avatar/ziggit.dev/g41797/32/3339_2.png) [@g41797](https://ziggit.dev/u/g41797)\
**Post date:** [December 7, 2024, 8:25pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/22 "2024-12-07T20:25:27Z")

</div>

better to start from

> [@mnemnion](#):
>
> older `zig test` system, which doesn’t integrate with the build system

---

<div class="post-metadata">

**Author:** ![pachde](https://ziggit.dev/user_avatar/ziggit.dev/pachde/32/2485_2.png) [@pachde](https://ziggit.dev/u/pachde)\
**Post date:** [December 22, 2024, 4:37pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/23 "2024-12-22T16:37:02Z")

</div>

Visual Studio is not dedicated or specific to C#. It is a general IDE that supports many languages through extensions. This extensibility permeates all the functions of the IDE, from syntax highlighting to the project system, to the debugger. Anyone can add language support through the extensibility model. In its history, it has had support for C/C++, Pascal, Fortran, Cobol, Java, typescript, javascript, and others.

---

<div class="post-metadata">

**Author:** ![raddari](https://ziggit.dev/user_avatar/ziggit.dev/raddari/32/991_2.png) [@raddari](https://ziggit.dev/u/raddari)\
**Post date:** [December 23, 2024, 3:45am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/24 "2024-12-23T03:45:57Z")

</div>

[Jetbrains Rider](https://www.jetbrains.com/rider/) comes to mind for an IDE targeted towards C#. It requires a license though

---

<div class="post-metadata">

**Author:** ![typedlambda](https://ziggit.dev/user_avatar/ziggit.dev/typedlambda/32/3613_2.png) [@typedlambda](https://ziggit.dev/u/typedlambda)\
**Post date:** [December 23, 2024, 10:07am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/25 "2024-12-23T10:07:45Z")

</div>

On windows I started to use RAD Debugger,  
It’s not integrated with my editor, but works out of the box with zig and much better than windbg.

Still alpha, but better than everything else I tested. 64Bit only.

---

<div class="post-metadata">

**Author:** ![ethindp](https://ziggit.dev/user_avatar/ziggit.dev/ethindp/32/739_2.png) [@ethindp](https://ziggit.dev/u/ethindp)\
**Post date:** [December 25, 2024, 6:25am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/26 "2024-12-25T06:25:56Z")

</div>

I don’t have a good debugging strategy for debugging Zig on Windows (particularly since I dislike VSCode very much) but on Linux I just use gdb. It’s able to work with it quite well from my experience. But dedicated support in debuggers would always be better.

---

<div class="post-metadata">

**Author:** ![aajas](https://ziggit.dev/user_avatar/ziggit.dev/aajas/32/4434_2.png) [@aajas](https://ziggit.dev/u/aajas)\
**Post date:** [February 1, 2025, 9:45am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/27 "2025-02-01T09:45:34Z")

</div>

Wow, the RAD debugger works much better than what I expected, especially for an alpha project. Memory, registers, breakpoints – it’s definitely a good start.

---

<div class="post-metadata">

**Author:** ![g41797](https://ziggit.dev/user_avatar/ziggit.dev/g41797/32/3339_2.png) [@g41797](https://ziggit.dev/u/g41797)\
**Post date:** [February 2, 2025, 9:38pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/28 "2025-02-02T21:38:13Z")

</div>

try rustrover with zigbrains plugin

---

<div class="post-metadata">

**Author:** ![aciobanas](https://ziggit.dev/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@aciobanas](https://ziggit.dev/u/aciobanas)\
**Post date:** [July 5, 2025, 8:06pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/29 "2025-07-05T20:06:24Z")

</div>

Thanks a lot. Now I can easily debug my UTs in VS Code.

---

<div class="post-metadata">

**Author:** ![killua](https://ziggit.dev/user_avatar/ziggit.dev/killua/32/6598_2.png) [@killua](https://ziggit.dev/u/killua)\
**Post date:** [October 14, 2025, 9:44pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/30 "2025-10-14T21:44:56Z")

</div>

I’ve been trying to get it working with RAD but for some reason I can’t. I can run the program with rad but the debug info doesn’t show up. Literally just trying to debug hello world.

 ![image](https://ziggit.dev/uploads/default/original/2X/e/e170e34faa0766f9340be9d03b2f489dc9f151ad.png)

(edit - I’m new with both zig and rad )

---

<div class="post-metadata">

**Author:** ![Calder-Ty](https://ziggit.dev/user_avatar/ziggit.dev/calder-ty/32/10237_2.png) [@Calder-Ty](https://ziggit.dev/u/Calder-Ty)\
**Post date:** [October 14, 2025, 9:47pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/31 "2025-10-14T21:47:36Z")

</div>

I’ve no experience with the rad debugger but i wonder if you have a similar issue as here: [No symbol in LLDB debugger](https://ziggit.dev/t/no-symbol-in-lldb-debugger/12511)

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [October 15, 2025, 8:53am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/32 "2025-10-15T08:53:59Z")

</div>

if you are using zig 0.15+ on x86\_64 linux, then the custom backend is enabled by default in debug mode.

You can force the use of llvm with `.use_llvm = true` for your compile options, or `-fllvm` if you’re not using the build system.

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [October 15, 2025, 9:08am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/33 "2025-10-15T09:08:51Z")

</div>

if you’re wondering why debug info with the custom backends doesn’t work; it’s 2 things, it uses DWARF 5 format which majority of debuggers have yet to update to.  
It also has zig specific extensions to make debug info for incremental builds much easier to manage.

Even with dwarf 5, zig isn’t officially supported, though it is in the draft for dwarf 6. So debuggers won’t necessarily support zig.  
Only the zig lldb fork supports zig afaik, there are some wip debuggers in zig that will likely support zig’s extensions but i dont think any of them currently do.

The reason debug info works with llvm is cause zig uses c++ debug info, which is less than accurate but works well enough for simple debugging.

---

<div class="post-metadata">

**Author:** ![vivraan](https://ziggit.dev/user_avatar/ziggit.dev/vivraan/32/7536_2.png) [@vivraan](https://ziggit.dev/u/vivraan)\
**Post date:** [January 8, 2026, 9:50am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/34 "2026-01-08T09:50:32Z")

</div>

Sorry for the new year rezz, but I think as a beginner to Zig, having to resort to print/log debugging is going to prove detrimental to my hobby project. I am considering switching to a more mature language with better debugging tools just so that I can make things work (I picked Zig purely to learn it while building a project originally written in C).

Of course, I must appreciate Zig is still pre-release, so it’s quite simply not a mature framework if I get into the weeds. However, even the community still thinks debugging is a non-trivial issue – this is feeling less palatable when I’m not getting any answers while I’m stuck trying to figure out why something panics in my code.

I must consider investing time in learning how to use the packaged LLDB. I’m on Windows and using CLion with the Zigbrains plugin.

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [January 8, 2026, 9:57am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/35 "2026-01-08T09:57:18Z")

</div>

You don’t have to resort to print debugging though, you can just force the use of LLVM `-fllvm`(cli) or `.use_llvm = true`(build system, in module options), that will do the pretending to be c++ thing which debuggers support well.  
zig comes with a pretty printer script (optional) that will print with zig syntax, but running expressions will still use c/c++ syntax.

When using llvm any debugger that supports c/c++ should work without much effort.

Alternatively you can use the lldb fork which properly supports zig as a language, but it requires building it from source, which is not hard just slow.

I have to admit, I don’t know if the situation on Windows has more complications.

---

<div class="post-metadata">

**Author:** ![vivraan](https://ziggit.dev/user_avatar/ziggit.dev/vivraan/32/7536_2.png) [@vivraan](https://ziggit.dev/u/vivraan)\
**Post date:** [January 8, 2026, 10:00am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/36 "2026-01-08T10:00:40Z")

</div>

Yes, well, I’m trying out VS Code with CodeLLDB, and I hope to return to JetBrains at least. I am feeling slightly nauseated as I speak because I’ve added that `.use_llvm` and even `.use_lld` all over my build conf file.

Obviously it wasn’t working in CLion/Zigbrains.

---

<div class="post-metadata">

**Author:** ![vulpesx](https://ziggit.dev/user_avatar/ziggit.dev/vulpesx/32/3989_2.png) [@vulpesx](https://ziggit.dev/u/vulpesx)\
**Post date:** [January 8, 2026, 10:11am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/37 "2026-01-08T10:11:03Z")

</div>

I think it’s most likely a clion/zigbrains issue, but it could also be a specific issue on Windows.

I don’t use either so I can’t help with that. I have used codelldb with zig without much issue, though getting it to use the fork was annoying. But I don’t use that now either, my preferred editor has shitty debugger support atm, so I just use them on the terminal and have had no issues.

---

<div class="post-metadata">

**Author:** ![vivraan](https://ziggit.dev/user_avatar/ziggit.dev/vivraan/32/7536_2.png) [@vivraan](https://ziggit.dev/u/vivraan)\
**Post date:** [January 8, 2026, 10:24am UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/38 "2026-01-08T10:24:32Z")

</div>

I ran this with VSCode/CodeLLDB and I get the same issue there.

EDIT: I’m moving my enquiry to [Zig Debugging with LLDB - #13 by vivraan](https://ziggit.dev/t/zig-debugging-with-lldb/3931/13) .

---

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [January 8, 2026, 3:53pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/39 "2026-01-08T15:53:25Z")

</div>

I gave up on debugging with vscode. I don’t get it at all: the plethora of “things” to get it working.

---

<div class="post-metadata">

**Author:** ![g41797](https://ziggit.dev/user_avatar/ziggit.dev/g41797/32/3339_2.png) [@g41797](https://ziggit.dev/u/g41797)\
**Post date:** [January 8, 2026, 4:29pm UTC](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160/40 "2026-01-08T16:29:43Z")

</div>

linux or windows?

[Previous page](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160.md?page=1)

[Next page](https://ziggit.dev/t/debugging-zig-with-a-debugger/7160.md?page=3)
