From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84585 invoked by alias); 13 May 2016 09:35:38 -0000 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 Received: (qmail 84300 invoked by uid 89); 13 May 2016 09:35:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2904, REF X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 May 2016 09:35:32 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 13 May 2016 02:35:32 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 13 May 2016 02:35:30 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u4D9ZT0B010354; Fri, 13 May 2016 10:35:29 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id u4D9ZSbr017922; Fri, 13 May 2016 11:35:28 +0200 Received: (from heckel@localhost) by ulvlx001.iul.intel.com with œ id u4D9ZSrh017918; Fri, 13 May 2016 11:35:28 +0200 From: Bernhard Heckel To: qiyaoltc@gmail.com Cc: gdb-patches@sourceware.org, Bernhard Heckel Subject: [PATCH V2 7/7] Fortran, typeprint: Forward level of details to be printed for pointers. Date: Fri, 13 May 2016 09:35:00 -0000 Message-Id: <1463132086-17451-8-git-send-email-bernhard.heckel@intel.com> In-Reply-To: <1463132086-17451-1-git-send-email-bernhard.heckel@intel.com> References: <1463132086-17451-1-git-send-email-bernhard.heckel@intel.com> X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00218.txt.bz2 Variable "show" was hardcoded to zero for pointer and reference types. This implementation didn't allow a correct "whatis" print for those types and results in same output for "ptype" and "whatis". Before: (gdb) whatis t3p type = PTR TO -> ( Type t3 integer(kind=4) :: t3_i Type t2 :: t2_n End Type t3 ) After: (gdb) whatis t3p type = PTR TO -> ( Type t3 ) 2016-05-09 Bernhard Heckel gdb/Changelog: * f-typeprint.c (f_type_print_base): Replace 0 by show. gdb/testsuite/Changelog: * gdb.fortran/type.f90: Add pointer variable. * gdb.fortran/whatis_type.exp: Add whatis/ptype of pointers. --- gdb/f-typeprint.c | 4 ++-- gdb/testsuite/gdb.fortran/type.f90 | 10 ++++++++-- gdb/testsuite/gdb.fortran/whatis_type.exp | 7 +++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 350def0..920c21f 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -308,12 +308,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, case TYPE_CODE_PTR: fprintf_filtered (stream, "PTR TO -> ( "); - f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); + f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_REF: fprintf_filtered (stream, "REF TO -> ( "); - f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level); + f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_VOID: diff --git a/gdb/testsuite/gdb.fortran/type.f90 b/gdb/testsuite/gdb.fortran/type.f90 index 00dc650..ad3d6ee 100644 --- a/gdb/testsuite/gdb.fortran/type.f90 +++ b/gdb/testsuite/gdb.fortran/type.f90 @@ -33,7 +33,10 @@ program type type (t1) :: t1v type (t2) :: t2v - type (t3) :: t3v + type (t3), target :: t3v + type(t3), pointer :: t3p + + nullify (t3p) t1v%t1_i = 42 t1v%t1_r = 42.24 @@ -42,6 +45,9 @@ program type t2v%t1_n%t1_i = 21 t3v%t3_i = 3 t3v%t2_n%t2_i = 32 - t3v%t2_n%t1_n%t1_i = 321 ! bp1 + t3v%t2_n%t1_n%t1_i = 321 + + t3p => t3v + nullify (t3p) ! bp1 end program type diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp index 955f853..6ebcb52 100644 --- a/gdb/testsuite/gdb.fortran/whatis_type.exp +++ b/gdb/testsuite/gdb.fortran/whatis_type.exp @@ -44,6 +44,7 @@ gdb_test "whatis t2" "type = Type t2" gdb_test "whatis t2v" "type = Type t2" gdb_test "whatis t3" "type = Type t3" gdb_test "whatis t3v" "type = Type t3" +gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)" gdb_test "ptype t1" \ [multi_line "type = Type t1" \ @@ -69,3 +70,9 @@ gdb_test "ptype t3v" \ " $int :: t3_i" \ " Type t2 :: t2_n" \ "End Type t3"] + +gdb_test "ptype t3p" \ + [multi_line "type = PTR TO -> \\( Type t3" \ + " $int :: t3_i" \ + " Type t2 :: t2_n" \ + "End Type t3 \\)"] -- 2.7.1.339.g0233b80