From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5912 invoked by alias); 13 Oct 2003 08:55:52 -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 5883 invoked from network); 13 Oct 2003 08:55:43 -0000 Received: from unknown (HELO eeyore.twiddle.home) (64.81.246.98) by sources.redhat.com with SMTP; 13 Oct 2003 08:55:43 -0000 Received: from eeyore.twiddle.home (localhost.localdomain [127.0.0.1]) by eeyore.twiddle.home (8.12.8/8.12.8) with ESMTP id h9D8rKP6000875 for ; Mon, 13 Oct 2003 01:53:20 -0700 Received: (from rth@localhost) by eeyore.twiddle.home (8.12.8/8.12.8/Submit) id h9D8rKcV000873 for gdb-patches@gcc.gnu.org; Mon, 13 Oct 2003 01:53:20 -0700 X-Authentication-Warning: eeyore.twiddle.home: rth set sender to rth@twiddle.net using -f Date: Mon, 13 Oct 2003 08:55:00 -0000 From: Richard Henderson To: gdb-patches@gcc.gnu.org Subject: [RFA] print function arguments for g95 Message-ID: <20031013085319.GA865@twiddle.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2003-10/txt/msg00421.txt.bz2 G95 properly represents function arguments as references. This causes the current fortran support to hork. Fixed thus. Ok? r~ * f-typeprint.c (f_type_print_base): Handle TYPE_CODE_REF. * f-valprint.c (f_val_print): Likewise. Tweak TYPE_CODE_PTR to match c_val_print a bit closer. Index: f-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/f-typeprint.c,v retrieving revision 1.11 diff -u -p -r1.11 f-typeprint.c --- f-typeprint.c 14 Sep 2003 16:32:12 -0000 1.11 +++ f-typeprint.c 13 Oct 2003 08:48:03 -0000 @@ -329,6 +329,11 @@ f_type_print_base (struct type *type, st f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); break; + case TYPE_CODE_REF: + fprintf_filtered (stream, "REF TO -> ( "); + f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); + break; + case TYPE_CODE_VOID: fprintf_filtered (stream, "VOID"); break; Index: f-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/f-valprint.c,v retrieving revision 1.19 diff -u -p -r1.19 f-valprint.c --- f-valprint.c 6 Oct 2003 15:49:43 -0000 1.19 +++ f-valprint.c 13 Oct 2003 08:48:03 -0000 @@ -384,11 +384,7 @@ f_val_print (struct type *type, char *va deref_ref, recurse, pretty); fprintf_filtered (stream, ")"); break; -#if 0 - /* Array of unspecified length: treat like pointer to first elt. */ - valaddr = (char *) &address; - /* FALL THROUGH */ -#endif + case TYPE_CODE_PTR: if (format && format != 's') { @@ -409,7 +405,7 @@ f_val_print (struct type *type, char *va } if (addressprint && format != 's') - fprintf_filtered (stream, "0x%s", paddr_nz (addr)); + print_address_numeric (addr, 1, stream); /* For a pointer to char or unsigned char, also print the string pointed to, unless pointer is null. */ @@ -419,9 +415,47 @@ f_val_print (struct type *type, char *va && addr != 0) i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream); - /* Return number of characters printed, plus one for the - terminating null if we have "reached the end". */ - return (i + (print_max && i != print_max)); + /* Return number of characters printed, including the terminating + '\0' if we reached the end. val_print_string takes care including + the terminating '\0' if necessary. */ + return i; + } + break; + + case TYPE_CODE_REF: + elttype = check_typedef (TYPE_TARGET_TYPE (type)); + if (addressprint) + { + CORE_ADDR addr + = extract_typed_address (valaddr + embedded_offset, type); + fprintf_filtered (stream, "@"); + print_address_numeric (addr, 1, stream); + if (deref_ref) + fputs_filtered (": ", stream); + } + /* De-reference the reference. */ + if (deref_ref) + { + if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) + { + struct value *deref_val = + value_at + (TYPE_TARGET_TYPE (type), + unpack_pointer (lookup_pointer_type (builtin_type_void), + valaddr + embedded_offset), + NULL); + val_print (VALUE_TYPE (deref_val), + VALUE_CONTENTS (deref_val), + 0, + VALUE_ADDRESS (deref_val), + stream, + format, + deref_ref, + recurse, + pretty); + } + else + fputs_filtered ("???", stream); } break;