[libFuzzer] call __sanitizer_dump_coverage via EF
authorKostya Serebryany <kcc@google.com>
Fri, 20 Jan 2017 23:35:29 +0000 (23:35 +0000)
committerKostya Serebryany <kcc@google.com>
Fri, 20 Jan 2017 23:35:29 +0000 (23:35 +0000)
llvm-svn: 292681

llvm/lib/Fuzzer/FuzzerExtFunctions.def
llvm/lib/Fuzzer/FuzzerTracePC.cpp

index 61c72e4..91c9b07 100644 (file)
@@ -48,3 +48,5 @@ EXT_FUNC(__sanitizer_set_death_callback, void, (void (*)(void)), true);
 EXT_FUNC(__sanitizer_set_report_fd, void, (void*), false);
 EXT_FUNC(__sanitizer_update_counter_bitset_and_clear_counters, uintptr_t,
   (uint8_t*), false);
+EXT_FUNC(__sanitizer_dump_coverage, void, (const uintptr_t *, uintptr_t),
+         false);
index 6b31808..1cbb00a 100644 (file)
@@ -197,7 +197,8 @@ void TracePC::PrintCoverage() {
 }
 
 void TracePC::DumpCoverage() {
-  __sanitizer_dump_coverage(PCs, GetNumPCs());
+  if (EF->__sanitizer_dump_coverage)
+    EF->__sanitizer_dump_coverage(PCs, GetNumPCs());
 }
 
 // Value profile.