2

I have the follwing error when executing a program with code coverage enabled:

profiling "invalid arc tag" (0x00000000)

Removing the *.gnca files fix the issue but I was wondering if there was a trick to avoid its generation.

Here is an example Qt project to reproduce the problem:

// example.pro
QT       += core
QT       -= gui

TARGET = example
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app

QMAKE_CXXFLAGS += -g -O0 -fprofile-arcs -ftest-coverage
QMAKE_LFLAGS += -g -O0 -fprofile-arcs -ftest-coverage

SOURCES += main.cpp \
    MyClass.cpp

HEADERS += \
MyClass.h

The main.cpp file:

// main.cpp
int main(int argc, char *argv[])
{
    return 0;
}

My object header:

// myclass.h

#ifndef MYCLASS_H
#define MYCLASS_H

#include <QObject>

class MyClass : public QObject
{
    Q_OBJECT
public slots:
    void slot1();
}

#endif // MYCLASS_H

And its implementation:

// myclass.cpp

#include "myclass.h"
void MyClass::test1()
{
}

Create the project and compile it, then add another slot to MyClass (eg: void test2()).

It then trigger the warning during execution time.

I'm using Qt 5.2.1 under MacOSX 10.9.

Martin Delille
  • 11,360
  • 15
  • 65
  • 132
  • 1
    Can you provide an [SSCCE](http://sscce.org) along with the steps to reproduce it, including the platform, Qt version used, etc? Is it even Qt related? – László Papp May 20 '14 at 03:20
  • I just add a example project with the step to reproduct the warning. Can you reproduce it? – Martin Delille May 21 '14 at 17:19

1 Answers1

4

Quoting from this post (Dozens of "profiling:invalid arc tag" when running code coverage in Xcode 5)

Most likely this is a result of the build tools failing to merge current results into the existing .gcda coverage files. As Dave Meehan points out here, there is a brute force way of dealing with this by cleaning the product build folder, but a less hard core approach is to delete the .gcda files from targets generating them (for me, just the test target) as part of the build process. Dave includes a sample script to be included as a build phase -- or, at the project root by hand:

find . -name "*.gcda" -print0 | xargs -0 rm

Or a bit shorter

find . -name "*.gcda" -delete
rioV8
  • 24,506
  • 3
  • 32
  • 49
Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142