aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-08 21:00:04 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:08 -0800
commitbee8005fe6817ade9191de0493888b14cdbcac31 (patch)
tree6001bd45ab1118e92a77fe6ebfbf6b332d371a2b /lib/std/debug
parent4a53e5b0b4131c6b8e18bb551e8215e425f8ac71 (diff)
downloadzig-bee8005fe6817ade9191de0493888b14cdbcac31.tar.gz
zig-bee8005fe6817ade9191de0493888b14cdbcac31.zip
std.heap.DebugAllocator: never detect TTY config
instead, allow the user to set it as a field. this fixes a bug where leak printing and error printing would run tty config detection for stderr, and then emit a log, which is not necessary going to print to stderr. however, the nice defaults are gone; the user must explicitly assign the tty_config field during initialization or else the logging will not have color. related: https://github.com/ziglang/zig/issues/24510
Diffstat (limited to 'lib/std/debug')
-rw-r--r--lib/std/debug/Info.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/std/debug/Info.zig b/lib/std/debug/Info.zig
index 6b31f03f72..34e79227d1 100644
--- a/lib/std/debug/Info.zig
+++ b/lib/std/debug/Info.zig
@@ -42,7 +42,7 @@ pub fn load(
var file = try path.root_dir.handle.openFile(io, path.sub_path, .{});
defer file.close(io);
- var elf_file: ElfFile = try .load(gpa, file, null, &.none);
+ var elf_file: ElfFile = try .load(gpa, io, file, null, &.none);
errdefer elf_file.deinit(gpa);
if (elf_file.dwarf == null) return error.MissingDebugInfo;
@@ -58,7 +58,7 @@ pub fn load(
const path_str = try path.toString(gpa);
defer gpa.free(path_str);
- var macho_file: MachOFile = try .load(gpa, path_str, arch);
+ var macho_file: MachOFile = try .load(gpa, io, path_str, arch);
errdefer macho_file.deinit(gpa);
return .{
@@ -85,6 +85,7 @@ pub const ResolveAddressesError = Coverage.ResolveAddressesDwarfError || error{U
pub fn resolveAddresses(
info: *Info,
gpa: Allocator,
+ io: Io,
/// Asserts the addresses are in ascending order.
sorted_pc_addrs: []const u64,
/// Asserts its length equals length of `sorted_pc_addrs`.
@@ -97,7 +98,7 @@ pub fn resolveAddresses(
// Resolving all of the addresses at once unfortunately isn't so easy in Mach-O binaries
// due to split debug information. For now, we'll just resolve the addreses one by one.
for (sorted_pc_addrs, output) |pc_addr, *src_loc| {
- const dwarf, const dwarf_pc_addr = mf.getDwarfForAddress(gpa, pc_addr) catch |err| switch (err) {
+ const dwarf, const dwarf_pc_addr = mf.getDwarfForAddress(gpa, io, pc_addr) catch |err| switch (err) {
error.InvalidMachO, error.InvalidDwarf => return error.InvalidDebugInfo,
else => |e| return e,
};