https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89959
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2019-04-04 Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org Target Milestone|--- |9.0 Ever confirmed|0 |1 --- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> --- Hi. Thank you very much for using the GCOV. > > a) Running "gcov -r -s <source_dir> -o <object directory> <.gcda file>" I > get files like > > <source file>.gcov > > > b) Running "gcov -p -r -s <source_dir> -o <object directory> <.gcda file>" I > get files like > > <relative path to the source file>.gcov > > > c) Running "gcov -x -r -s <source_dir> -o <object directory> <.gcda file>" I > get files like > > <source file>##<hash>.gcov > > > d) Running "gcov -p -l -r -s <source_dir> -o <object directory> <.gcda > file>" I get files like > > <full path to the .gcda file>##<relative path to the source file>.gcov > > > e) Running "gcov -x -l -r -s <source_dir> -o <object directory> <.gcda > file>" I get files like > > <source file>##<hash>.gcov > > > > Notice that 'c' and 'e' are identical, "-l" in 'e' has had no effect. I > would have expected 'e' to be > > <full path to the .gcda file>##<source file>##<hash>.gcov > > > > Also, notice that the documentation for --hash-filenames starts by saying: > "By default, gcov uses the full pathname of the source files to create an > output filename." That's incorrect, by default it uses only the filename. Correct, I'll fix that in documentation. > The documentation would be more clear if it would describe > "--hash-filenames" as an alternative to "--preserve-paths". Exactly, the documentation describes problem of long file-names, but it should make it clear that -l would be ignored. Interestingly, > when "-x" is being used "-l" is ignored... but "-p" isn't. So it's possible > to use "-p" and "-x" simultaneously, which makes no sense. You are using > "-x" to avoid long filenames, but by using it together with "-p" you are > just making the filename *longer*. You are right, -p should be also ignored in case of -x usage. > > > > > FWIW the reason I'm using "-l" is not because I "want to see the individual > contributions". My problem is that I'm using CDash (www.cdash.org), which > runs gcov once per .gcda instead of running it a single time taking all the > .gcda files as input (they should fix this > https://gitlab.kitware.com/cmake/cmake/issues/19124#note_554321, but there > may be others). > By running gcov once per .gcda file the .gcov file for a header created by > one invocation can get overwritten by the next .gcov invocation. Using "-l" > works around this issue. > Again, the problem is that CDash is using gcov incorrectly and they should > fix the issue. But since I suspect they are not the only ones... maybe it > makes sense to have another option to use the hash of the .gcda file? > Meaning, running "gcov -x --hash-long-file-names -r -s <source_dir> -o > <object directory> <.gcda file>" I would get files like > > <gcda_path_hash>##<source file>##<source_file_path_hash>.gcov Please now, even now the complexity of option combination is quite huge :) > > Which would let me, using short file names, call gcov once per .gcda file > without the risk of overwriting .gcov files. Then I would recommend using -l option.