[compiler-rt] r260629 - [sancov] improved object files handling.

Mike Aizatsky via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 16:29:25 PST 2016


Author: aizatsky
Date: Thu Feb 11 18:29:24 2016
New Revision: 260629

URL: http://llvm.org/viewvc/llvm-project?rev=260629&view=rev
Log:
[sancov] improved object files handling.

Updating sancov invocation on html_cov_dump.

sancov change: http://reviews.llvm.org/D17169

Differential Revision: http://reviews.llvm.org/D17171

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage_html_report.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=260629&r1=260628&r2=260629&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Thu Feb 11 18:29:24 2016
@@ -787,7 +787,6 @@ static void GenerateHtmlReport(const Int
   if (!common_flags()->html_cov_report || sancov_argv[0] == nullptr) {
     return;
   }
-
   InternalScopedString report_path(kMaxPathLength);
   fd_t report_fd =
       CovOpenFile(&report_path, false /* packed */, GetProcessName(), "html");
@@ -795,10 +794,8 @@ static void GenerateHtmlReport(const Int
                             kInvalidFd /* stdin */, report_fd /* std_out */);
   if (pid > 0) {
     int result = WaitForProcess(pid);
-    if (result == 0) {
-      VReport(1, " CovDump: html report generated to %s (%d)\n",
-              report_path.data(), result);
-    }
+    if (result == 0)
+      Printf("coverage report generated to %s\n", report_path.data());
   }
 }
 
@@ -809,12 +806,8 @@ void CoverageData::DumpOffsets() {
   InternalMmapVector<uptr> offsets(0);
   InternalScopedString path(kMaxPathLength);
 
-  InternalMmapVector<char *> sancov_argv(module_name_vec.size() + 2);
+  InternalMmapVector<char *> sancov_argv(module_name_vec.size() * 2 + 3);
   sancov_argv.push_back(FindPathToBinary(common_flags()->sancov_path));
-  if (GetArgv() != nullptr) {
-    sancov_argv.push_back(internal_strdup("-obj"));
-    sancov_argv.push_back(internal_strdup(GetArgv()[0]));
-  }
   sancov_argv.push_back(internal_strdup("-html-report"));
   auto argv_deleter = at_scope_exit([&] {
     for (uptr i = 0; i < sancov_argv.size(); ++i) {
@@ -846,6 +839,7 @@ void CoverageData::DumpOffsets() {
       if (fd == kInvalidFd) continue;
       WriteToFile(fd, offsets.data(), offsets.size() * sizeof(offsets[0]));
       CloseFile(fd);
+      sancov_argv.push_back(internal_strdup(r.copied_module_name));
       sancov_argv.push_back(internal_strdup(path.data()));
       VReport(1, " CovDump: %s: %zd PCs written\n", path.data(), num_offsets);
     }

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage_html_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage_html_report.cc?rev=260629&r1=260628&r2=260629&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage_html_report.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage_html_report.cc Thu Feb 11 18:29:24 2016
@@ -20,5 +20,5 @@ int main(int argc, char **argv) {
 
 // CHECK-main: PID: [[PID:[0-9]+]]
 // CHECK-main: [[PID]].sancov: 2 PCs written
-// CHECK-main: html report generated to ./coverage_html_report.cc.tmp.[[PID]].html
+// CHECK-main: coverage report generated to ./coverage_html_report.cc.tmp.[[PID]].html
 // CHECK-ls: coverage_html_report.cc.tmp.{{[0-9]+}}.html




More information about the llvm-commits mailing list