[PATCH] [asancov] Write coverage directly to a memory-mapped file

Kostya Serebryany kcc at google.com
Fri May 23 01:27:21 PDT 2014


================
Comment at: lib/sanitizer_common/sanitizer_coverage_direct.cc:17
@@ +16,3 @@
+// format:
+// <pointer size in bits>  // 1 line
+// <mapping start> <mapping end> <base address> <dso name> // repeated
----------------
You mean, 32 or 64?

================
Comment at: lib/sanitizer_common/sanitizer_coverage_direct.cc:73
@@ +72,3 @@
+bool CoverageMap::TryAdd(uptr pc) {
+  for (;;) {
+    uptr cmp = atomic_load(&pc_next, memory_order_acquire);
----------------
Just in case, I would replace this with 
   for (int i = 0; i < (1<<30); i++) {
         ....
   }
   CHECK(0 && "CoverageMap::TryAdd wanted to loop forever")

================
Comment at: lib/sanitizer_common/sanitizer_coverage_direct.cc:87
@@ +86,3 @@
+  if (TryAdd(pc)) return;
+  SpinMutexLock l(&mu);
+  for (;;) {
----------------
I wonder if this thing is AS-safe.
This at least deserves a comment. 

================
Comment at: test/asan/TestCases/Linux/coverage-direct-large.cc:19
@@ +18,3 @@
+
+// RUN: diff -u coverage-direct-large/normal/out.txt coverage-direct-large/direct/out.txt
+//
----------------
don't you need to cleanup after the test, as other coverage tests do?

http://reviews.llvm.org/D3874






More information about the llvm-commits mailing list