I am trying to use gcov on the iPhone Project and following the instructions from Apple described here here , but this will not work.
When I create and set up a project, a .gcda file is created for each object file. But no executed lines are written to .gcda files. (CoverStory shows that all coverage is 0%)
I just added a simple class to the template project as follows.
@interface SomeClass : NSObject
- (void)func1:(BOOL)flag;
@end
@implementation SomeClass
- (void)func1:(BOOL)flag {
if (flag) {
NSLog(@"flag is YES");
}
else {
NSLog(@"flag is NO");
}
}
@end
I highlighted this class and called func1 in the application: didFinishLaunchingWithOptions, and I expected SomeClass coverage to be shown (50% or so).
I am using OSX 10.6.4, iPhone SDK 4.0 and Xcode 3.2.3. Need a few more configurations? Please guide.
UPDATE 2010/7/15:
@tonclon , .
, .
Cocoa , GCC 4.0
Cocoa,
- GCC_INSTRUMENT_PROGRAM_FLOW_ARCS YES
- GCC_GENERATE_TEST_COVERAGE_FILES YES
- Linker -lgcov
- C/++ 4.0
, .gcda , .
iPhone SDK 4.0 โโ ,
gcc 4.0 SDK 4.0 (ex Blocks)
gcov google-tool-box
-lgcov Other Linker Flag,
gcov, google-toolbox-for-mac,
.gcda , 0%. ( )
, ? .