Dozens of "profiling: invalid arc tag" when running code coverage in Xcode 5

When I run my test target with code coverage enabled in Xcode 5, I get tens of the following message as a result of the assembly:

profiling:invalid arc tag (0x...) 

This does not affect the tests, as they complete successfully, and GCDA coverage files are generated as expected.

Any idea what the message means, or how to suppress messages / fix the problem, because they clutter up the assembly output and make it difficult to find test case results.

+47
ios objective-c xcode code-coverage
Mar 19 '14 at 10:30
source share
7 answers

This is most likely due to the fact that the build tools cannot merge the current results into existing .gcda files. As Dave Meehan points out here , there is brute force involved in cleaning up the product’s build folder, but a less rigid main approach is to remove .gcda files from the chains that generate them (for me, only for the target purpose) as part of the build process. Dave includes a sample script for inclusion in the build phase - or in the project root manually:

 find . -name "*.gcda" -print0 | xargs -0 rm 
+45
Apr 09 '14 at 23:54 on
source share

For Xcode 7 users, you may have wondered why your Unit Tests failed after receiving such messages. The solution I found was that you need to make sure that all possible targets related to the assembly stream (including all libraries) must have these two assembly parameters: NO:

 GCC_GENERATE_TEST_COVERAGE_FILES = NO; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO; 

If you are looking for the "Code Generation" section in the build settings, you will find them as "Generate Test Coverage Files" and "Tool Flow".

See https://developer.apple.com/library/ios/qa/qa1514/_index.html for details

+31
Jul 21 '15 at 15:13
source share

An old question, but now Xcode 7 GM has come out, and this behavior has not changed, I took a deeper look. I believe the problem is that code coverage of the target test program is contrary to code coverage by the main goal.

Assuming that you don’t really care about the coverage of your target topic code, these settings stop errors for me, without the need for additional scripts or deleting files:

For your main goal (whether it be a framework or an application):

  Enable Code Coverage Support to YES Generage Legacy Test Coverage Files to YES Instrument Program Flow to YES 

For my purposes, I did this only for building a Debug, but your needs may vary.

Then in your target test suite:

  Enable Code Coverage Support to NO Generage Legacy Test Coverage Files to NO Instrument Program Flow to NO 

This allowed error messages and still allowed code coverage files to be created accordingly.

Again, the question is old, but since the error still appears in Xcode 7, I found that this solution works better than deleting files with special scripts.

+4
Sep 09 '15 at 10:20
source share

I have the same problem. In my appDelegate under applicationWillTerminate: I have __gcov_flush(); . By commenting on this, invalid arc tag messages in my build release are deleted.

I am doing further research to understand why this is happening. I know that if I completely clean my project and delete the DerivedData directory, these messages will stop for a few runs of my tests.

EDIT: I seem to have fixed this for me. In my appDelegate application, I had the following:

 #ifdef DEBUG + (void)initialize { [[NSUserDefaults standardUserDefaults] setValue:@"XCTestLog,GcovTestObserver" forKey:@"XCTestObserverClass"]; [super initialize]; } #endif 

I spelled GcovTestObserver incorrectly, and after fixing this message stopped. Make sure you also have a subclass of XCTestObserver in your test stopObserving target environment with the following:

 - (void) stopObserving { [super stopObserving]; UIApplication* application = [UIApplication sharedApplication]; [application.delegate applicationWillTerminate:application]; } 
+2
Mar 23 '14 at 19:28
source share

You might want to clear all derived data folders. Especially if you are updating Xcode or using more than one version of Xcode.

I experienced this right after I upgraded Xcode from 6.2 to 6.3 on our integration server, and we saw these log messages, as well as the missing classes in the coverage report generated by frankencover.it . Removing the DerivedData folders inside the integration server fixes it.

 find /Library/Developer/XcodeServer -name DerivedData -print0 | xargs -0 rm -rf 
0
Apr 16 '15 at 2:33
source share

I spent some time trying to figure out how to get rid of these ugly and annoying messages:

profiling: /Users/appfactory/Desktop/WORK/App/trunk/ObjectiveC.gcda: cannot merge the previous GCDA file: damaged arc tag (0x00000000)

It seemed that the Xcode 7 problem was not fixed in the current version of Xcode 7.1 beta 2.

The problem arises from the inability to combine existing .gcda coverage files with current results.

What I tried:

  • Delete these .gcda files using RunScript - does not work in my case

echo "Delete .gcda files" echo "$ {OBJECT_FILE_DIR_normal} / $ {CURRENT_ARCH}"

Caution: the ObjectiveC.gcda file may be located elsewhere!

  1. Set the following YES build settings - also without helping

    • Enable Code Support for YES

    • Generate outdated security test materials up to YES

    • Tool program flow in YES

  2. The solution in my case is:

Set the following build options for the primary purpose

  • Enable Code Support for YES

  • Generate outdated security test materials up to YES

  • Instrument program stream in NO

Set the following build options for the target (and any other goals)

  • Enable NO code coverage support

  • Generate obsolete test coverage files up to NO

  • Instrument program stream in NO

Hope this helps!

-2
Oct 02 '15 at 20:48
source share

To fix the problem of receiving the message “failed to combine the previous messages of the GCDA file: damaged arc tags” in the console, do not create the ObjectiveC.gcda file by setting “Enable Modules (C and Objective-C)” to “NO” in the target settings.

-2
Dec 14 '15 at 10:22
source share



All Articles