Updates more failing tests

This commit is contained in:
Mason Remaley
2026-04-11 22:27:23 -07:00
parent 87fb7df257
commit 541bd6c369
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -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,
});
}
+2 -2
View File
@@ -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,
};
}
+10 -2
View File
@@ -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", .{});