profiling "invalid arc tag" (0x00000000)

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.

c++
qt
logging
code-coverage
asked on Stack Overflow May 19, 2014 by Martin Delille • edited May 21, 2014 by Martin Delille

1 Answer

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
answered on Stack Overflow May 21, 2014 by Thomas Ayoub • edited Nov 16, 2018 by rioV8

User contributions licensed under CC BY-SA 3.0