1. dgcov should be supported with gcc version gcc 4.9.4+ since there is -i option introduced.
2. json format found from here that is introduced with 9.1.0. Looking from all releasechanges for 9.1.0
The following improvements to the gcov command-line utility have been made.
The gcov tool received a new option --use-hotness-colors (-q) that can provide perf-like coloring of hot functions.
The gcov tool has changed its intermediate format to a new JSON format.
1. dgcov should be supported with gcc version gcc 4.9.4+ since there is -i option introduced.
2. json format found from here that is introduced with 9.1.0. Looking from all release changes for 9.1.0
The following improvements to the gcov command-line utility have been made.
The gcov tool received a new option --use-hotness-colors (-q) that can provide perf-like coloring of hot functions.
The gcov tool has changed its intermediate format to a new JSON format.
and seems that in that version intermediate format was deprecated. Additional links [2].
Link:
[1] Zulip analysis
[2]Support GCOV intermediate format
perl bundles JSON::PP starting from the version v5.13.9. While not the fastest it can hopefully be enough for dgcov purposes and will work without additional dependencies.
Sergei Golubchik
added a comment - perl bundles JSON::PP starting from the version v5.13.9. While not the fastest it can hopefully be enough for dgcov purposes and will work without additional dependencies.
I don't understand the second question. What do you mean to "take care of JSON::PP" ?
Sergei Golubchik
added a comment - of course, you're the assignee
I don't understand the second question. What do you mean to "take care of JSON::PP" ?
Well I mean, do I need any preprocessing after it? I managed to create the script where locally everything works.
However I have a problem with gcno files which should be generated when compiling - they are not created:
Anel Husakovic
added a comment - Well I mean, do I need any preprocessing after it? I managed to create the script where locally everything works.
However I have a problem with gcno files which should be generated when compiling - they are not created:
$ gcc --version && gcov --version && g++ --version
gcc (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcov (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
g++ (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cmake . -DCMAKE_BUILD_TYPE=Debug -DCONC_WITH_{UNITTEST,SSL}=OFF -DWITH_EMBEDDED_SERVER=OFF -DWITH_UNIT_TESTS=OFF -DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,CONNECT,PERFSCHEMA,SPIDER,SPHINX}=NO -DWITH_SAFEMALLOC=OFF -DWITH_SSL=bundled -DENABLE_GCOV=ON
# Result with empty files
Locally tests:
$ ls
main1.h main.c Makefile test.pl
$ gcc --coverage main.c
$ ls
a.out main1.h main.c main.gcno Makefile test.pl
$ gcc --coverage -c main.c
$ ls
main1.h main.c main.gcno main.o Makefile test.pl
Also I found some [regression] ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97193 ) in gcov and I'm not sure is it related.
Hi Serg,
can you please review 6296c32b10ed2 have problem with write_coverage of created hash cov from function gcov_one_file?
Anel Husakovic
added a comment - Hi Serg,
can you please review 6296c32b10ed2 have problem with write_coverage of created hash cov from function gcov_one_file ?
Yes and I have used json_pp -f <from-type> -t <to-type>here to pretty (default option -t json -json_opt pretty) the json file.
Other type -t dumper can be used, but not sure, how to use the output of Data::Dumper ($VAR1) on one or multiple files.
Did you mean to use that conversion?
This is a complete demo program, if you run it with a gcda.gcov.json.gz file as an argument, it'll print you all functions in all files in this json file. For example,
$ ./a.pl gen_lex_token.cc.gcda.gcov.json.gz
file: sql/gen_lex_token.cc
..function: set_token(int, char const*)
..function: set_start_expr_token(int)
..function: compute_tokens()
..function: print_tokens()
..function: main
Sergei Golubchik
added a comment - Why are you even looking at json_pp ? Just use JSON::PP module. Like this:
#!/usr/bin/perl -l
use IO::Uncompress::Gunzip qw(gunzip $GunzipError );
use JSON::PP;
my $js ;
gunzip $ARGV [0] => \ $js or die "gunzip($ARGV[0]): $GunzipError" ;
my $obj =decode_json $js ;
for my $file (@{ $obj ->{files}}) {
print "file: $file->{file}" ;
for my $fn (@{ $file ->{functions}}) {
print "..function: " , $fn ->{demangled_name} || $fn -{name};
}
}
This is a complete demo program, if you run it with a gcda.gcov.json.gz file as an argument, it'll print you all functions in all files in this json file. For example,
$ ./a.pl gen_lex_token.cc.gcda.gcov.json.gz
file: sql/gen_lex_token.cc
..function: set_token(int, char const*)
..function: set_start_expr_token(int)
..function: compute_tokens()
..function: print_tokens()
..function: main
perl bundles JSON::PP starting from the version v5.13.9. While not the fastest it can hopefully be enough for dgcov purposes and will work without additional dependencies.