zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 541bd6c3693cc57850dc5d78257584dd82f00ec6 (tree)
parent 87fb7df25794d12b2316dd41a9111e2206c00152
Author: Mason Remaley <mason@gamesbymason.com>
Date:   Sat, 11 Apr 2026 22:27:23 -0700

Updates more failing tests

Diffstat:
Mlib/std/debug.zig | 2+-
Mlib/std/testing/FailingAllocator.zig | 4++--
Mtest/standalone/coff_dwarf/main.zig | 12++++++++++--
3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/lib/std/debug.zig b/lib/std/debug.zig @@ -1704,7 +1704,7 @@ test "manage resources correctly" { const t: Io.Terminal = .{ .writer = &discarding.writer, .mode = .no_color }; try printSourceAtAddress(io, &di, t, .{ .address = S.showMyTrace(), - .inlines = true, + .resolve_inline_callers = true, }); } diff --git a/lib/std/testing/FailingAllocator.zig b/lib/std/testing/FailingAllocator.zig @@ -65,7 +65,7 @@ fn alloc( if (self.alloc_index == self.fail_index) { if (!self.has_induced_failure) { const st = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &self.stack_addresses); - @memset(self.stack_addresses[@min(st.index, self.stack_addresses.len)..], 0); + @memset(self.stack_addresses[@min(st.return_addresses.len, self.stack_addresses.len)..], 0); self.has_induced_failure = true; } return null; @@ -138,7 +138,7 @@ pub fn getStackTrace(self: *FailingAllocator) std.debug.StackTrace { len += 1; } return .{ - .instruction_addresses = &self.stack_addresses, + .return_addresses = &self.stack_addresses, .index = len, }; } diff --git a/test/standalone/coff_dwarf/main.zig b/test/standalone/coff_dwarf/main.zig @@ -12,8 +12,16 @@ pub fn main(init: std.process.Init) void { var add_addr: usize = undefined; _ = add(1, 2, &add_addr); - const symbol = di.getSymbol(io, add_addr) catch |err| fatal("failed to get symbol: {t}", .{err}); - defer if (symbol.source_location) |sl| std.debug.getDebugInfoAllocator().free(sl.file_name); + const symbols = di.getSymbols(io, add_addr) catch |err| fatal("failed to get symbol: {t}", .{err}); + const debug_gpa = std.debug.getDebugInfoAllocator(); + defer for (symbols) |symbol| { + if (symbol.source_location) |sl| { + debug_gpa.free(sl.file_name); + } + } + + if (symbols.len != 1) fatal("expected 1 symbol, found {}", .{symbols.len}); + const symbol = symbols[0]; if (symbol.name == null) fatal("failed to resolve symbol name", .{}); if (symbol.compile_unit_name == null) fatal("failed to resolve compile unit", .{});