<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 --- - __gcov_flush does not flush dynamically loaded libraries"
   href="http://llvm.org/bugs/show_bug.cgi?id=16893">16893</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__gcov_flush does not flush dynamically loaded libraries
          </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>normal
          </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>Created <span class=""><a href="attachment.cgi?id=11037" name="attach_11037" title="A simple example that shows the problem, use `make cov`">attachment 11037</a> <a href="attachment.cgi?id=11037&action=edit" title="A simple example that shows the problem, use `make cov`">[details]</a></span>
A simple example that shows the problem, use `make cov`

Calling __gcov_flush() does not flush coverage in dynamically loaded libraries.

Even if the bundle calls __gcov_flush() from a function inside the loaded
bundle it does not flush the coverage of the bundle. 

I have a simple example I can attach but to summarize:


cat bundledobject.m

@implementation MyBundledObject
- (void)doSomething {
    NSLog(@"Someone called [- MyBundledObject doSomething]");
    __gcov_flush();
}
@end


cat main.m

int main() {

  Class exampleClass = [bundle classNamed:@"MyBundledObject"];
  id newInstance = [[exampleClass alloc] init];
  [newInstance doSomething];
  __gcov_flush();
  int *i = 0;
  *i = 2; // Causes a seg fault to prevent normal __gcov_flush's from happening



The resulting gcda files will have no data for any object loaded from the
bundle. 

If this is not the correct way to flush the coverage buffers in loaded
libraries, please let me know.</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>