Apply allowlist to all blocks within a function (#2785)

This commit is contained in:
Joe Ranweiler
2023-01-30 09:46:58 -08:00
committed by GitHub
parent 6d36f5194a
commit c7ba712de0

View File

@ -124,16 +124,27 @@ pub fn find_coverage_sites(
continue;
}
if let Some(location) = symcache.lookup(function.offset.0).next() {
if let Some(file) = location.file() {
let path = file.full_path();
let blocks = block::sweep_region(module, &debuginfo, function.offset, function.size)?;
if allowlist.source_files.is_allowed(path) {
let blocks =
block::sweep_region(module, &debuginfo, function.offset, function.size)?;
offsets.extend(blocks.iter().map(|b| b.offset));
for block in &blocks {
if let Some(location) = symcache.lookup(block.offset.0).next() {
if let Some(file) = location.file() {
let path = file.full_path();
// Apply allowlists per block, to account for inlining. The `location` values
// here describe the top of the inline-inclusive call stack.
if !allowlist.functions.is_allowed(&path) {
continue;
}
if !allowlist.source_files.is_allowed(&path) {
continue;
}
offsets.insert(block.offset);
}
}
println!();
}
}