From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28530 invoked by alias); 25 Sep 2012 12:23:44 -0000 Received: (qmail 28519 invoked by uid 22791); 25 Sep 2012 12:23:42 -0000 X-SWARE-Spam-Status: No, hits=-8.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_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; Tue, 25 Sep 2012 12:23:28 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8PCNSsU029042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 Sep 2012 08:23:28 -0400 Received: from spoyarek (spoyarek.pnq.redhat.com [10.65.192.188]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8PCNOd7030626; Tue, 25 Sep 2012 08:23:26 -0400 Date: Tue, 25 Sep 2012 12:23:00 -0000 From: Siddhesh Poyarekar To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Take 2: Allow printing of 64-bit array sizes in C Message-ID: <20120925175243.3f8096dd@spoyarek> In-Reply-To: <50609C3E.8070605@redhat.com> References: <20120924165151.1ad3c613@spoyarek> <20120924171711.1cba272c@spoyarek> <20120924174713.4192388b@spoyarek> <50609C3E.8070605@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: 2012-09/txt/msg00544.txt.bz2 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 . */ + +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 . + +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}