From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1698 invoked by alias); 3 Feb 2010 20:41:35 -0000 Received: (qmail 1686 invoked by uid 22791); 3 Feb 2010 20:41:34 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,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; Wed, 03 Feb 2010 20:41:25 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o13KfOAN002161 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Feb 2010 15:41:24 -0500 Received: from qcore.mollernet.net (vpn-11-114.rdu.redhat.com [10.11.11.114]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o13KfNHW003976; Wed, 3 Feb 2010 15:41:23 -0500 Message-ID: <4B69DF73.9000402@redhat.com> Date: Wed, 03 Feb 2010 20:41: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 CC: Tom Tromey Subject: Re: Patch for PR 10728 References: <4B6096D9.1060606@redhat.com> <4B61D9AF.3050002@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------030908020600040606040706" 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-02/txt/msg00092.txt.bz2 This is a multi-part message in MIME format. --------------030908020600040606040706 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 255 Originally sent on 28 January. On 01/28/10 15:03, Tom Tromey wrote: >>>>>> "Chris" == Chris Moller writes: >>>>>> > > Chris> Do you want me to send you a new patch? Or just commit it? > > Send a new patch. > Here 'tis. > Tom > --------------030908020600040606040706 Content-Type: text/plain; name="pr10728.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr10728.patch" Content-length: 6012 Index: gdb/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.11289 diff -u -r1.11289 ChangeLog --- gdb/ChangeLog 25 Jan 2010 19:31:23 -0000 1.11289 +++ gdb/ChangeLog 28 Jan 2010 20:19:38 -0000 @@ -1,3 +1,9 @@ +2010-01-25 Chris Moller + + PR gdb/10728: + * valarith.c (value_ptrdiff): Added a test for a zero type length, + warn if found, and assume length = 1. + 2010-01-25 Tom Tromey PR gdb/11049: Index: gdb/valarith.c =================================================================== RCS file: /cvs/src/src/gdb/valarith.c,v retrieving revision 1.79 diff -u -r1.79 valarith.c --- gdb/valarith.c 20 Jan 2010 18:06:15 -0000 1.79 +++ gdb/valarith.c 28 Jan 2010 20:19:39 -0000 @@ -122,6 +122,13 @@ an integer nor a pointer of the same type.")); sz = TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1))); + if (sz == 0) + { + warning (_("Type size unknown, assuming 1. " + "Try casting to a known type, or void *.")); + sz = 1; + } + return (value_as_long (arg1) - value_as_long (arg2)) / sz; } Index: gdb/testsuite/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v retrieving revision 1.2101 diff -u -r1.2101 ChangeLog --- gdb/testsuite/ChangeLog 25 Jan 2010 19:31:23 -0000 1.2101 +++ gdb/testsuite/ChangeLog 28 Jan 2010 20:19:55 -0000 @@ -1,3 +1,12 @@ +2010-01-26 Chris Moller + + PR gdb/10728 + * gdb.cp/pr10728-x.h: New file. + * gdb.cp/pr10728-x.cc: New file. + * gdb.cp/pr10728-y.cc: New file. + * gdb.cp/pr10728.exp: New file. + * gdb.cp/Makefile.in (EXECUTABLES): Add pr10728 + 2010-01-25 Tom Tromey PR gdb/11049: Index: gdb/testsuite/gdb.cp/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/Makefile.in,v retrieving revision 1.7 diff -u -r1.7 Makefile.in --- gdb/testsuite/gdb.cp/Makefile.in 10 Dec 2009 20:57:10 -0000 1.7 +++ gdb/testsuite/gdb.cp/Makefile.in 28 Jan 2010 20:19:56 -0000 @@ -4,7 +4,7 @@ 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 virtfunc2 + ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr10728 all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." Index: gdb/testsuite/gdb.cp/pr10728-x.cc =================================================================== RCS file: gdb/testsuite/gdb.cp/pr10728-x.cc diff -N gdb/testsuite/gdb.cp/pr10728-x.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/testsuite/gdb.cp/pr10728-x.cc 28 Jan 2010 20:19:56 -0000 @@ -0,0 +1,7 @@ +#include "pr10728-x.h" + +int main() +{ + X* x = y(); + return 0; // marker 1 +} Index: gdb/testsuite/gdb.cp/pr10728-x.h =================================================================== RCS file: gdb/testsuite/gdb.cp/pr10728-x.h diff -N gdb/testsuite/gdb.cp/pr10728-x.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/testsuite/gdb.cp/pr10728-x.h 28 Jan 2010 20:19:56 -0000 @@ -0,0 +1,9 @@ +struct Y; +struct X +{ + Y* y1; + Y* y2; +}; + +X* y(); + Index: gdb/testsuite/gdb.cp/pr10728-y.cc =================================================================== RCS file: gdb/testsuite/gdb.cp/pr10728-y.cc diff -N gdb/testsuite/gdb.cp/pr10728-y.cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/testsuite/gdb.cp/pr10728-y.cc 28 Jan 2010 20:19:56 -0000 @@ -0,0 +1,11 @@ +#include "pr10728-x.h" +struct Y{}; + +X* y() +{ + static X xx; + static Y yy; + xx.y1 = &yy; + xx.y2 = xx.y1+1; + return &xx; +} Index: gdb/testsuite/gdb.cp/pr10728.exp =================================================================== RCS file: gdb/testsuite/gdb.cp/pr10728.exp diff -N gdb/testsuite/gdb.cp/pr10728.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/testsuite/gdb.cp/pr10728.exp 28 Jan 2010 20:19:56 -0000 @@ -0,0 +1,66 @@ +# 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 . + +# This file is part of the gdb testsuite + +set nl "\[\r\n\]+" + +if { [skip_cplus_tests] } { continue } + +load_lib "cp-support.exp" + +set testfile "pr10728" +set srcfile ${testfile}-x.cc +set tfx ${testfile}-x +set tfy ${testfile}-y +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${tfy}.cc" "${tfy}.o" object {c++}] != "" } { + untested pr10728.exp + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${tfx}.cc" "${tfx}.o" object {debug c++}] != "" } { + untested pr10728.exp + return -1 +} + +if { [gdb_compile "${tfx}.o ${tfy}.o" ${binfile} executable {debug c++}] != "" } { + untested pr10728.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 x->y2 - x->y1" "warning: Type size unknown, assuming 1\. Try casting to a known type, or void \*\.\[^=\]*= 1" + +gdb_exit +return 0 + + --------------030908020600040606040706--