trusty: Retrieve coverage PCs from coverage record
Adds the ability to retrieve and save program counter information from
the trusty coverage record data. PC information is saved to a .sancov
file, parseable by the LLVM sancov tool. Sancov can then symbolize and
display this coverage information for consumption by humans.
Adds a sancov dump to the libtrusty_coverage_test for testing.
Bug: 175221942
Test: atest libtrusty_coverage_test
Test: Retrieve sancov file and manually symbolize with sancov
Change-Id: I342ea2ca9abb87986b2904ff69415544ee6070fc
diff --git a/trusty/fuzz/counters.cpp b/trusty/fuzz/counters.cpp
index 3fc9f48..8c79475 100644
--- a/trusty/fuzz/counters.cpp
+++ b/trusty/fuzz/counters.cpp
@@ -42,9 +42,9 @@
assert(fuzzer::ExtraCountersBegin());
assert(fuzzer::ExtraCountersEnd());
- uint8_t* begin = NULL;
- uint8_t* end = NULL;
- record_->GetRawData((volatile void**)&begin, (volatile void**)&end);
+ volatile uint8_t* begin = NULL;
+ volatile uint8_t* end = NULL;
+ record_->GetRawCounts(&begin, &end);
assert(end - begin <= sizeof(counters));
}
@@ -53,7 +53,7 @@
}
void ExtraCounters::Reset() {
- record_->Reset();
+ record_->ResetCounts();
fuzzer::ClearExtraCounters();
}
@@ -61,7 +61,7 @@
volatile uint8_t* begin = NULL;
volatile uint8_t* end = NULL;
- record_->GetRawData((volatile void**)&begin, (volatile void**)&end);
+ record_->GetRawCounts(&begin, &end);
size_t num_counters = end - begin;
for (size_t i = 0; i < num_counters; i++) {