This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fortran, typeprint: Forward level of details to be printed for pointers.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2bbad2ea1102733a2a4143be4afe195caf730cd0

commit 2bbad2ea1102733a2a4143be4afe195caf730cd0
Author: Bernhard Heckel <bernhard.heckel@intel.com>
Date:   Wed May 25 08:47:18 2016 +0200

    Fortran, typeprint: Forward level of details to be printed for pointers.
    
    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-25  Bernhard Heckel  <bernhard.heckel@intel.com>
    
    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.

Diff:
---
 gdb/ChangeLog                             |  4 ++++
 gdb/f-typeprint.c                         |  4 ++--
 gdb/testsuite/ChangeLog                   |  5 +++++
 gdb/testsuite/gdb.fortran/type.f90        | 10 ++++++++--
 gdb/testsuite/gdb.fortran/whatis_type.exp |  7 +++++++
 5 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0328072..d99ea83 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>
 
+	* f-typeprint.c (f_type_print_base): Replace 0 by show.
+
+2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>
+
 	* f-typeprint.c (f_type_print_base): Decrease show by one.
 
 2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>
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/ChangeLog b/gdb/testsuite/ChangeLog
index 8be3eae..6dc4492 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>
 
+* gdb.fortran/type.f90: Add pointer variable.
+* gdb.fortran/whatis_type.exp: Add whatis/ptype of pointers.
+
+2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>
+
 	* gdb.fortran/vla-type.exp: Fix testcase name.
 
 2016-05-25  Bernhard Heckel  <bernhard.heckel@intel.com>
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 \\)"]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]