From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15791 invoked by alias); 22 Jun 2010 12:11:45 -0000 Received: (qmail 15719 invoked by uid 22791); 22 Jun 2010 12:11:41 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,TW_PL,T_RP_MATCHES_RCVD 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; Tue, 22 Jun 2010 12:11:36 +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 o5MCBYbR009455 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Jun 2010 08:11:34 -0400 Received: from qcore.mollernet.net (vpn-9-94.rdu.redhat.com [10.11.9.94]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5MCBX5n026169 for ; Tue, 22 Jun 2010 08:11:34 -0400 Message-ID: <4C20A875.7060204@redhat.com> Date: Tue, 22 Jun 2010 12:11: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: "gdb-patches@sourceware.org" Subject: [patch] pr11594 Content-Type: multipart/mixed; boundary="------------060100020408030908060600" X-IsSubscribed: yes 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: 2010-06/txt/msg00477.txt.bz2 This is a multi-part message in MIME format. --------------060100020408030908060600 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 178 I'm fairly sure that the type2 = check_typedef (type1); at valarith.c:277 is a typo and treally should be type2 = check_typedef (type2); but, with gdb, who knows? --------------060100020408030908060600 Content-Type: text/x-patch; name="pr11594.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr11594.patch" Content-length: 6386 ? testsuite/gdb.cp/pr11594 Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.11916 diff -u -r1.11916 ChangeLog --- ChangeLog 22 Jun 2010 00:09:08 -0000 1.11916 +++ ChangeLog 22 Jun 2010 02:38:33 -0000 @@ -1,3 +1,10 @@ +2010-06-21 Chris Moller + + * eval.c (evaluate_subexp_standard): Add a test for an overloaded + comma operator. + * valarith.c (binop_types_user_defined_p): Fix a typo. + (value_x_binop): Synthesise an "operator," function name. + 2010-06-21 Doug Evans * i386-tdep.h (i386_displaced_step_copy_insn): Declare. Index: eval.c =================================================================== RCS file: /cvs/src/src/gdb/eval.c,v retrieving revision 1.136 diff -u -r1.136 eval.c --- eval.c 7 Jun 2010 16:11:31 -0000 1.136 +++ eval.c 22 Jun 2010 02:38:37 -0000 @@ -2421,8 +2421,23 @@ return value_repeat (arg1, longest_to_int (value_as_long (arg2))); case BINOP_COMMA: - evaluate_subexp (NULL_TYPE, exp, pos, noside); - return evaluate_subexp (NULL_TYPE, exp, pos, noside); + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); + arg2 = evaluate_subexp (value_type (arg1), exp, pos, noside); + if (noside == EVAL_SKIP) + goto nosideret; + if (current_language->la_language == language_cplus + && binop_user_defined_p (op, arg1, arg2)) + { + struct value *rc; + + rc = value_x_binop (arg1, arg2, op, OP_NULL, noside); + if (rc != NULL) + return rc; + else + return arg2; + } + else + return arg2; case UNOP_PLUS: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); Index: valarith.c =================================================================== RCS file: /cvs/src/src/gdb/valarith.c,v retrieving revision 1.85 diff -u -r1.85 valarith.c --- valarith.c 7 Jun 2010 16:11:31 -0000 1.85 +++ valarith.c 22 Jun 2010 02:38:38 -0000 @@ -274,7 +274,7 @@ if (TYPE_CODE (type1) == TYPE_CODE_REF) type1 = check_typedef (TYPE_TARGET_TYPE (type1)); - type2 = check_typedef (type1); + type2 = check_typedef (type2); if (TYPE_CODE (type2) == TYPE_CODE_REF) type2 = check_typedef (TYPE_TARGET_TYPE (type2)); @@ -418,6 +418,9 @@ ptr = tstr + 8; switch (op) { + case BINOP_COMMA: + strcpy (ptr, ","); + break; case BINOP_ADD: strcpy (ptr, "+"); break; Index: testsuite/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v retrieving revision 1.2344 diff -u -r1.2344 ChangeLog --- testsuite/ChangeLog 22 Jun 2010 00:02:07 -0000 1.2344 +++ testsuite/ChangeLog 22 Jun 2010 02:38:55 -0000 @@ -1,3 +1,9 @@ +2010-06-21 Chris Moller + + * gdb.cp/Makefile.in (EXECUTABLES): Added pr11594. + * gdb.cp/pr11594.cc: New File. + * gdb.cp/pr11594.exp: New File. + 2010-06-21 Doug Evans * gdb.gdb/selftest.exp: Remove support for gpl v1 and v2 gdb's. Index: testsuite/gdb.cp/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/Makefile.in,v retrieving revision 1.11 diff -u -r1.11 Makefile.in --- testsuite/gdb.cp/Makefile.in 21 Apr 2010 17:33:54 -0000 1.11 +++ testsuite/gdb.cp/Makefile.in 22 Jun 2010 02:38:56 -0000 @@ -5,7 +5,7 @@ derivation inherit local member-ptr method misc \ overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \ ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr9067 \ - pr1072 pr10687 pr9167 + pr1072 pr10687 pr9167 pr11594 all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." Index: testsuite/gdb.cp/pr11594.cc =================================================================== RCS file: testsuite/gdb.cp/pr11594.cc diff -N testsuite/gdb.cp/pr11594.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11594.cc 22 Jun 2010 02:38:57 -0000 @@ -0,0 +1,46 @@ +class complx +{ + double real, imag; +public: + complx( double real = 0., double imag = 0.); // constructor + complx operator,(const complx&) const; // operator,() +}; + +// define constructor +complx::complx( double r, double i ) +{ + real = r; imag = i; +} + +// define overloaded , (comma) operator +complx +complx::operator, (const complx& c) const +{ + complx result; + result.real = (this->real + c.real); + result.imag = (this->imag - c.imag); + return result; +} + +int +main() +{ + complx x(4,5); + complx y(6,7); + complx z; + + return 0; // break +} + +#if 0 +(gdb) p x,y +$1 = {real = 10, imag = -2} +(gdb) p y,x +$2 = {real = 10, imag = 2} +(gdb) set variable z = x,y +(gdb) p z +$3 = {real = 4, imag = 5} +(gdb) set variable z = (x,y) +(gdb) p z +$4 = {real = 10, imag = -2} +#endif Index: testsuite/gdb.cp/pr11594.exp =================================================================== RCS file: testsuite/gdb.cp/pr11594.exp diff -N testsuite/gdb.cp/pr11594.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.cp/pr11594.exp 22 Jun 2010 02:38:57 -0000 @@ -0,0 +1,37 @@ +#Copyright 2010 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 . + +set testfile pr11594 +set srcfile ${testfile}.cc +if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] { + return -1 +} + +if ![runto_main] then { + fail "Can't run to main" + return +} + +gdb_breakpoint [gdb_get_line_number "break"] +gdb_continue_to_breakpoint "break" + +gdb_test "p x,y" "{real = 10, imag = -2}.*" + +gdb_test "set variable z = x,y" "" +gdb_test "p z" "{real = 4, imag = 5}" + +gdb_test "set variable z = (x,y)" "" +gdb_test "p z" "{real = 10, imag = -2}" + --------------060100020408030908060600 Content-Type: text/x-patch; name="pr11594-gdb-sum.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr11594-gdb-sum.diff" Content-length: 701 1c1 < Test Run By moller on Mon Jun 21 21:38:39 2010 --- > Test Run By moller on Mon Jun 21 22:12:55 2010 12245a12246,12252 > Running ../../../src/gdb/testsuite/gdb.cp/pr11594.exp ... > PASS: gdb.cp/pr11594.exp: continue to breakpoint: break > PASS: gdb.cp/pr11594.exp: p x,y > PASS: gdb.cp/pr11594.exp: set variable z = x,y > PASS: gdb.cp/pr11594.exp: p z > PASS: gdb.cp/pr11594.exp: set variable z = (x,y) > PASS: gdb.cp/pr11594.exp: p z 16610c16617 < KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreaded app (PRMS: gdb/10116) --- > PASS: gdb.threads/watchthreads2.exp: all threads incremented x 16873c16880 < # of expected passes 15991 --- > # of expected passes 15998 --------------060100020408030908060600--