authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-10 22:38:32-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-12 04:01:30-07:00
log9edbf00ddfb3f8316d82e191b7aca281a0939ac0
tree21a58743fb73aac3dc9048811d9262d556a89d75
parentf6a3a0ca723325b2b84e67b1f7ef78a8f69df650

Enables disabled error trace test on Windows


2 files changed, 54 insertions(+), 45 deletions(-)

test/error_traces.zig+49-38
......@@ -452,26 +452,37 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext, os: std.Target.
452452 },
453453 });
454454
455 // TODO: the standard library has a bug in PDB parsing where given an address corresponding
456 // to an inline call, the frame we see will be for the *caller*, not the *callee*. As a
457 // result this test gives bogus results on Windows right now.
458 // This is a part of https://codeberg.org/ziglang/zig/issues/30847.
459 if (os != .windows) {
460 cases.addCase(.{
461 .name = "trace through inline call",
462 .source =
463 \\pub fn main() !void {
464 \\ try foo();
465 \\}
466 \\inline fn foo() !void {
467 \\ try bar();
468 \\}
469 \\fn bar() !void {
455 cases.addCase(.{
456 .name = "trace through inline call",
457 .source =
458 \\pub fn main() !void {
459 \\ try foo();
460 \\}
461 \\inline fn foo() !void {
462 \\ try bar();
463 \\}
464 \\fn bar() !void {
465 \\ return error.ThisIsSoSad;
466 \\}
467 ,
468 .expect_error = "ThisIsSoSad",
469 .expect_trace =
470 switch (os) {
471 // LLVM doesn't emit column info in the binary annotations for inlinee callees in PDBs,
472 // so our expected result is slightly different for Windows than on other operating
473 // systems.
474 .windows =>
475 \\source.zig:8:5: [address] in bar
470476 \\ return error.ThisIsSoSad;
471 \\}
477 \\ ^
478 \\source.zig:5: [address] in foo
479 \\ try bar();
480 \\
481 \\source.zig:2:5: [address] in main
482 \\ try foo();
483 \\ ^
472484 ,
473 .expect_error = "ThisIsSoSad",
474 .expect_trace =
485 else =>
475486 \\source.zig:8:5: [address] in bar
476487 \\ return error.ThisIsSoSad;
477488 \\ ^
......@@ -482,24 +493,24 @@ pub fn addCases(cases: *@import("tests.zig").ErrorTracesContext, os: std.Target.
482493 \\ try foo();
483494 \\ ^
484495 ,
485 .disable_trace_optimized = &.{
486 .{ .x86_64, .freebsd },
487 .{ .x86_64, .netbsd },
488 .{ .x86_64, .linux },
489 .{ .x86, .linux },
490 .{ .aarch64, .freebsd },
491 .{ .aarch64, .netbsd },
492 .{ .aarch64, .linux },
493 .{ .loongarch64, .linux },
494 .{ .powerpc64le, .linux },
495 .{ .riscv64, .linux },
496 .{ .s390x, .linux },
497 .{ .x86_64, .openbsd },
498 .{ .x86_64, .windows },
499 .{ .x86, .windows },
500 .{ .x86_64, .macos },
501 .{ .aarch64, .macos },
502 },
503 });
504 }
496 },
497 .disable_trace_optimized = &.{
498 .{ .x86_64, .freebsd },
499 .{ .x86_64, .netbsd },
500 .{ .x86_64, .linux },
501 .{ .x86, .linux },
502 .{ .aarch64, .freebsd },
503 .{ .aarch64, .netbsd },
504 .{ .aarch64, .linux },
505 .{ .loongarch64, .linux },
506 .{ .powerpc64le, .linux },
507 .{ .riscv64, .linux },
508 .{ .s390x, .linux },
509 .{ .x86_64, .openbsd },
510 .{ .x86_64, .windows },
511 .{ .x86, .windows },
512 .{ .x86_64, .macos },
513 .{ .aarch64, .macos },
514 },
515 });
505516}
test/stack_traces.zig+5-7
......@@ -238,9 +238,8 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
238238 .unwind = .any,
239239 .expect_panic = true,
240240 .expect = switch (os) {
241 // We use the information present in PDBs to resolve inlines when dumping stack traces
242 // on Windows. Column numbers are missing as LLVM doesn't emit column info in the PDBs
243 // for inline functions.
241 // LLVM doesn't emit column info in the binary annotations for inlinee callees in PDBs,
242 // so the first location has only a row.
244243 .windows =>
245244 \\panic: oh no
246245 \\source.zig:5: [address] in foo
......@@ -251,7 +250,8 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
251250 \\ ^
252251 \\
253252 ,
254 // We don't yet resolve inlines on other platforms.
253 // On all other platforms, we resolve the innermost inline callee but we don't yet
254 // resolve the inline callers.
255255 else =>
256256 \\panic: oh no
257257 \\source.zig:5:5: [address] in foo
......@@ -294,9 +294,8 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
294294 ,
295295 .unwind = .any,
296296 .expect_panic = true,
297 // This switch serves a similar purpose as in "inline panic".
297298 .expect = switch (os) {
298 // Similarly to "inline panic", we can resolve inlines from PDBs but LLVM doesn't emit
299 // column info for them.
300299 .windows =>
301300 \\panic: oh no
302301 \\source.zig:11: [address] in baz
......@@ -313,7 +312,6 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext, os: std.Target.
313312 \\ ^
314313 \\
315314 ,
316 // Similarly to "inline panic", we don't yet resolve inlines on other platforms.
317315 else =>
318316 \\panic: oh no
319317 \\source.zig:11:5: [address] in baz