authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-02 23:38:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-07 00:48:32-07:00
logc2ab4614b69a2303d640837df357c2336b0cedf2
treec62d3ac773bd0c3e3c8d5d21e4e1da03193531ac
parent1792258dc813cde7083fd7860442e6ec92afd4ba

std.Debug.Info: remove std.Progress integration

it's too fast to need it now

3 files changed, 4 insertions(+), 17 deletions(-)

lib/std/debug/Dwarf.zig-5
......@@ -2354,19 +2354,14 @@ pub fn resolveSourceLocations(
23542354 sorted_pc_addrs: []const u64,
23552355 /// Asserts its length equals length of `sorted_pc_addrs`.
23562356 output: []std.debug.SourceLocation,
2357 parent_prog_node: std.Progress.Node,
23582357) ResolveSourceLocationsError!void {
23592358 assert(sorted_pc_addrs.len == output.len);
23602359 assert(d.compile_units_sorted);
23612360
2362 const prog_node = parent_prog_node.start("Resolve Source Locations", sorted_pc_addrs.len);
2363 defer prog_node.end();
2364
23652361 var cu_i: usize = 0;
23662362 var cu: *CompileUnit = &d.compile_unit_list.items[0];
23672363 var range = cu.pc_range.?;
23682364 next_pc: for (sorted_pc_addrs, output) |pc, *out| {
2369 defer prog_node.completeOne();
23702365 while (pc >= range.end) {
23712366 cu_i += 1;
23722367 if (cu_i >= d.compile_unit_list.items.len) {
lib/std/debug/Info.zig+2-7
......@@ -20,13 +20,9 @@ address_map: std.AutoArrayHashMapUnmanaged(u64, Dwarf.ElfModule),
2020
2121pub const LoadError = Dwarf.ElfModule.LoadError;
2222
23pub fn load(gpa: Allocator, path: Path, parent_prog_node: std.Progress.Node) LoadError!Info {
23pub fn load(gpa: Allocator, path: Path) LoadError!Info {
2424 var sections: Dwarf.SectionArray = Dwarf.null_section_array;
25 var prog_node = parent_prog_node.start("Loading Debug Info", 0);
26 defer prog_node.end();
2725 var elf_module = try Dwarf.ElfModule.loadPath(gpa, path, null, null, &sections, null);
28 prog_node.end();
29 prog_node = parent_prog_node.start("Sort Compile Units", 0);
3026 try elf_module.dwarf.sortCompileUnits();
3127 var info: Info = .{
3228 .address_map = .{},
......@@ -51,10 +47,9 @@ pub fn resolveSourceLocations(
5147 sorted_pc_addrs: []const u64,
5248 /// Asserts its length equals length of `sorted_pc_addrs`.
5349 output: []std.debug.SourceLocation,
54 parent_prog_node: std.Progress.Node,
5550) ResolveSourceLocationsError!void {
5651 assert(sorted_pc_addrs.len == output.len);
5752 if (info.address_map.entries.len != 1) @panic("TODO");
5853 const elf_module = &info.address_map.values()[0];
59 return elf_module.dwarf.resolveSourceLocations(gpa, sorted_pc_addrs, output, parent_prog_node);
54 return elf_module.dwarf.resolveSourceLocations(gpa, sorted_pc_addrs, output);
6055}
tools/dump-cov.zig+2-5
......@@ -28,10 +28,7 @@ pub fn main() !void {
2828 .sub_path = cov_file_name,
2929 };
3030
31 const prog_node = std.Progress.start(.{});
32 defer prog_node.end();
33
34 var debug_info = std.debug.Info.load(gpa, exe_path, prog_node) catch |err| {
31 var debug_info = std.debug.Info.load(gpa, exe_path) catch |err| {
3532 fatal("failed to load debug info for {}: {s}", .{ exe_path, @errorName(err) });
3633 };
3734 defer debug_info.deinit(gpa);
......@@ -54,7 +51,7 @@ pub fn main() !void {
5451 assert(std.sort.isSorted(usize, pcs, {}, std.sort.asc(usize)));
5552
5653 const source_locations = try arena.alloc(std.debug.SourceLocation, pcs.len);
57 try debug_info.resolveSourceLocations(gpa, pcs, source_locations, prog_node);
54 try debug_info.resolveSourceLocations(gpa, pcs, source_locations);
5855 defer for (source_locations) |sl| {
5956 gpa.free(sl.file_name);
6057 };