This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
gdb.cp/printmethod.exp incorrect
- From: Christophe LYON <christophe dot lyon at st dot com>
- To: gdb at sources dot redhat dot com
- Date: Tue, 29 Nov 2005 13:01:02 +0100
- Subject: 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.