From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18370 invoked by alias); 16 May 2003 11:25:49 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17314 invoked from network); 16 May 2003 11:25:26 -0000 Received: from unknown (HELO black-watch.firstnet.net.uk) (212.103.224.245) by sources.redhat.com with SMTP; 16 May 2003 11:25:26 -0000 Received: (qmail 7942 invoked from network); 16 May 2003 11:25:53 -0000 Received: from unknown (HELO scgj.streamline) (212.103.239.121) by black-watch.first with SMTP; 16 May 2003 11:25:53 -0000 Received: from streamline-computing.com (elmo [192.168.1.66]) by scgj.streamline (8.9.3/8.6.9) with ESMTP id MAA23639 for ; Fri, 16 May 2003 12:28:30 +0100 Received: (from david@localhost) by streamline-computing.com (8.11.6/8.11.6) id h4GBOQh32046 for gdb-patches@sources.redhat.com; Fri, 16 May 2003 12:24:26 +0100 Date: Fri, 16 May 2003 11:25:00 -0000 From: David Lecomber To: gdb-patches@sources.redhat.com Subject: [PATCH] Large array fix for Fortran. Message-ID: <20030516122426.B31934@streamline-computing.com> References: <20030115213240.A17967@streamline-computing.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wac7ysb48OaltWcw" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030115213240.A17967@streamline-computing.com>; from david@streamline-computing.com on Wed, Jan 15, 2003 at 09:32:40PM +0000 X-SW-Source: 2003-05/txt/msg00276.txt.bz2 --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 474 Resubmitted as I now have copyright assignment.. This patch limits the number of elements printed from a multidimensional array to the correct number of elements, rather than the number of top level elements (eg. rows). Very useful for most Fortran programmers, as they have a tendency to have obscenely large multi-d arrays and without this fix info locals, info args and others tend to be kinda slow.. A similar fix for C wouldn't go amiss, but is less urgent.. David --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb.huge-array-patch" Content-length: 4228 *** f-valprint.c Wed Mar 7 02:57:08 2001 --- f-valprint.c Mon Oct 7 10:22:57 2002 *************** static void f77_print_array (struct type *** 46,52 **** enum val_prettyprint); static void f77_print_array_1 (int, int, struct type *, char *, CORE_ADDR, struct ui_file *, int, int, int, ! enum val_prettyprint); static void f77_create_arrayprint_offset_tbl (struct type *, struct ui_file *); static void f77_get_dynamic_length_of_aggregate (struct type *); --- 46,53 ---- enum val_prettyprint); static void f77_print_array_1 (int, int, struct type *, char *, CORE_ADDR, struct ui_file *, int, int, int, ! enum val_prettyprint, ! int *elts); static void f77_create_arrayprint_offset_tbl (struct type *, struct ui_file *); static void f77_get_dynamic_length_of_aggregate (struct type *); *************** f77_create_arrayprint_offset_tbl (struct *** 270,300 **** } } /* Actual function which prints out F77 arrays, Valaddr == address in the superior. Address == the address in the inferior. */ - static void f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, CORE_ADDR address, struct ui_file *stream, int format, ! int deref_ref, int recurse, enum val_prettyprint pretty) { int i; if (nss != ndimensions) { ! for (i = 0; i < F77_DIM_SIZE (nss); i++) { fprintf_filtered (stream, "( "); f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (nss), address + i * F77_DIM_OFFSET (nss), ! stream, format, deref_ref, recurse, pretty); fprintf_filtered (stream, ") "); } } else { ! for (i = 0; (i < F77_DIM_SIZE (nss) && i < print_max); i++) { val_print (TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (ndimensions), --- 271,306 ---- } } + + /* Actual function which prints out F77 arrays, Valaddr == address in the superior. Address == the address in the inferior. */ static void f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, CORE_ADDR address, struct ui_file *stream, int format, ! int deref_ref, int recurse, enum val_prettyprint pretty, ! int *elts) { int i; if (nss != ndimensions) { ! for (i = 0; i < F77_DIM_SIZE (nss) && *elts < print_max; i++) { fprintf_filtered (stream, "( "); f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (nss), address + i * F77_DIM_OFFSET (nss), ! stream, format, deref_ref, recurse, pretty, elts); fprintf_filtered (stream, ") "); } + if (*elts >= print_max && i < F77_DIM_SIZE (nss)) { + fprintf_filtered (stream, "..."); + } } else { ! for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++ , (*elts)++) { val_print (TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (ndimensions), *************** f77_print_array_1 (int nss, int ndimensi *** 305,311 **** if (i != (F77_DIM_SIZE (nss) - 1)) fprintf_filtered (stream, ", "); ! if (i == print_max - 1) fprintf_filtered (stream, "..."); } } --- 311,317 ---- if (i != (F77_DIM_SIZE (nss) - 1)) fprintf_filtered (stream, ", "); ! if (( *elts) > print_max - 1) fprintf_filtered (stream, "..."); } } *************** f77_print_array (struct type *type, char *** 320,325 **** --- 326,332 ---- enum val_prettyprint pretty) { int ndimensions; + int elts = 0; ndimensions = calc_f77_array_dims (type); *************** f77_print_array (struct type *type, char *** 334,340 **** f77_create_arrayprint_offset_tbl (type, stream); f77_print_array_1 (1, ndimensions, type, valaddr, address, stream, format, ! deref_ref, recurse, pretty); } --- 341,347 ---- f77_create_arrayprint_offset_tbl (type, stream); f77_print_array_1 (1, ndimensions, type, valaddr, address, stream, format, ! deref_ref, recurse, pretty, &elts); } --wac7ysb48OaltWcw--