gdb.cp/printmethod.exp incorrect
Christophe LYON
christophe.lyon@st.com
Tue Nov 29 12:30:00 GMT 2005
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.
More information about the Gdb
mailing list