code coverage dumping tool basic implementation
* std.debug.Dwarf: add `sortCompileUnits` along with a field to track
the state for the purpose of assertions and correct API usage.
This makes batch lookups faster.
- in the future, findCompileUnit should be enhanced to rely on sorted
compile units as well.
* implement `std.debug.Dwarf.resolveSourceLocations` as well as
`std.debug.Info.resolveSourceLocations`. It's still pretty slow, since
it calls getLineNumberInfo for each array element, repeating a lot of
work unnecessarily.
* integrate these APIs with `std.Progress` to understand what is taking
so long.
The output I'm seeing from this tool shows a lot of missing source
locations. In particular, the main area of interest is missing for my
tokenizer fuzzing example.
This commit is contained in:
@@ -28,7 +28,10 @@ pub fn main() !void {
|
||||
.sub_path = cov_file_name,
|
||||
};
|
||||
|
||||
var debug_info = std.debug.Info.load(gpa, exe_path) catch |err| {
|
||||
const prog_node = std.Progress.start(.{});
|
||||
defer prog_node.end();
|
||||
|
||||
var debug_info = std.debug.Info.load(gpa, exe_path, prog_node) catch |err| {
|
||||
fatal("failed to load debug info for {}: {s}", .{ exe_path, @errorName(err) });
|
||||
};
|
||||
defer debug_info.deinit(gpa);
|
||||
@@ -51,7 +54,10 @@ 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);
|
||||
try debug_info.resolveSourceLocations(gpa, pcs, source_locations, prog_node);
|
||||
defer for (source_locations) |sl| {
|
||||
gpa.free(sl.file_name);
|
||||
};
|
||||
|
||||
for (pcs, source_locations) |pc, sl| {
|
||||
try stdout.print("{x}: {s}:{d}:{d}\n", .{
|
||||
|
||||
Reference in New Issue
Block a user