commit 9edbf00ddfb3f8316d82e191b7aca281a0939ac0 (tree)
parent f6a3a0ca723325b2b84e67b1f7ef78a8f69df650
Author: Mason Remaley <mason@gamesbymason.com>
Date: Fri, 10 Apr 2026 22:38:32 -0700
Enables disabled error trace test on Windows
Diffstat:
2 files changed, 54 insertions(+), 45 deletions(-)
diff --git a/test/error_traces.zig b/test/error_traces.zig
@@ -452,26 +452,37 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext, os: std.Target.
},
});
- // TODO: the standard library has a bug in PDB parsing where given an address corresponding
- // to an inline call, the frame we see will be for the *caller*, not the *callee*. As a
- // result this test gives bogus results on Windows right now.
- // This is a part of https://codeberg.org/ziglang/zig/issues/30847.
- if (os != .windows) {
- cases.addCase(.{
- .name = "trace through inline call",
- .source =
- \\pub fn main() !void {
- \\ try foo();
- \\}
- \\inline fn foo() !void {
- \\ try bar();
- \\}
- \\fn bar() !void {
+ cases.addCase(.{
+ .name = "trace through inline call",
+ .source =
+ \\pub fn main() !void {
+ \\ try foo();
+ \\}
+ \\inline fn foo() !void {
+ \\ try bar();
+ \\}
+ \\fn bar() !void {
+ \\ return error.ThisIsSoSad;
+ \\}
+ ,
+ .expect_error = "ThisIsSoSad",
+ .expect_trace =
+ switch (os) {
+ // LLVM doesn't emit column info in the binary annotations for inlinee callees in PDBs,
+ // so our expected result is slightly different for Windows than on other operating
+ // systems.
+ .windows =>
+ \\source.zig:8:5: [address] in bar
\\ return error.ThisIsSoSad;
- \\}
+ \\ ^
+ \\source.zig:5: [address] in foo
+ \\ try bar();
+ \\
+ \\source.zig:2:5: [address] in main
+ \\ try foo();
+ \\ ^
,
- .expect_error = "ThisIsSoSad",
- .expect_trace =
+ else =>
\\source.zig:8:5: [address] in bar
\\ return error.ThisIsSoSad;
\\ ^
@@ -482,24 +493,24 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext, os: std.Target.
\\ try foo();
\\ ^
,
- .disable_trace_optimized = &.{
- .{ .x86_64, .freebsd },
- .{ .x86_64, .netbsd },
- .{ .x86_64, .linux },
- .{ .x86, .linux },
- .{ .aarch64, .freebsd },
- .{ .aarch64, .netbsd },
- .{ .aarch64, .linux },
- .{ .loongarch64, .linux },
- .{ .powerpc64le, .linux },
- .{ .riscv64, .linux },
- .{ .s390x, .linux },
- .{ .x86_64, .openbsd },
- .{ .x86_64, .windows },
- .{ .x86, .windows },
- .{ .x86_64, .macos },
- .{ .aarch64, .macos },
- },
- });
- }
+ },
+ .disable_trace_optimized = &.{
+ .{ .x86_64, .freebsd },
+ .{ .x86_64, .netbsd },
+ .{ .x86_64, .linux },
+ .{ .x86, .linux },
+ .{ .aarch64, .freebsd },
+ .{ .aarch64, .netbsd },
+ .{ .aarch64, .linux },
+ .{ .loongarch64, .linux },
+ .{ .powerpc64le, .linux },
+ .{ .riscv64, .linux },
+ .{ .s390x, .linux },
+ .{ .x86_64, .openbsd },
+ .{ .x86_64, .windows },
+ .{ .x86, .windows },
+ .{ .x86_64, .macos },
+ .{ .aarch64, .macos },
+ },
+ });
}
diff --git a/test/stack_traces.zig b/test/stack_traces.zig
@@ -238,9 +238,8 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
.unwind = .any,
.expect_panic = true,
.expect = switch (os) {
- // We use the information present in PDBs to resolve inlines when dumping stack traces
- // on Windows. Column numbers are missing as LLVM doesn't emit column info in the PDBs
- // for inline functions.
+ // LLVM doesn't emit column info in the binary annotations for inlinee callees in PDBs,
+ // so the first location has only a row.
.windows =>
\\panic: oh no
\\source.zig:5: [address] in foo
@@ -251,7 +250,8 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
\\ ^
\\
,
- // We don't yet resolve inlines on other platforms.
+ // On all other platforms, we resolve the innermost inline callee but we don't yet
+ // resolve the inline callers.
else =>
\\panic: oh no
\\source.zig:5:5: [address] in foo
@@ -294,9 +294,8 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
,
.unwind = .any,
.expect_panic = true,
+ // This switch serves a similar purpose as in "inline panic".
.expect = switch (os) {
- // Similarly to "inline panic", we can resolve inlines from PDBs but LLVM doesn't emit
- // column info for them.
.windows =>
\\panic: oh no
\\source.zig:11: [address] in baz
@@ -313,7 +312,6 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
\\ ^
\\
,
- // Similarly to "inline panic", we don't yet resolve inlines on other platforms.
else =>
\\panic: oh no
\\source.zig:11:5: [address] in baz