From: Chris Moller <cmoller@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: Patch for PR 10728
Date: Wed, 03 Feb 2010 20:41:00 -0000 [thread overview]
Message-ID: <4B69DF73.9000402@redhat.com> (raw)
In-Reply-To: <m3mxzy9eub.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 255 bytes --]
Originally sent on 28 January.
On 01/28/10 15:03, Tom Tromey wrote:
>>>>>> "Chris" == Chris Moller<cmoller@redhat.com> writes:
>>>>>>
>
> Chris> Do you want me to send you a new patch? Or just commit it?
>
> Send a new patch.
>
Here 'tis.
> Tom
>
[-- Attachment #2: pr10728.patch --]
[-- Type: text/plain, Size: 6012 bytes --]
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 <cmoller@redhat.com>
+
+ 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 <tromey@redhat.com>
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 <cmoller@redhat.com>
+
+ 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 <tromey@redhat.com>
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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+
next prev parent reply other threads:[~2010-02-03 20:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 19:41 Chris Moller
2010-01-28 18:09 ` Tom Tromey
2010-01-28 18:38 ` Chris Moller
2010-01-28 20:03 ` Tom Tromey
2010-02-03 20:41 ` Chris Moller [this message]
2010-02-03 20:50 ` Tom Tromey
2010-02-02 21:57 Chris Moller
2010-02-02 23:57 ` Tom Tromey
2010-02-03 4:36 ` Chris Moller
2010-02-03 18:23 ` Tom Tromey
2010-02-03 4:52 ` Chris Moller
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=4B69DF73.9000402@redhat.com \
--to=cmoller@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@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