No public description

PiperOrigin-RevId: 594289544
diff --git a/centipede/analyze_corpora.cc b/centipede/analyze_corpora.cc
index 6e3060e..da42f01 100644
--- a/centipede/analyze_corpora.cc
+++ b/centipede/analyze_corpora.cc
@@ -137,6 +137,31 @@
 
 }  // namespace
 
+CoverageResults GetCoverage(std::string_view binary_name,
+                            std::string_view binary_hash,
+                            std::string_view workdir) {
+  const std::vector<CorpusRecord> corpus_records =
+      ReadCorpora(binary_name, binary_hash, workdir);
+
+  absl::flat_hash_set<size_t> pcs;
+  for (const auto &record : corpus_records) {
+    for (const auto &feature : record.features) {
+      if (!feature_domains::kPCs.Contains(feature)) continue;
+      auto pc = ConvertPCFeatureToPcIndex(feature);
+      pcs.insert(pc);
+    }
+  }
+
+  BinaryInfo binary_info = ReadBinaryInfo(binary_name, binary_hash, workdir);
+  CoverageResults ret = {
+      .pcs = {pcs.begin(), pcs.end()},
+      .binary_info = std::move(binary_info),
+  };
+  // Sort PCs to put them in the canonical order, as in pc_table.
+  std::sort(ret.pcs.begin(), ret.pcs.end());
+  return ret;
+}
+
 AnalyzeCorporaResults AnalyzeCorpora(std::string_view binary_name,
                                      std::string_view binary_hash,
                                      std::string_view workdir_a,
diff --git a/centipede/analyze_corpora.h b/centipede/analyze_corpora.h
index 90eb528..3165f3b 100644
--- a/centipede/analyze_corpora.h
+++ b/centipede/analyze_corpora.h
@@ -32,6 +32,17 @@
   BinaryInfo binary_info;
 };
 
+// The result of analyzing a single corpus.
+struct CoverageResults {
+  std::vector<size_t> pcs;
+  BinaryInfo binary_info;
+};
+
+// Returns information on the corpus within `workdir`.
+CoverageResults GetCoverage(std::string_view binary_name,
+                            std::string_view binary_hash,
+                            std::string_view workdir);
+
 // Compares the corpus within `workdir_a` with the corpus in `workdir_b`.
 AnalyzeCorporaResults AnalyzeCorpora(std::string_view binary_name,
                                      std::string_view binary_hash,