branches within C++ destructors (gcov)

Elden Crom EldenC@TucsonEmbedded.com
Fri Feb 19 05:30:00 GMT 2010


I think your seeing branches that occur in inlined functions.
Try using printf(...) instead of cout<< along with moving functionABC to an out of line function (asumming -O0)
and I think the results will make more sense.

And for the last 3, I think it is due to the virtual destructors, perhaps a resudual of potential multiple inheritance?
(I'm kinda suprized too)

 

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Rohit Gupta
Sent: Thursday, February 18, 2010 4:05 AM
To: gcc-help@gcc.gnu.org
Subject: Re: branches within C++ destructors (gcov)

Hi ,

Can I have some clue(help)  from the hierarchy class file dumped by gcc option -fdump-class-hierarchy .In which there are details about Vtable entries for classes.

--
Thanks and Regards,
Rohit Gupta
--

On 02/18/2010 03:52 PM, Rohit Gupta wrote:
> Hi ,
>
>
> I am having problem understanding branches ( number ) generated by 
> gcov report for
> c++ program. Might you please clear my doubts.
>
> #include<iostream>
>
> using namespace std;
>
> class A
> {
> public:
>          A()
>          {
>          }
>          virtual void functionABC (int value)
>          {
>                          cout<<value;
>          }
>          virtual ~A()
>          {
>          }
> };
> class B : public virtual A
> {
> public:
>          B()
>          {
>          }
>          virtual ~B()
>          {
>          }
> };
> class C : public B
> {
> public:
>          C()
>          {
>          }
>          virtual ~C()
>          {
>          }
>
> };
>
> int main(int argc, char ** argv)
> {
>
>          A a;
>          B b;
>          C c;
>          return 0;
> }
>
> Gcov report for the following is attached.
>
> Any help will be greatly appreciated.
>




More information about the Gcc-help mailing list