zig icon indicating copy to clipboard operation
zig copied to clipboard

Debugging functions taking structs as arguments broken on windows

Open codepoint92 opened this issue 2 months ago • 0 comments

Zig Version

0.15.2

Steps to Reproduce and Observed Behavior

In functions taking structs as arguments none of the variables can be found in the watch window.

Here is a minimized example:

const std = @import("std");

const S = struct {
    a: i32,
    
    pub fn foo(s2: *S) void {
        var a: i32 = 0;
        a += 1;
        s2.a = a;
    }
    
    pub fn bar(s3: S) void {
        std.debug.print("{}", .{s3.a});
    }
};

pub fn main() !void {
    var s1 = S{.a = 0};
    s1.foo();
    s1.bar();
}

While stepping in foo or bar the variables a, s2 and s3 cannot be found when adding them to the watch window in MSVC (2026 is my current installation, my previous installation 2019 also had that problem).

They can be found in the locals window. However this is not ideal when debugging function with many variables.

Even right clicking on the variables in the locals window and adding them like that to the watch window results in them not being found.

Image

Expected Behavior

The variables a, s2 and s3 should be viewable in the watch window.

codepoint92 avatar Nov 19 '25 22:11 codepoint92