Skip to content

Commit

Permalink
[sancov] Ignore PC samples with value 0
Browse files Browse the repository at this point in the history
The sancov runtime for the (Fuchsia) Zircon kernel delivers results
in the standard format, but as the full array of possible samples
with 0 in uncovered slots. That runtime delivers "live" data and
has no final "export" pass to compactify out the uncovered slots,
and it seems silly to require another offline tool just for that.

Patch By: mcgrathr
Differential Revision: https://reviews.llvm.org/D63695

llvm-svn: 365839
  • Loading branch information
petrhosek committed Jul 11, 2019
1 parent 5652f35 commit 6f8f1a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvm/tools/sancov/sancov.cpp
Expand Up @@ -259,6 +259,10 @@ RawCoverage::read(const std::string &FileName) {
return make_error_code(errc::illegal_byte_sequence);
}

// Ignore slots that are zero, so a runtime implementation is not required
// to compactify the data.
Addrs->erase(0);

return std::unique_ptr<RawCoverage>(new RawCoverage(std::move(Addrs)));
}

Expand Down Expand Up @@ -1229,7 +1233,7 @@ int main(int Argc, char **Argv) {
llvm::InitializeAllTargetMCs();
llvm::InitializeAllDisassemblers();

cl::ParseCommandLineOptions(Argc, Argv,
cl::ParseCommandLineOptions(Argc, Argv,
"Sanitizer Coverage Processing Tool (sancov)\n\n"
" This tool can extract various coverage-related information from: \n"
" coverage-instrumented binary files, raw .sancov files and their "
Expand Down

0 comments on commit 6f8f1a7

Please sign in to comment.