std.Debug.Info: remove std.Progress integration

it's too fast to need it now
This commit is contained in:
Andrew Kelley 2024-08-02 23:38:34 -07:00
parent 1792258dc8
commit c2ab4614b6
3 changed files with 4 additions and 17 deletions

View file

@ -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) {

View file

@ -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, &sections, 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);
}

View file

@ -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);
};