<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - GCOVProfiling __gcov_flush only flushes the current compilation unit"
href="http://llvm.org/bugs/show_bug.cgi?id=15191">15191</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>GCOVProfiling __gcov_flush only flushes the current compilation unit
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Miscellaneous Instrumentation passes
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ash.gti@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>