Skip to content

Debugging functions taking structs as arguments broken on windows #25984

@codepoint92

Description

@codepoint92

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend-llvmThe LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviordebug-infoDebug information of binary generated by Zig is not as expected.os-windowsMicrosoft Windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions