This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in GDB : Error in displaying member variable of virtual base class in member function of its derived class


Hi,

I have found a bug in GDB. When I try to watch member variable of virtual base class in member 
function of its derived class, following error is displayed,

(gdb) p b1_public_Value
virtual baseclass botch

Same error is displayed for protected and private members of virtual base class.
Bug was found in GDB snapshot dated 31 Dec 2003 of version 6.0 for H8 as well as SH targets.

Please refer to following test case,
**********************************************************************************************

// Base Class
class BaseClass1
{
public:
    int b1_public_Value;
    BaseClass1() { b1_public_Value    = 10; }
    void b1_func(void);
};

// Virtual Inheritance
class VirtualInheritance:virtual public BaseClass1
{
public:
    int v_public_Value;
    VirtualInheritance() { v_public_Value    = 40; }
    void v_func(void);         // normal member function
};

void BaseClass1::b1_func(void) 
{ 
	b1_public_Value    = 100; 
}

void VirtualInheritance::v_func(void)
{
    b1_func();
    v_public_Value    = 400;
    // 1  : b1_public_Value    : 100   
    // 4  : v_public_Value     : 400   
}

int main()
{
    VirtualInheritance  oVirtualInheritance;
    oVirtualInheritance.v_func();   // Test of Virtual Inheritance  (VI)
    return 0;
}
**********************************************************************************************

Regards,
Anil Paranjpe


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]