https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89961
--- Comment #16 from Martin Liška <marxin at gcc dot gnu.org> --- All right, so what's different about JSON and non-JSON mode: 1) normal mode: gcov src/a.c test/a.c First, gcda/gcno files are searched for both the arguments (so src/a.gcda, ..) and then output is emitted for all mentioned source files (can be .c or .h files). Note the output files x.gcov are based on *SOURCE* file names, so e.g.: File 'tramp3d-v4.cpp' Lines executed:0.00% of 7339 Creating 'tramp3d-v4.cpp.gcov' File '/usr/include/c++/6/ext/new_allocator.h' Lines executed:0.00% of 14 Creating 'new_allocator.h.gcov' File '/usr/include/c++/6/ext/aligned_buffer.h' Lines executed:0.00% of 8 Creating 'aligned_buffer.h.gcov' File '/usr/include/c++/6/bits/move.h' Lines executed:0.00% of 11 Creating 'move.h.gcov' ... 2) in JSON mode, we basically emit JSON output for each GCDA file (deduced from arguments). What's currently wrong is that for $ gcov src/a.xxxxx b.yyyyyy --json-format The following 2 files should be created (right now b.gcov.json.gz and a.gcov.json.gz are created) b.gcov.json.gz src/a.gcov.json.gz and so -p and -x does not play any role here. Does it make sense to you? If so, I'm prepared sending a patch candidate.