From: Siddhesh Poyarekar <siddhesh@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Take 2: Allow printing of 64-bit array sizes in C
Date: Tue, 25 Sep 2012 12:23:00 -0000 [thread overview]
Message-ID: <20120925175243.3f8096dd@spoyarek> (raw)
In-Reply-To: <50609C3E.8070605@redhat.com>
On Mon, 24 Sep 2012 18:45:34 +0100, Pedro wrote:
> This will fail to compile on 32-bit targets (size too large), and
> the complaint will be verbose on the test run's terminal. You can
> make the failure quiet by passing "quiet" to prepare_for_testing.
>
> Other than that, looks good to me.
>
Thanks, committed with your suggested changes.
Regards,
Siddhesh
http://sourceware.org/ml/gdb-cvs/2012-09/msg00138.html
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- src/gdb/c-typeprint.c 2012/09/21 17:37:47 1.80
+++ src/gdb/c-typeprint.c 2012/09/25 12:20:39 1.81
@@ -621,8 +621,8 @@
fprintf_filtered (stream, (is_vector ?
"__attribute__ ((vector_size(" : "["));
if (get_array_bounds (type, &low_bound, &high_bound))
- fprintf_filtered (stream, "%d",
- (int) (high_bound - low_bound + 1));
+ fprintf_filtered (stream, "%s",
+ plongest (high_bound - low_bound + 1));
fprintf_filtered (stream, (is_vector ? ")))" : "]"));
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
/cvs/src/src/gdb/testsuite/gdb.base/longest-types.c,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/longest-types.c
+++ - 2012-09-25 12:22:16.332782000 +0000
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 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/>. */
+
+struct foo
+{
+ char buf[0xffff000000];
+ char buf2[2];
+} *f;
+
+int
+main (void)
+{
+ return 0;
+}
/cvs/src/src/gdb/testsuite/gdb.base/longest-types.exp,v --> standard output
revision 1.1
--- src/gdb/testsuite/gdb.base/longest-types.exp
+++ - 2012-09-25 12:22:16.970778000 +0000
@@ -0,0 +1,25 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2012 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/>.
+
+standard_testfile
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } {
+ return -1
+}
+
+# 64-bit array size should not overflow
+gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0}
prev parent reply other threads:[~2012-09-25 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 11:22 [PATCH] " Siddhesh Poyarekar
2012-09-24 11:48 ` Siddhesh Poyarekar
2012-09-24 12:18 ` [PATCH] Take 2: " Siddhesh Poyarekar
2012-09-24 17:45 ` Pedro Alves
2012-09-25 12:23 ` Siddhesh Poyarekar [this message]
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=20120925175243.3f8096dd@spoyarek \
--to=siddhesh@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@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