From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19561 invoked by alias); 10 Dec 2009 18:33:10 -0000 Received: (qmail 19550 invoked by uid 22791); 10 Dec 2009 18:33:09 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Dec 2009 18:33:02 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBAIX0bc002452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Dec 2009 13:33:01 -0500 Received: from qcore.mollernet.net (vpn-11-118.rdu.redhat.com [10.11.11.118]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBAIX0mo006565; Thu, 10 Dec 2009 13:33:00 -0500 Message-ID: <4B213EDB.4020609@redhat.com> Date: Thu, 10 Dec 2009 18:33:00 -0000 From: Chris Moller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: tromey@redhat.com CC: gdb-patches@sourceware.org Subject: Re: Patch for PR 9399 References: <4B1FA6F2.1060105@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------070005020503040104000805" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00144.txt.bz2 This is a multi-part message in MIME format. --------------070005020503040104000805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1531 I fixed all the stuff you mention below, plus I added an FSF copyright notice to virtfunc2.cc--somehow, I forgot to do that yesterday--and fixed the fix to valops.c. (The original version worked in archer--more or less by pure accident, I suspect--but failed in FSF.--I'd forgotten to make sure that type names were non-null before calling strcmp on them. Fixed now.) I've attached the new patch file and virtfunc2.* files. On 12/10/09 11:59, Tom Tromey wrote: >>>>>> "Chris" == Chris Moller writes: >>>>>> > > Chris> The attached stuff is a patch for PR9399: > > Chris> I've assigned that bug to myself. If you're happy with the patch, let > Chris> me know and I'll close the bug. (Or do whatever you usually do...) > > Yeah, what I do is set the target milestone to 7.1 and close as FIXED > after the patch is committed. > > Chris> + /* Check to see if any kind of cast is necessary; if not, punt. > Chris> + (Specifically not using strcmp_iw() because no other comparisons against > Chris> + TYPE_NAME() use it. They all use standard strcmp() instead.) */ > > Delete this comment. > > Chris> /* This test script is part of GDB, the GNU debugger. > > Chris> Copyright 1993, 1994, 1997, 1998, 1999, 2003, 2004, 2009 > > Just 2009. > > Chris> # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, > Chris> # 2006, 2007, 2008, 2009 Free Software Foundation, Inc. > > Likewise. > > This is ok with those changes. Thanks. > > Tom > --------------070005020503040104000805 Content-Type: text/plain; name="pr9399.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr9399.patch" Content-length: 2077 diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3513692..3d999e3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-12-08 Chris Moller + + PR gdb/9399 + * valops.c (value_cast_structs): Added test to return NULL if no + casting needed. + 2009-09-16 H.J. Lu PR gdb/10649 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b9039df..c00e954 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-12-08 Chris Moller + + PR gdb/9399 + * gdb.cp/virtfunc2.exp: New tests + * gdb.cp/virtfunc2.cc: New tests + * gdb.cp/Makefile.in: Added tests to EXECUTABLES + 2009-09-15 Tom Tromey * lib/mi-support.exp (mi_create_varobj): Update. diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in index 0a087c7..c990a64 100644 --- a/gdb/testsuite/gdb.cp/Makefile.in +++ b/gdb/testsuite/gdb.cp/Makefile.in @@ -4,7 +4,7 @@ srcdir = @srcdir@ EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ derivation inherit local member-ptr method misc \ overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \ - ref-types ref-params method2 pr9594 gdb2495 + ref-types ref-params method2 pr9594 gdb2495 virtfunc2 all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." diff --git a/gdb/valops.c b/gdb/valops.c index 3ad54ec..de24a68 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -232,6 +232,11 @@ value_cast_structs (struct type *type, struct value *v2) || TYPE_CODE (t2) == TYPE_CODE_UNION) && !!"Precondition is that value is of STRUCT or UNION kind"); + if ((TYPE_NAME (t1) != NULL) + && (TYPE_NAME (t2) != NULL) + && !strcmp (TYPE_NAME (t1), TYPE_NAME (t2))) + return NULL; + /* Upcasting: look in the type of the source to see if it contains the type of the target as a superclass. If so, we'll need to offset the pointer rather than just change its type. */ --------------070005020503040104000805 Content-Type: text/x-c++src; name="virtfunc2.cc" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="virtfunc2.cc" Content-length: 1096 /* This test script is part of GDB, the GNU debugger. Copyright 2009 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 the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ class interface { virtual int do_print3() { return 111111; } }; class Obj : virtual public interface { public: virtual int do_print() { return 123456; } }; class Obj2 : Obj, virtual public interface { virtual int do_print2() { return 654321; } }; int main(int argc, char** argv) { Obj o; Obj2 o2; return 0; // marker 1 } --------------070005020503040104000805 Content-Type: text/plain; name="virtfunc2.exp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="virtfunc2.exp" Content-length: 1680 # Copyright 2009 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 # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # This file was written by Chris Moller based on # virtfunc.exp set nl "\[\r\n\]+" if { [skip_cplus_tests] } { continue } load_lib "cp-support.exp" set testfile "virtfunc2" set srcfile ${testfile}.cc set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ debug}] != "" } { untested virtfunc2.exp return -1 } gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} if ![runto_main] then { perror "couldn't run to breakpoint" continue } # set a breakpoint at the return stmt gdb_breakpoint [gdb_get_line_number "marker 1"] gdb_continue_to_breakpoint "marker 1" gdb_test "print o.do_print()" "\\$\[0-9\]+ = 123456" gdb_test "print o.do_print3()" "\\$\[0-9\]+ = 111111" gdb_test "print o2.do_print()" "\\$\[0-9\]+ = 123456" gdb_test "print o2.do_print2()" "\\$\[0-9\]+ = 654321" gdb_test "print o2.do_print3()" "\\$\[0-9\]+ = 111111" gdb_exit return 0 --------------070005020503040104000805--