# Zig doesn't generate debug info

**URL:** <https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016>\
**Category:** Help\
**Tags:** language\
**Created:** [October 18, 2026, 10:13am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016 "2026-10-18T10:13:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karim.MK](https://ziggit.dev/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@Karim.MK](https://ziggit.dev/u/Karim.MK)\
**Post date:** [October 18, 2026, 10:13am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/1 "2026-10-18T10:13:46Z")

</div>

Hi.

I recently started using [The RAD Debugger](https://github.com/EpicGames/raddebugger), and overall it’s been a good experience on Linux.  
However, in zig it usually doesn’t work great mainly because zig doesn’t generate the full debug info for the program. For example:

```zig
const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "zig_test",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{},
        }),
        .use_llvm = true, // True to generate the debug info...
    });
    ....
}

```

```zig
pub fn main(init: std.process.Init) !void {
    const arena = init.arena.allocator();

    var arr: std.ArrayList(usize) = .empty;
    var count: usize = 10;
    _ = &count;

    for (0..count) |i| {
        try arr.append(arena, i);
    }
}

```

This is the simplest example I could produce. However, when I step through the code inside the for loop. `i` doesn’t have any info while `arr` has…

 ![image](https://ziggit.dev/uploads/default/original/2X/8/837389ce64e0aef2ce41d16743ace4363cdcf8e8.png)  
In my actual project, most of the functions only have debug info for the arguments and no debug info for any local variable.

---

<div class="post-metadata">

**Author:** ![eddineimad0](https://ziggit.dev/user_avatar/ziggit.dev/eddineimad0/32/6879_2.png) [@eddineimad0](https://ziggit.dev/u/eddineimad0)\
**Post date:** [October 18, 2026, 11:11am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/2 "2026-10-18T11:11:02Z")

</div>

I don’t now about linux but in windows unless i use the msvc toolchain (not the default in zig) the debugging experience with raddbg ends up being very bad.

---

<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 18, 2026, 11:25am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/3 "2026-10-18T11:25:20Z")

</div>

What is wrong with the display of Arr? it’s an array list with a capacity of 17, len of 6 and a slice that contains your elements.

---

<div class="post-metadata">

**Author:** ![Karim.MK](https://ziggit.dev/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@Karim.MK](https://ziggit.dev/u/Karim.MK)\
**Post date:** [October 18, 2026, 11:26am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/4 "2026-10-18T11:26:21Z")

</div>

I mean, if Linux which has Tier 1 support is a subpar experience, I can’t imagine what it’s like on other platforms.

---

<div class="post-metadata">

**Author:** ![Karim.MK](https://ziggit.dev/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@Karim.MK](https://ziggit.dev/u/Karim.MK)\
**Post date:** [October 18, 2026, 11:27am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/5 "2026-10-18T11:27:59Z")

</div>

You are right, the variable `arr` has proper debug info. but the `i` variable in the for loop doesn’t have any debug info.  
And this is just a small example, in the game that I’m making most of the variable won’t have any info at all…

---

<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 18, 2026, 11:41am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/6 "2026-10-18T11:41:24Z")

</div>

What optimization mode are you building with ?

> .use\_llvm = true, // True to generate the debug info…

This only ensures that DWARF v4 data is generated. I don’t know what version Rad supports, but I’d guess at least v4, since it’s what gcc and clang emit. however if you at building with an optimization mode, it’s not surprising for debug info to be missing for variables such as `i`, which is a loop counter.

I believe setting strip is what will actually force debug info to stick around:

```zig
const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "zig_test",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{},
            .strip = false, // don't strip debug info
        }),
        .use_llvm = true, // True to generate the debug info...
    });
    ....
}

```

---

<div class="post-metadata">

**Author:** ![vincentd](https://ziggit.dev/user_avatar/ziggit.dev/vincentd/32/9870_2.png) [@vincentd](https://ziggit.dev/u/vincentd)\
**Post date:** [October 18, 2026, 12:16pm UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/7 "2026-10-18T12:16:37Z")

</div>

```zig
pub fn main(init: std.process.Init) !void {
    const arena = init.arena.allocator();

    var arr: std.ArrayList(usize) = .empty;
    var count: usize = 10;
    _ = &count;

    for (0..count) |i| {
        try arr.append(arena, i);
    }
}

```

That loop can be trivially unwound into 10 function calls. Even if you turned optimisations off, double-check the assembly output to make sure. I’ve had it happen in both C and zig code, and it does exactly what you report; the debugger can’t find the symbol (because it doesn’t exist, not even in a register).

> [@Karim.MK](#):
>
> I mean, if Linux which has Tier 1 support is a subpar experience, I can’t imagine what it’s like on other platforms.

Better than expected, honestly. I’m using it with an ESP32-S3 via OpenOCD, and it debugs just as well as with C code. That’s a Tier 4 target (XTensa).

---

<div class="post-metadata">

**Author:** ![Karim.MK](https://ziggit.dev/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@Karim.MK](https://ziggit.dev/u/Karim.MK)\
**Post date:** [October 18, 2026, 6:29pm UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/8 "2026-10-18T18:29:44Z")

</div>

> [@Calder-Ty](#):
>
> I believe setting strip is what will actually force debug info to stick around

Sorry for the late reply. However, `.strip = false` doesn’t solve the issue unfortunately. This is example was built in debug mode.

> [@vincentd](#):
>
> That loop can be trivially unwound into 10 function calls. Even if you turned optimisations off, double-check the assembly output to make sure.

At first I also thought that the compiler somehow unrolled the loop in debug mode. That’s why I tried to make `counter` a runtime variable. I likewise checked the assembly and it wasn’t unrolled…

It’s truly weird. And again, the `for` loop was just an example, in my game all of my variable don’t have any debug info.

---

<div class="post-metadata">

**Author:** ![squeek502](https://ziggit.dev/user_avatar/ziggit.dev/squeek502/32/409_2.png) [@squeek502](https://ziggit.dev/u/squeek502)\
**Post date:** [October 18, 2026, 9:19pm UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/9 "2026-10-18T21:19:48Z")

</div>

> [@Karim.MK](#):
>
> zig doesn’t generate the full debug info for the program

How are you distinguishing between “zig doesn’t generate debug info” and “the RAD debugger doesn’t support the debug info that Zig generates”?

With [nnd](https://github.com/al13n321/nnd), for example, `i` shows up just fine (with self-hosted backend and with the LLVM backend):

 ![Screenshot_2026-10-18_14-17-35](https://ziggit.dev/uploads/default/original/2X/e/e98e4a2afa3340d817500ba9da6898339606a7a5.png)

---

<div class="post-metadata">

**Author:** ![Karim.MK](https://ziggit.dev/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@Karim.MK](https://ziggit.dev/u/Karim.MK)\
**Post date:** [October 18, 2026, 9:54pm UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/10 "2026-10-18T21:54:24Z")

</div>

> [@squeek502](#):
>
> How are you distinguishing between “zig doesn’t generate debug info” and “the RAD debugger doesn’t support the debug info that Zig generates”?

Haha, it didn’t even cross my mind that the problem might be with the RAD debugger! Although, I’m working on two versions of my game just for the sake of comparison. One in Zig and one in Odin. In my Odin version, the debug info were available, so I immediately thought of it as Zig’s fault.

---

<div class="post-metadata">

**Author:** ![Devsuner](https://ziggit.dev/user_avatar/ziggit.dev/devsuner/32/8190_2.png) [@Devsuner](https://ziggit.dev/u/Devsuner)\
**Post date:** [October 19, 2026, 5:24am UTC](https://ziggit.dev/t/zig-doesnt-generate-debug-info/18016/11 "2026-10-19T05:24:35Z")

</div>

odin’s creator contribute for raddbg, so availabe is …
