From 55b3918466201c8e9fd7ee97975fd7b5a2ee74ee Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 7 Dec 2005 23:07:54 +0000 Subject: [PATCH] gdb/ * valops.c (value_struct_elt): Clarify error message. gdb/testsuite/ 2005-12-07 Christophe Lyon * 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 an error message. --- gdb/ChangeLog | 4 ++++ gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/gdb.cp/printmethod.cc | 4 +++- gdb/testsuite/gdb.cp/printmethod.exp | 4 ++-- gdb/valops.c | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2b25ebf..7f5d7e7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2005-12-07 Daniel Jacobowitz + + * valops.c (value_struct_elt): Clarify error message. + 2005-12-07 Jim Blandy * target.c (target_xfer_memory_partial): Doc fix. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 13418e0..9bee556 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2005-12-07 Christophe Lyon + + * 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 an + error message. + 2005-12-02 Andrew Stubbs * gdb.base/help.exp (help b, help br, help bre, help brea) diff --git a/gdb/testsuite/gdb.cp/printmethod.cc b/gdb/testsuite/gdb.cp/printmethod.cc index 6afb491..b4d573d 100644 --- a/gdb/testsuite/gdb.cp/printmethod.cc +++ b/gdb/testsuite/gdb.cp/printmethod.cc @@ -1,6 +1,6 @@ /* This test script is part of GDB, the GNU debugger. - Copyright 2002, 2004, + Copyright 2002, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -29,6 +29,8 @@ public: int main() { A *theA = new A; + theA->virt (); + theA->nonvirt (); return 0; // breakpoint: constructs-done } diff --git a/gdb/testsuite/gdb.cp/printmethod.exp b/gdb/testsuite/gdb.cp/printmethod.exp index a45393f..67372cd 100644 --- a/gdb/testsuite/gdb.cp/printmethod.exp +++ b/gdb/testsuite/gdb.cp/printmethod.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ gdb_continue_to_breakpoint "end of constructors" # 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 diff --git a/gdb/valops.c b/gdb/valops.c index 54c81ac..0b136e0 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1587,7 +1587,7 @@ value_struct_elt (struct value **argp, struct value **args, v = search_struct_method (name, argp, args, 0, static_memfuncp, t); if (v == (struct value *) - 1) - error (_("Cannot take address of a method")); + error (_("Cannot take address of method %s."), name); else if (v == 0) { if (TYPE_NFN_FIELDS (t)) -- 2.7.4