The options "-l -p" of gcov sometimes create names for .gcov files that exceed the maximum file name length of 255 characters under Linux. I managed to get this file name (261 characters): #home#build#devel#wheel#linux#gcc41#ICOSOFT#PROJECTS#Libraries#D#DataRepository#Library#jam#linux#gcc41#profile#static#NetworkRetriever.gcda###home#build#devel#wheel#linux#gcc41#ICOSOFT#EXTLIBS#BOOST1#1.35.0#include#boost#detail#sp_counted_base_gcc_x86.hpp.gcov gcov in this case returns with the error "could not open output file". In my case I have a file name collision that forces me to use "-l -p". However since "gcov -l -p" fails I am stuck. I wonder why no UID or numbering scheme is used for .gcov files. The output of gcov clearly tells which source file is linked to a given .gcov file. Example (now): File '/usr/include/c++/4.1/bits/locale_facets.tcc' Lines executed:0.00% of 12 /usr/include/c++/4.1/bits/locale_facets.tcc:creating 'HelloWorld.gcda##locale_facets.tcc.gcov' The last line could be changed to something like: /usr/include/c++/4.1/bits/locale_facets.tcc:creating 'HelloWorld.gcda##000001.gcov' or /usr/include/c++/4.1/bits/locale_facets.tcc:creating 'HelloWorld.gcda##c5bbbc5921be4028b2a2cf44a2c04d90.gcov' The source file can later also be deduced from the header within the .gcov file: -: 0:Source:/usr/include/c++/4.1/bits/locale_facets.tcc So nothing would be lost by removing the source information from the .gcov file name.
Confirmed, it's quite valid use-case, I'm having a patch for that. It's quite a lot time since the PR was created, but it may by still usefull.
Hello Martin It's great that you came up with a solution! Meanwhile I removed "-l" from the command line to avoid the error and use an additional script to rename files as soon as they are generated by gcov. This way file name collisions leading to overwritten files are prevented. Once your solution is present in a binary distribution I'm happy to remove all these workarounds. Regards, Peter.
(In reply to Peter Klotz from comment #2) > Hello Martin > > It's great that you came up with a solution! > > Meanwhile I removed "-l" from the command line to avoid the error and use an > additional script to rename files as soon as they are generated by gcov. > This way file name collisions leading to overwritten files are prevented. > > Once your solution is present in a binary distribution I'm happy to remove > all these workarounds. > > Regards, Peter. Hi Peter. I'm happy that you're using GCC and that the request is still more than valid. I expect it's going to be accepted to trunk soon: https://gcc.gnu.org/ml/gcc-patches/2016-08/msg00721.html What compiler version are you using, I may backport the patch if you are interested (cause GCC 7.1 is going to be released in ~May 2017)?
Hi Martin The company I work for makes heavy use of Red Hat Enterprise Linux 7. According to this article, a GCC 6 based Red Hat Developer Toolset should be available in the not too distant future. http://developers.redhat.com/blog/2016/02/23/upcoming-features-in-gcc-6/ So a backport to the GCC 6 release series would help. Regards, Peter.
Author: marxin Date: Tue Aug 16 14:14:18 2016 New Revision: 239503 URL: https://gcc.gnu.org/viewcvs?rev=239503&root=gcc&view=rev Log: gcov: add new option (--hash-filenames) (PR PR gcov-profile/36412 * doc/gcov.texi: Document --hash-filenames(-x). * gcov.c (print_usage): Add the option. (process_args): Process the option, sort options alphabetically. (md5sum_to_hex): New function. (make_gcov_file_name): Do the md5sum and append it to a filename. Modified: trunk/gcc/ChangeLog trunk/gcc/doc/gcov.texi trunk/gcc/gcov.c
Fixed on trunk.