Hi,

I have the following problem using gdb-5.0 and gcc-2.95.2 on Sparc Solaris 7.
In the attached small C++ program, I can print 'the_object->Base1::value' and
'the_object->Base2::value' using the gdb print command.

(gdb) print the_object->Base1::value
$1 = 1

(gdb) print the_object->Base2::value
$2 = 2

But unfortunately, when using the gdb display command for doing this, 
gdb shows the following message.

(gdb) display the_object->Base1::value
1: Invalid expression
Disabling display 1 to avoid infinite recursion.

(gdb) display the_object->Base2::value
2: Invalid expression
Disabling display 2 to avoid infinite recursion.


However, the entire object 'the_object' can be displayed by 

(gdb) display *the_object 
3: *the_object = {
  <Base1> = {
    value = 1
  }, 
  <Base2> = {
    value = 2
  }, <No data fields>}


It is important to can use the display command, because the gdb GUI DDD
uses the gdb display command for the graphical data representation.

Thank you in advance for your help,

Oliver Bringmann


----------------------------------------------------------------------

class Base1 {
public:
  int value;
  Base1() : value(1) {}
};

class Base2 {
public:
  int value;
  Base2() : value(2) {}
};

class Derived: public Base1, public Base2 {
public:
  Derived() {}
};
 
int main()
{
  Derived *the_object=new Derived;
  return 1;                          //<=== BREAK HERE and display *the_object 
}

_____________________________________________________________________

Oliver Bringmann
Forschungszentrum Informatik                 E-Mail  [EMAIL PROTECTED]
Haid-und-Neu-Str. 10-14                      Tel     +49/721-9654-455
D-76131 Karlsruhe                            FAX     +49/721-9654-475



Reply via email to