[PATCH 8/N][RFC] GCOV: support multiple functions per a line

Martin Liška mliska@suse.cz
Thu Oct 26 08:47:00 GMT 2017


Hi.

As mentioned in cover letter this patch was main motivation for the whole series.
Currently we have a list of lines (source_info::lines) per a source file. That's
changed in the patch, now each functions has:
map<unsigned, vector<line_info>> source_lines;
Thus separate lines for function for each source file the function lives in.
Having a group of function starting on a line, we print first summary and then
each individual function:

        -:    1:template<class T>
        -:    2:class Foo
        -:    3:{
        -:    4:  public:
        3:    5:  Foo()
        -:    6:  {
        3:    7:    b = 123;
        3:    8:  }
------------------
Foo<int>::Foo():
        1:    5:  Foo()
        -:    6:  {
        1:    7:    b = 123;
        1:    8:  }
------------------
Foo<float>::Foo():
        2:    5:  Foo()
        -:    6:  {
        2:    7:    b = 123;
        2:    8:  }
------------------
        -:    9:
       1*:   10:  void test() { if (!b) __builtin_abort (); b = 111; }
------------------
Foo<int>::test():
       1*:   10:  void test() { if (!b) __builtin_abort (); b = 111; }
        1:   10-block  0
    %%%%%:   10-block  1
------------------
Foo<float>::test():
    #####:   10:  void test() { if (!b) __builtin_abort (); b = 111; }
    %%%%%:   10-block  0
    %%%%%:   10-block  1
------------------
        -:   11:
        -:   12:  private:
        -:   13:  int b;
        -:   14:};
        -:   15:
        -:   16:template class Foo<float>;
        -:   17:template class Foo<int>;
        -:   18:
        1:   19:int main()
        -:   20:{
        1:   21:  Foo<int> xx;
        1:   21-block  0
        1:   22:  Foo<float> yy;
        1:   22-block  0
        1:   23:  Foo<float> zz;
        1:   23-block  0
        1:   24:  xx.test();
        1:   24-block  0
        -:   25:
        1:   26:  return 0;
        1:   26-block  0
        -:   27:}

It's also reflected in intermediate format, where lines are repeated. Currently no summary is done.

That patch is work in progress, tests are missing, documentation should be improved significantly
and changelog has to be written.

However I would like to get a feedback before I'll finish it?

Thanks,
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-GCOV-support-multiple-functions-per-a-line.patch
Type: text/x-patch
Size: 28436 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20171026/982adb84/attachment.bin>


More information about the Gcc-patches mailing list