From 541bd6c3693cc57850dc5d78257584dd82f00ec6 Mon Sep 17 00:00:00 2001 From: Mason Remaley Date: Sat, 11 Apr 2026 22:27:23 -0700 Subject: [PATCH] Updates more failing tests --- lib/std/debug.zig | 2 +- lib/std/testing/FailingAllocator.zig | 4 ++-- test/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 index afd47d981d..d7df04457a 100644 --- 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 index bcd8856710..e5c807cac7 100644 --- 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 index 24684d3830..853f8a14ab 100644 --- 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", .{});