From 88c3c24ba55dfde12933c4169e006941849f5410 Mon Sep 17 00:00:00 2001 From: Joe Ranweiler Date: Wed, 7 Jun 2023 10:19:29 -0700 Subject: [PATCH] Skip entire function if entry offset excluded --- src/agent/coverage/src/binary.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/agent/coverage/src/binary.rs b/src/agent/coverage/src/binary.rs index 6fdd0c308e..61646a7f4b 100644 --- a/src/agent/coverage/src/binary.rs +++ b/src/agent/coverage/src/binary.rs @@ -120,6 +120,20 @@ pub fn find_coverage_sites( let mut offsets = BTreeSet::new(); for function in debuginfo.functions() { + if let Some(location) = symcache.lookup(function.offset.0).next() { + if let Some(file) = location.file() { + if !allowlist.source_files.is_allowed(file.full_path()) { + debug!( + "skipping sweep of `{}:{}` due to excluded source path `{}`", + module.executable_path(), + function.name, + file.full_path(), + ); + continue; + } + } + } + let blocks = block::sweep_region(module, &debuginfo, function.offset, function.size)?; for block in &blocks {