Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Christophe LYON <christophe.lyon@st.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] fix testsuite/gdb.cp/printmethod
Date: Thu, 08 Dec 2005 09:48:00 -0000	[thread overview]
Message-ID: <20051207230807.GA7483@nevyn.them.org> (raw)
In-Reply-To: <4395D411.6020904@st.com>

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 <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.

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  <dan@codesourcery.com>

	* valops.c (value_struct_elt): Clarify error message.

2005-12-07  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 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


  reply	other threads:[~2005-12-07 23:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06 22:46 Christophe LYON
2005-12-08  9:48 ` Daniel Jacobowitz [this message]
2005-12-08 18:37   ` Eli Zaretskii
2005-12-08 19:22     ` Daniel Jacobowitz
2005-12-09  2:12       ` Jim Blandy
2005-12-09  2:25       ` Eli Zaretskii
2005-12-19 22:39       ` Update Copyright and FSF address (was: [RFC] fix testsuite/gdb.cp/printmethod) Eli Zaretskii
2005-12-20  3:04         ` Daniel Jacobowitz
2005-12-20 14:19           ` Daniel Jacobowitz
2005-12-20  3:18         ` Mark Kettenis
2005-12-24  8:07         ` Eli Zaretskii
2005-12-24  8:57           ` Update Copyright and FSF address Eli Zaretskii
2005-12-24 10:50           ` Update Copyright and FSF address (was: [RFC] fix testsuite/gdb.cp/printmethod) Daniel Jacobowitz
2005-12-24 17:37             ` Eli Zaretskii
2005-12-26 14:39               ` Eli Zaretskii
2005-12-26 19:15               ` Daniel Jacobowitz
2005-12-26 19:31                 ` Eli Zaretskii
2005-12-27  4:09                   ` Daniel Jacobowitz
2005-12-27 12:23                     ` Eli Zaretskii
2005-12-09  8:05     ` [RFC] fix testsuite/gdb.cp/printmethod Mark Kettenis
2005-12-09 18:51   ` Christophe LYON

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051207230807.GA7483@nevyn.them.org \
    --to=drow@false.org \
    --cc=christophe.lyon@st.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox