← Back to team overview

maria-developers team mailing list archive

Re: 203aa38f9b6: MDEV-26102: gcov 9.1 doesn't support intermediate format any more, but json instead - refactoring needed

 

Hi Serg,
thanks for your review.


> > +
> > +my $gcc_version= `gcc -dumpversion`;
> > +$gcc_version=~ s/(\d).*$/$1/;
>
> you don't need this second line, I suspect
>
>
It is not unique for all versions, that's why I used it:

$ for i in 5 6 7 9 10; do $(/usr/bin/gcc-$i -dumpversion); done
5.5.0: command not found
6.5.0: command not found
7: command not found
9: command not found
10: command not found


> and write `my $fname` here
>
> > +      for my $line (@{$file->{lines}}){
> > +        $cov{$fname}->{$line->{line_number}}= $line->{count};
>
> shouldn't it be += $line->{count} ?
> The point is to accumulate all counters, see how it's done for non-json
> intermediate format.
>
> > +      }
> > +    }
> >    }
> >  }
> >
>
Have seen  and I'm not sure how it accumulates since per line "line_number"
value is different (I haven't seen 'lcount' to have the same
line_number), so the hash is different and += doesn't take effect.
Confirmed that I'm getting the same result with/without += for both
versions ( since line number is a function of  the counter (one to one
relationship) ?)
Maybe to remove += from gcc < 9.1 ?
gcov 7.5:
$ cat sql_show.cc.gcda##field.h.gcov

lcount:847,20 # this line : line_number=847, count = 20
lcount:848,20 # not the same as this one, line_number=848, 20
lcount:851,0
lcount:852,0
lcount:878,0
lcount:981,1181

gcov 9.4:
$ cat <some.gcda.gcov file>
        "lines" : [
            {
               "unexecuted_block" : false,
               "function_name" : "sum",
               "count" : 1,
               "branches" : [],
               "line_number" : 3  # this line
            },
            {
               "function_name" : "sum",
               "unexecuted_block" : false,
               "count" : 1,
               "line_number" : 5, # is not the same as this line
               "branches" : []
            }
         ],

However I'm confirming that there is different result in counter for the
same test and I'm suspecting it is the result of generated parsing between
gcov versions:
gcov 7.5 ( counter = 88):
*********************
dgcov sql/sql_show.cc
*********************
@@ +6601,7 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST
*tables,
         : 6601:      }
         : 6602:#endif
         : 6603:      Virtual_column_info *check=
tables->table->check_constraints[i];
       88: 6605:      table->field[0]->store(STRING_WITH_LEN("definition"),
system_charset_info);
         : 6606:      table->field[3]->store(check->name.str,
check->name.length,
         : 6607:                             system_charset_info);

gcov 9.4 ( counter = 44):
*********************
dgcov sql/sql_show.cc
*********************
@@ +6601,7 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST
*tables,
         : 6601:      }
         : 6602:#endif
         : 6603:      Virtual_column_info *check=
tables->table->check_constraints[i];
       44: 6605:      table->field[0]->store(STRING_WITH_LEN("definition"),
system_charset_info);
         : 6606:      table->field[3]->store(check->name.str,
check->name.length,
         : 6607:                             system_charset_info);

Regards,
Anel

> _____________________________________
> Mailing list: https://launchpad.net/~maria-developers
> Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maria-developers
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References