From c2ab4614b69a2303d640837df357c2336b0cedf2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Aug 2024 23:38:34 -0700 Subject: [PATCH] std.Debug.Info: remove std.Progress integration it's too fast to need it now --- lib/std/debug/Dwarf.zig | 5 ----- lib/std/debug/Info.zig | 9 ++------- tools/dump-cov.zig | 7 ++----- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig index 06ffad9441..9689ac98b3 100644 --- a/lib/std/debug/Dwarf.zig +++ b/lib/std/debug/Dwarf.zig @@ -2354,19 +2354,14 @@ pub fn resolveSourceLocations( sorted_pc_addrs: []const u64, /// Asserts its length equals length of `sorted_pc_addrs`. output: []std.debug.SourceLocation, - parent_prog_node: std.Progress.Node, ) ResolveSourceLocationsError!void { assert(sorted_pc_addrs.len == output.len); assert(d.compile_units_sorted); - const prog_node = parent_prog_node.start("Resolve Source Locations", sorted_pc_addrs.len); - defer prog_node.end(); - var cu_i: usize = 0; var cu: *CompileUnit = &d.compile_unit_list.items[0]; var range = cu.pc_range.?; next_pc: for (sorted_pc_addrs, output) |pc, *out| { - defer prog_node.completeOne(); while (pc >= range.end) { cu_i += 1; if (cu_i >= d.compile_unit_list.items.len) { diff --git a/lib/std/debug/Info.zig b/lib/std/debug/Info.zig index 3c61c4072f..f31b2f22c4 100644 --- a/lib/std/debug/Info.zig +++ b/lib/std/debug/Info.zig @@ -20,13 +20,9 @@ address_map: std.AutoArrayHashMapUnmanaged(u64, Dwarf.ElfModule), pub const LoadError = Dwarf.ElfModule.LoadError; -pub fn load(gpa: Allocator, path: Path, parent_prog_node: std.Progress.Node) LoadError!Info { +pub fn load(gpa: Allocator, path: Path) LoadError!Info { var sections: Dwarf.SectionArray = Dwarf.null_section_array; - var prog_node = parent_prog_node.start("Loading Debug Info", 0); - defer prog_node.end(); var elf_module = try Dwarf.ElfModule.loadPath(gpa, path, null, null, §ions, null); - prog_node.end(); - prog_node = parent_prog_node.start("Sort Compile Units", 0); try elf_module.dwarf.sortCompileUnits(); var info: Info = .{ .address_map = .{}, @@ -51,10 +47,9 @@ pub fn resolveSourceLocations( sorted_pc_addrs: []const u64, /// Asserts its length equals length of `sorted_pc_addrs`. output: []std.debug.SourceLocation, - parent_prog_node: std.Progress.Node, ) ResolveSourceLocationsError!void { assert(sorted_pc_addrs.len == output.len); if (info.address_map.entries.len != 1) @panic("TODO"); const elf_module = &info.address_map.values()[0]; - return elf_module.dwarf.resolveSourceLocations(gpa, sorted_pc_addrs, output, parent_prog_node); + return elf_module.dwarf.resolveSourceLocations(gpa, sorted_pc_addrs, output); } diff --git a/tools/dump-cov.zig b/tools/dump-cov.zig index 8449dec33e..f821dde611 100644 --- a/tools/dump-cov.zig +++ b/tools/dump-cov.zig @@ -28,10 +28,7 @@ pub fn main() !void { .sub_path = cov_file_name, }; - const prog_node = std.Progress.start(.{}); - defer prog_node.end(); - - var debug_info = std.debug.Info.load(gpa, exe_path, prog_node) catch |err| { + var debug_info = std.debug.Info.load(gpa, exe_path) catch |err| { fatal("failed to load debug info for {}: {s}", .{ exe_path, @errorName(err) }); }; defer debug_info.deinit(gpa); @@ -54,7 +51,7 @@ pub fn main() !void { assert(std.sort.isSorted(usize, pcs, {}, std.sort.asc(usize))); const source_locations = try arena.alloc(std.debug.SourceLocation, pcs.len); - try debug_info.resolveSourceLocations(gpa, pcs, source_locations, prog_node); + try debug_info.resolveSourceLocations(gpa, pcs, source_locations); defer for (source_locations) |sl| { gpa.free(sl.file_name); };