prune-trace: correctly handle 0 trace entries

If the analyzed program does not read any memory, or the reading
memory accesses are filtered out in the import step (import-trace -m),
the trace table may hold no entries for the program.  This commit
makes sure the SamplingPruner and FESamplingPruner deal properly with
this situation.

Change-Id: I6bb5da23f345fa97cf8ab0b688cce5d00945249a
This commit is contained in:
Horst Schirmeier
2021-03-28 11:59:58 +02:00
parent 3b7404de43
commit 67f1be840f
2 changed files with 10 additions and 0 deletions

View File

@ -146,6 +146,11 @@ bool FESamplingPruner::sampling_prune(const fail::Database::Variant& variant)
samplerows = std::min(pilotcount, m_samplesize);
}
if (pilotcount == 0) {
LOG << "no entries found, nothing to sample from!" << endl;
return true;
}
LOG << "loaded " << pilotcount << " entries, sampling "
<< samplerows << " entries with fault expansion ..." << endl;

View File

@ -173,6 +173,11 @@ bool SamplingPruner::sampling_prune(const fail::Database::Variant& variant)
mysql_free_result(res);
}
if (pilotcount == 0) {
LOG << "no entries found, nothing to sample from!" << endl;
return true;
}
LOG << "loaded " << pilotcount << " entries, sampling "
<< m_samplesize << " fault-space coordinates ..." << endl;