[RFC] fix testsuite/gdb.cp/printmethod

Christophe LYON
2005-12-06T18:10:36Z

Hi all,

As I explained in
http://sources.redhat.com/ml/gdb/2005-11/msg00611.html, I think that the
gdb.cp/printmethod test somewhat relies on G++ not generating code for
the nonvirt() method.

I propose the following fix.

Christophe.

2005-12-06 Christophe Lyon <christophe.lyon@st.com>
* gdb.cp/printmethod.cc (main): call virt() and nonvirt() to
force code generation for these functions.
* gdb.cp/printmethod.exp: expect &A::nonvirt() instead of error
message.

Index: gdb.cp/printmethod.exp
===================================================================
--- gdb.cp/printmethod.exp (revision 96)
+++ gdb.cp/printmethod.exp (working copy)
@@ -63,7 +63,7 @@
# The first of these is for PR gdb/653.

gdb_test "print theA->virt" "\\$\[0-9\]* = &A::virt\\((void|)\\)"
"print virtual method."
-gdb_test "print theA->nonvirt" "Cannot take address of a method" "print
nonvirtual method."
+gdb_test "print theA->nonvirt" "\\$\[0-9\]* = &A::nonvirt\\((void|)\\)"
"print nonvirtual method."

gdb_exit
return 0

Index: gdb.cp/printmethod.cc
===================================================================
--- gdb.cp/printmethod.cc (revision 96)
+++ gdb.cp/printmethod.cc (working copy)
@@ -29,6 +29,8 @@
int main()
{
A *theA = new A;
+ theA->virt();
+ theA->nonvirt();

return 0; // breakpoint: constructs-done
}