Note that there are some explanatory texts on larger screens.

plurals
  1. POCode coverage not showing results using Xcode + gcov
    primarykey
    data
    text
    <p>I have been trying to get the Code coverage working for iPhone simulator and always get a 0% coverage. Below are the configuration details and the steps that I have tried.</p> <p><strong>Configuration</strong></p> <p>Xcode 3.2.5/iOS 4.1 and iOS 4.2/Mac 10.6/GCC 4.2 Application UICatalog </p> <p><strong>References</strong></p> <p><a href="http://www.cubiclemuses.com/cm/articles/2009/05/14/coverstory-on-the-iphone/" rel="noreferrer">http://www.cubiclemuses.com/cm/articles/2009/05/14/coverstory-on-the-iphone/</a></p> <p><a href="http://developer.apple.com/library/mac/#qa/qa2007/qa1514.html" rel="noreferrer">http://developer.apple.com/library/mac/#qa/qa2007/qa1514.html</a> </p> <p><strong>Steps</strong></p> <ul> <li>Enable “Generate Test Coverage Files”</li> <li>Enable “Instrument Program Flow”</li> <li>Add “<code>-lgcov</code>” to “Other Linker Flags”</li> <li><code>UIApplicationExitsOnSuspend</code> flag in Info.plist is set to true</li> </ul> <p><strong>Result</strong></p> <p>I have the .gcda files generated but the coverage always show 0%. </p> <p><strong>Settings tried</strong></p> <ol> <li><p>Changing GCC to 4.0 and 4.2. When I try to change the GCC to 4.0 I get 26 build errors.</p></li> <li><p>Set environment variables </p> <pre><code>(const char *prefix = "GCOV_PREFIX"; const char *prefixValue = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] cStringUsingEncoding:NSASCIIStringEncoding]; // This gets the filepath to the app's Documents directory const char *prefixStrip = "GCOV_PREFIX_STRIP"; const char *prefixStripValue = "1"; setenv(prefix, prefixValue, 1); // This sets an environment variable which tells gcov where to put the .gcda files. setenv(prefixStrip, prefixStripValue, 1); // This tells gcov to strip the default prefix, and use the filepath that we just declared.) </code></pre></li> <li><p>GCC Optimization set to None (-O0) and unchecked the precompiled prefix header file flag.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload