Since 3.4 version of GCC, the functions naming in gcov seems to be changed.
When using '-f' option of gcov, the function names are no more
ClassName::MethodName but have C++ name mangling. For example :

=========== EXAMPLE BEGIN ===================
::::::::::::::
 myClass.h
::::::::::::::
class myClass {

 public:

  myClass(const int & i) : m_integer(i) {};
  virtual ~myClass() {};
  void testInteger();

 private:
  int m_integer;

};
::::::::::::::
myClass.cpp
::::::::::::::
#include "myClass.h"
#include <iostream>


  void myClass::testInteger()
{

  if (m_integer > 10)
    {
      std::cout << "Integer > 10" << std::endl;
    }
  else
    {
      std::cout << "Integer <= 10" << std::endl;
    }
}

::::::::::::::
myTest.cpp
::::::::::::::
#include "myClass.h"

int main()
{
  myClass oneClass(9);
  oneClass.testInteger();
  return 0;
}

=============== EXAMPLE END ====================

If I compile and execute this test :
  $ g++ --version
   g++ (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
...
  $ g++ -fprofile-arcs -ftest-coverage *.cpp
  $ ./a.out
  Integer <= 10
  $ gcov -f myClass.cpp >gcov_summary
  $ more gcov_summary
   Function `_ZSt17__verify_groupingPKcmRKSs'
   Lines executed:0.00% of 11

   Function `_ZN7myClass11testIntegerEv'
   Lines executed:75.00% of 4

   Function `_ZSt3minImERKT_S2_S2_'
   Lines executed:0.00% of 4

   Function `_Z41__static_initialization_and_destruction_0ii'
   Lines executed:100.00% of 2

   Function `__tcf_0'
   No executable lines
   Function `_GLOBAL__I__ZN7myClass11testIntegerEv'
   Lines executed:100.00% of 1

   File   
`/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../include/c++/3.4.5/bits/locale_facets.tcc'
   Lines executed:0.00% of 11
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../include/c++/3.4.5/bits/locale_facets.tcc:creating
 `locale_facets.tcc.gcov'
.....

The natural name of method myClass::testInteger has been changed to
_ZN7myClass11testIntegerEv

This behaviour does not occur in version 3.2.3 of GCC.
It still occurs with 3.4.3 and 4.0.2 (on the same platform).

Is this a bug or a new normal behaviour ?

This naming approach does make easy post-processing of test
coverage rates especially for a large critical software.
Is there any way to fix that, or to translate "decorated" 
function names to "natural" name (i.e. class::method).

Thanks for help


-- 
           Summary: function naming in GCOV since 3.4 series
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: gcov/profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snordin_ng at yahoo dot fr
 GCC build triplet: i686-linux-2.6.9-5.ELsmp
  GCC host triplet: i686-linux-2.6.9-5.ELsmp
GCC target triplet: i686-linux-2.6.9-5.ELsmp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28478

Reply via email to