This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Issues with autogenerated <built-in> when using --coverage, gcov, and lcov


Hello,

I am struggling to use gcov, lcov, and its helpers geninfo and genhtml to document unit test coverage of a user-level application I am developing in C. I got gcov to work with little difficulty. It's the other commands that are causing me trouble.

My problem is that <built-in>.gcov, which I can't see a reason for existing, is making the program crash. This is strange, because I don't have anything named "<built-in>" in my source code!

I built my program using make and gcc ( with the '--coverage' flag. Other flags used: '-Wall -g -lm -std=c99 -DDEBUG'. I am using the complex.h library in c99.

Versions of various things:
-Ubuntu 10.04 (64bit).

-$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)


-GNU Make 3.81 built for x86_64-pc-linux-gnu
-gcov (Ubuntu 4.4.3-4ubuntu5) 4.4.3
-lcov version 1.7


Here's the shell from where I got the error after running my executable. I am running the gcc command in my 'bin' directory, so that's where I've run *cov (as you're supposed to do).


$ lcov -o utests.info -c -d .
Capturing coverage data from .
Found gcov version: 4.4.3
Scanning . for .gcda files ...
Found 8 data files in .
Processing ./cp_process.gcda
geninfo: ERROR: cannot read <built-in>.gcov!


I cleaned and rebuilt, and grepped for 'built-in'. Here's what I found:
$ rgrep "built-in" .
Binary file ./bin/main.gcno matches
Binary file ./bin/unit_tests.exe matches
Sure enough, I saw "<built-in>" in a hex editor. I have no idea what that little bit of ascii is - it's not a symbol name, as nm didn't find it in unit_tests.exe.



To verify my theory, I ran gcov and all my files. It failed on main.c thanks to <built-in>. Here's the shell output:
$ gcov main.c
File 'main.c'
Lines executed:100.00% of 21
main.c:creating 'main.c.gcov'


File '<built-in>'
No executable lines
<built-in>:creating '<built-in>.gcov'
<built-in>:cannot open source file

So this unwanted "<built-in>" is getting generated by the compiler, and only for my main.c.


I searched for 'built-in', 'built', and variations in the man pages for gcov, lcov, and gcc. I found the gcc options -fhosted and its opposite -fno-builtin. Neither one got rid of "<built-in>".



I have been unable to even find another occurrence of this error message online. <built-in> is impossible to find in a search engine for two reasons: 1) the special characters '<' and '>' and 2) "built-in" is about as generic a phrase as you can get, so those words combined with gcov give unrelated results.


I hope you can help me fix this problem, and that perhaps I have found an issue that is worth fixing or documenting.

Sincerely,
Boone Adkins

P.S. I am trying to get it done manually, using gcov, geninfo, and genhtml. I have gotten it to work with a single file, but have yet to get geninfo or genhtml to accept two files.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]