| author | |
| committer | |
| log | c2ab4614b69a2303d640837df357c2336b0cedf2 |
| tree | c62d3ac773bd0c3e3c8d5d21e4e1da03193531ac |
| parent | 1792258dc813cde7083fd7860442e6ec92afd4ba |
it's too fast to need it now3 files changed, 4 insertions(+), 17 deletions(-)
lib/std/debug/Dwarf.zig-5| ... | ... | @@ -2354,19 +2354,14 @@ pub fn resolveSourceLocations( |
| 2354 | 2354 | sorted_pc_addrs: []const u64, |
| 2355 | 2355 | /// Asserts its length equals length of `sorted_pc_addrs`. |
| 2356 | 2356 | output: []std.debug.SourceLocation, |
| 2357 | parent_prog_node: std.Progress.Node, | |
| 2358 | 2357 | ) ResolveSourceLocationsError!void { |
| 2359 | 2358 | assert(sorted_pc_addrs.len == output.len); |
| 2360 | 2359 | assert(d.compile_units_sorted); |
| 2361 | 2360 | |
| 2362 | const prog_node = parent_prog_node.start("Resolve Source Locations", sorted_pc_addrs.len); | |
| 2363 | defer prog_node.end(); | |
| 2364 | ||
| 2365 | 2361 | var cu_i: usize = 0; |
| 2366 | 2362 | var cu: *CompileUnit = &d.compile_unit_list.items[0]; |
| 2367 | 2363 | var range = cu.pc_range.?; |
| 2368 | 2364 | next_pc: for (sorted_pc_addrs, output) |pc, *out| { |
| 2369 | defer prog_node.completeOne(); | |
| 2370 | 2365 | while (pc >= range.end) { |
| 2371 | 2366 | cu_i += 1; |
| 2372 | 2367 | 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), |
| 20 | 20 | |
| 21 | 21 | pub const LoadError = Dwarf.ElfModule.LoadError; |
| 22 | 22 | |
| 23 | pub fn load(gpa: Allocator, path: Path, parent_prog_node: std.Progress.Node) LoadError!Info { | |
| 23 | pub fn load(gpa: Allocator, path: Path) LoadError!Info { | |
| 24 | 24 | 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(); | |
| 27 | 25 | 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); | |
| 30 | 26 | try elf_module.dwarf.sortCompileUnits(); |
| 31 | 27 | var info: Info = .{ |
| 32 | 28 | .address_map = .{}, |
| ... | ... | @@ -51,10 +47,9 @@ pub fn resolveSourceLocations( |
| 51 | 47 | sorted_pc_addrs: []const u64, |
| 52 | 48 | /// Asserts its length equals length of `sorted_pc_addrs`. |
| 53 | 49 | output: []std.debug.SourceLocation, |
| 54 | parent_prog_node: std.Progress.Node, | |
| 55 | 50 | ) ResolveSourceLocationsError!void { |
| 56 | 51 | assert(sorted_pc_addrs.len == output.len); |
| 57 | 52 | if (info.address_map.entries.len != 1) @panic("TODO"); |
| 58 | 53 | 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); | |
| 60 | 55 | } |
tools/dump-cov.zig+2-5| ... | ... | @@ -28,10 +28,7 @@ pub fn main() !void { |
| 28 | 28 | .sub_path = cov_file_name, |
| 29 | 29 | }; |
| 30 | 30 | |
| 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| { | |
| 35 | 32 | fatal("failed to load debug info for {}: {s}", .{ exe_path, @errorName(err) }); |
| 36 | 33 | }; |
| 37 | 34 | defer debug_info.deinit(gpa); |
| ... | ... | @@ -54,7 +51,7 @@ pub fn main() !void { |
| 54 | 51 | assert(std.sort.isSorted(usize, pcs, {}, std.sort.asc(usize))); |
| 55 | 52 | |
| 56 | 53 | 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); | |
| 58 | 55 | defer for (source_locations) |sl| { |
| 59 | 56 | gpa.free(sl.file_name); |
| 60 | 57 | }; |