This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: branches within C++ destructors (gcov)
- From: Elden Crom <EldenC at TucsonEmbedded dot com>
- To: Rohit Gupta <rohit dot guptakec at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 18 Feb 2010 16:32:33 +0000
- Subject: RE: branches within C++ destructors (gcov)
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.
>