http://llvm.org/bugs/show_bug.cgi?id=15191

            Bug ID: 15191
           Summary: GCOVProfiling __gcov_flush only flushes the current
                    compilation unit
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Miscellaneous Instrumentation passes
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Using clang with -ftest-coverage -fprofile-arcs and calling __gcov_flush will
only flush the current compilation unit instead of flushing all of the coverage
data.

For instance:

$ cat foo.c
#include <stdio.h>
void foo() {
  for (int i = 0; i < 10; i++) {
    printf("foo %d\n", i);
  }
  __gcov_flush();
}

$ cat main.c
#include <stdio.h>
extern void foo();
int main() {
  foo();
  for (int i = 0; i < 10; i++) {
    printf("main %d\n", i);
  }
  int *a;
  *a = 4; // Crashes the app, so only the flushed coverage prints
}

$ clang -fprofile-arcs -ftest-coverage -g foo.c main.c
$ ./a.out
[1]    74979 segmentation fault  ./a.out
$ gcov main.c 
main.gcda:cannot open data file, assuming not executed
File 'main.c'
Lines executed:0.00% of 7
main.c:creating 'main.c.gcov'


If you do the same thing with gcc, it will flush all of the buffers thus, it
produces some coverage data for main.c.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to