This is the mail archive of the gdb@sourceware.org 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]

gdb.cp/printmethod.exp incorrect



Hi all,


I am wondering if the test gdb.cp/printmethod.exp is valid or not.

The code being compiled is:
class A {
public:
  virtual void virt() {};
  void nonvirt() {};
};

int main()
{
  A *theA = new A;

  return 0;				// breakpoint: constructs-done
}

And the test performed by GDB (when stopped on the 'return 0') is:
(gdb) print theA->virt
$1 = &A::virt()
(gdb) print theA->nonvirt
Cannot take address of a method

I don't understand why the latter does not reply
$2 = &A::nonvirt()

I looked at the code and dwarf info generated by gcc (3.3.3), and found that nonvirt is not generated at all.

If I add 'theA->nonvirt();' before 'return 0', then the 2nd test fails, as GDB replies
$2 = &A::nonvirt()
as I expected.


Am I missing something, or should this test be modified?

Regards,

Christophe.




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