From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12476 invoked by alias); 7 Dec 2005 23:08:12 -0000 Received: (qmail 12468 invoked by uid 22791); 7 Dec 2005 23:08:11 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 07 Dec 2005 23:08:10 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1Ek8ON-0002H0-3f; Wed, 07 Dec 2005 18:08:07 -0500 Date: Thu, 08 Dec 2005 09:48:00 -0000 From: Daniel Jacobowitz To: Christophe LYON Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC] fix testsuite/gdb.cp/printmethod Message-ID: <20051207230807.GA7483@nevyn.them.org> Mail-Followup-To: Christophe LYON , gdb-patches@sources.redhat.com References: <4395D411.6020904@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4395D411.6020904@st.com> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00141.txt.bz2 On Tue, Dec 06, 2005 at 07:10:25PM +0100, Christophe LYON wrote: > 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 > * 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. I agree with your conclusions; this is fine. I've checked it in, with some formatting/copyright tweaks, since I needed it for the attached followup: the error message previously being tested for was lousy, let's improve it. -- Daniel Jacobowitz CodeSourcery, LLC 2005-12-07 Daniel Jacobowitz * valops.c (value_struct_elt): Clarify error message. 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. Index: valops.c =================================================================== RCS file: /cvs/src/src/gdb/valops.c,v retrieving revision 1.161 diff -u -p -r1.161 valops.c --- valops.c 27 May 2005 04:39:32 -0000 1.161 +++ valops.c 7 Dec 2005 22:49:13 -0000 @@ -1587,7 +1587,7 @@ value_struct_elt (struct value **argp, s 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)) Index: testsuite/gdb.cp/printmethod.cc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/printmethod.cc,v retrieving revision 1.2 diff -u -p -r1.2 printmethod.cc --- testsuite/gdb.cp/printmethod.cc 17 Jun 2004 18:30:18 -0000 1.2 +++ testsuite/gdb.cp/printmethod.cc 7 Dec 2005 23:06:43 -0000 @@ -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 } Index: testsuite/gdb.cp/printmethod.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/printmethod.exp,v retrieving revision 1.1 diff -u -p -r1.1 printmethod.exp --- testsuite/gdb.cp/printmethod.exp 23 Aug 2003 03:55:59 -0000 1.1 +++ testsuite/gdb.cp/printmethod.exp 7 Dec 2005 23:06:43 -0000 @@ -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 const # 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