From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4941 invoked by alias); 28 Feb 2008 05:19:41 -0000 Received: (qmail 4929 invoked by uid 22791); 28 Feb 2008 05:19:40 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate5.de.ibm.com (HELO mtagate5.de.ibm.com) (195.212.29.154) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 28 Feb 2008 05:19:18 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.13.8/8.13.8) with ESMTP id m1S5JFOe498420 for ; Thu, 28 Feb 2008 05:19:15 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m1S5JF7j1966172 for ; Thu, 28 Feb 2008 06:19:15 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m1S5JFgP016847 for ; Thu, 28 Feb 2008 05:19:15 GMT Received: from bbkeks.de.ibm.com (dyn-9-152-248-39.boeblingen.de.ibm.com [9.152.248.39]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m1S5JEeh016836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Feb 2008 05:19:15 GMT Message-ID: <47C64452.2050506@de.ibm.com> Date: Thu, 28 Feb 2008 06:00:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: GDB Patches CC: Ulrich Weigand Subject: [patch]: Fix NULL ptr handling in f_print_type Content-Type: multipart/mixed; boundary="------------040201010904050107000706" 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: 2008-02/txt/msg00461.txt.bz2 This is a multi-part message in MIME format. --------------040201010904050107000706 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2094 Hi, f_print_type from f-typeprint.c is currently not able to handle (varstring == NULL) properly like for example its c counterpart does. Here is an example: (gdb) set language fortran Warning: the current language does not match this frame. (gdb) set debug expression 1 (gdb) set $r0%uint128=1 Dump of expression @ 0x102f4c78' Language fortran, 15 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_REGISTER 197568495616 ................ 1 OP_NULL 2 ................ 14 BINOP_ASSIGN 90194313216 ................ Dump of expression @ 0x102f4c78, after conversion to prefix form: Expression: `$r0.uint128 = 1' Language fortran, 15 elements, 16 bytes each. 0 BINOP_ASSIGN 1 STRUCTOP_STRUCT Element name: `uint128' 6 OP_REGISTER Register $r0 11 OP_LONG Type @0x102e9528 (intSegmentation fault (core dumped) The attached patch fixes it: (gdb) set language fortran (gdb) set $r0%uint128=6 Dump of expression @ 0x102f4d30' Language fortran, 15 elements, 16 bytes each. Index Opcode Hex Value String Value 0 OP_REGISTER 197568495616 ................ 1 OP_NULL 2 ................ 14 BINOP_ASSIGN 90194313216 ................ Dump of expression @ 0x102f4d30, after conversion to prefix form: Expression: `$r0.uint128 = 6' Language fortran, 15 elements, 16 bytes each. 0 BINOP_ASSIGN 1 STRUCTOP_STRUCT Element name: `uint128' 6 OP_REGISTER Register $r0 11 OP_LONG Type @0x102e9528 (int), value 6 (0x6) Tested on SPU and x86 without regression. Ok ? ChangeLog: * f-typeprint.c (f_print_type): Handle NULL pointer in VARSTRING properly. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------040201010904050107000706 Content-Type: text/plain; name="fix-fortran" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix-fortran" Content-length: 1100 diff -urpN gdb-6.7.1.orig/gdb/f-typeprint.c gdb-6.7.1/gdb/f-typeprint.c --- gdb-6.7.1.orig/gdb/f-typeprint.c 2008-02-27 11:01:53.000000000 +0100 +++ gdb-6.7.1/gdb/f-typeprint.c 2008-02-28 06:13:22.000000000 +0100 @@ -76,13 +76,16 @@ f_print_type (struct type *type, char *v fputs_filtered (" ", stream); f_type_print_varspec_prefix (type, stream, show, 0); - fputs_filtered (varstring, stream); + if (varstring != NULL) + { + fputs_filtered (varstring, stream); - /* For demangled function names, we have the arglist as part of the name, - so don't print an additional pair of ()'s */ + /* For demangled function names, we have the arglist as part of the name, + so don't print an additional pair of ()'s */ - demangled_args = varstring[strlen (varstring) - 1] == ')'; - f_type_print_varspec_suffix (type, stream, show, 0, demangled_args); + demangled_args = varstring[strlen (varstring) - 1] == ')'; + f_type_print_varspec_suffix (type, stream, show, 0, demangled_args); + } } /* Print any asterisks or open-parentheses needed before the --------------040201010904050107000706--