public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] More Fortran Patches
@ 2017-08-21 12:20 Tim Wiederhake
  2017-08-21 12:20 ` [PATCH 1/4] Fix indentation for printing Fortran types with pointers Tim Wiederhake
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Tim Wiederhake @ 2017-08-21 12:20 UTC (permalink / raw)
  To: gdb-patches

Hi all,

this is another set of unrelated Fortran patches that were originally written by
Bernhard Heckel, Christoph Weinmann and Frank Penczek.

Regards,
Tim

*** BLURB HERE ***

Bernhard Heckel (2):
  Fortran: Testsuite, fix differences in type naming.
  fortran: Testsuite, fix typos in vla-value.

Christoph Weinmann (1):
  Remove C/C++ relevant code in Fortran specific file.

Frank Penczek (1):
  Fix indentation for printing Fortran types with pointers

 gdb/f-typeprint.c                             |  8 +++---
 gdb/f-valprint.c                              | 18 ++----------
 gdb/testsuite/gdb.fortran/printing-types.exp  | 35 +++++++++++++++++++++++
 gdb/testsuite/gdb.fortran/printing-types.f90  | 27 ++++++++++++++++++
 gdb/testsuite/gdb.fortran/ptr-indentation.exp | 41 +++++++++++++++++++++++++++
 gdb/testsuite/gdb.fortran/ptr-indentation.f90 | 30 ++++++++++++++++++++
 gdb/testsuite/gdb.fortran/vla-ptype.exp       |  6 ++--
 gdb/testsuite/gdb.fortran/vla-value.exp       | 15 ++++++----
 gdb/testsuite/gdb.mi/mi-var-child-f.exp       |  8 +++---
 gdb/testsuite/gdb.mi/mi-vla-fortran.exp       | 19 ++++++++-----
 10 files changed, 168 insertions(+), 39 deletions(-)
 create mode 100644 gdb/testsuite/gdb.fortran/printing-types.exp
 create mode 100644 gdb/testsuite/gdb.fortran/printing-types.f90
 create mode 100644 gdb/testsuite/gdb.fortran/ptr-indentation.exp
 create mode 100644 gdb/testsuite/gdb.fortran/ptr-indentation.f90

-- 
2.7.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/4] fortran: Testsuite, fix typos in vla-value.
  2017-08-21 12:20 [PATCH 0/4] More Fortran Patches Tim Wiederhake
  2017-08-21 12:20 ` [PATCH 1/4] Fix indentation for printing Fortran types with pointers Tim Wiederhake
@ 2017-08-21 12:20 ` Tim Wiederhake
  2017-09-04 13:26   ` Yao Qi
  2017-08-21 12:20 ` [PATCH 2/4] Fortran: Testsuite, fix differences in type naming Tim Wiederhake
  2017-08-21 12:20 ` [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file Tim Wiederhake
  3 siblings, 1 reply; 13+ messages in thread
From: Tim Wiederhake @ 2017-08-21 12:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Bernhard Heckel

From: Bernhard Heckel <bernhard.heckel@intel.com>

xxxx-yy-zz  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/ChangeLog:
	* gdb.fortran/vla-ptype.exp: Fix typos.
	* gdb.fortran/vla-value.exp: Same.

---
 gdb/testsuite/gdb.fortran/vla-ptype.exp | 6 +++---
 gdb/testsuite/gdb.fortran/vla-value.exp | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
index 2dd51e5..c8e72e9 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -39,7 +39,7 @@ gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\
   "ptype vla1(3, 6, 9) not initialized"
 gdb_test "ptype vla2(5, 45, 20)" \
   "no such vector element \\\(vector not allocated\\\)" \
-  "ptype vla1(5, 45, 20) not initialized"
+  "ptype vla2(5, 45, 20) not initialized"
 
 gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
 gdb_continue_to_breakpoint "vla1-allocated"
@@ -63,7 +63,7 @@ gdb_continue_to_breakpoint "vla2-filled"
 gdb_test "ptype vla2" "type = $real \\\(7,42:50,13:35\\\)" \
   "ptype vla2 filled"
 gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
-  "ptype vla1(5, 45, 20) filled"
+  "ptype vla2(5, 45, 20) filled"
 
 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
 gdb_continue_to_breakpoint "pvla-associated"
@@ -77,7 +77,7 @@ gdb_continue_to_breakpoint "pvla-re-associated"
 gdb_test "ptype pvla" "type = $real \\\(7,42:50,13:35\\\)" \
   "ptype pvla re-associated"
 gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
-  "ptype vla1(5, 45, 20) re-associated"
+  "ptype vla2(5, 45, 20) re-associated"
 
 gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
 gdb_continue_to_breakpoint "pvla-deassociated"
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
index 3dd1aae..60022c5 100644
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -61,7 +61,7 @@ gdb_test "print &vla1" \
 gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
 gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
 gdb_test "print vla1(9, 9, 9) = 999" " = 999" \
-  "print allocated vla1(9,9,9)=1"
+  "print allocated vla1(9,9,9)=999"
 
 # Try to access values in allocated VLA after specific assignment
 gdb_breakpoint [gdb_get_line_number "vla1-filled"]
-- 
2.7.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/4] Fortran: Testsuite, fix differences in type naming.
  2017-08-21 12:20 [PATCH 0/4] More Fortran Patches Tim Wiederhake
  2017-08-21 12:20 ` [PATCH 1/4] Fix indentation for printing Fortran types with pointers Tim Wiederhake
  2017-08-21 12:20 ` [PATCH 3/4] fortran: Testsuite, fix typos in vla-value Tim Wiederhake
@ 2017-08-21 12:20 ` Tim Wiederhake
  2017-09-04 13:25   ` Yao Qi
  2017-08-21 12:20 ` [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file Tim Wiederhake
  3 siblings, 1 reply; 13+ messages in thread
From: Tim Wiederhake @ 2017-08-21 12:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Bernhard Heckel

From: Bernhard Heckel <bernhard.heckel@intel.com>

xxxx-yy-zz  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Testsuite/Changelog:
	* gdb.fortran/vla-value.exp: Use type names defined in libfortran.
	* gdb.mi/mi-var-child-f.exp: Likewise.
	* gdb.mi/mi-vla-fortran.exp: Likewise.

---
 gdb/testsuite/gdb.fortran/vla-value.exp | 13 +++++++++----
 gdb/testsuite/gdb.mi/mi-var-child-f.exp |  8 ++++----
 gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 19 ++++++++++++-------
 3 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
index 6ceceab..3dd1aae 100644
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -14,6 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 standard_testfile "vla.f90"
+load_lib "fortran.exp"
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
      {debug f90 quiet}] } {
@@ -25,12 +26,16 @@ if ![runto_main] {
     return -1
 }
 
+# Depending on the compiler being used,
+# the type names can be printed differently.
+set real [fortran_real4]
+
 # Try to access values in non allocated VLA
 gdb_breakpoint [gdb_get_line_number "vla1-init"]
 gdb_continue_to_breakpoint "vla1-init"
 gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
 gdb_test "print &vla1" \
-  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(<not allocated>\\\)\\\)\\\) $hex" \
+  " = \\\(PTR TO -> \\\( $real \\\(<not allocated>\\\)\\\)\\\) $hex" \
   "print non-allocated &vla1"
 gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \
   "print member in non-allocated vla1 (1)"
@@ -51,7 +56,7 @@ with_timeout_factor 15 {
 	"step over value assignment of vla1"
 }
 gdb_test "print &vla1" \
-  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \
+  " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \
   "print allocated &vla1"
 gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)"
 gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)"
@@ -71,7 +76,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \
 # Try to access values in undefined pointer to VLA (dangling)
 gdb_test "print pvla" " = <not associated>" "print undefined pvla"
 gdb_test "print &pvla" \
-  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(<not associated>\\\)\\\)\\\) $hex" \
+  " = \\\(PTR TO -> \\\( $real \\\(<not associated>\\\)\\\)\\\) $hex" \
   "print non-associated &pvla"
 gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \
   "print undefined pvla(1,3,8)"
@@ -80,7 +85,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated
 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
 gdb_continue_to_breakpoint "pvla-associated"
 gdb_test "print &pvla" \
-  " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \
+  " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \
   "print associated &pvla"
 gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)"
 gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)"
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
index dd56c35..a4a9a89 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -17,6 +17,7 @@
 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
+load_lib "fortran.exp"
 
 if { [skip_fortran_tests] } { return -1 }
 
@@ -40,10 +41,9 @@ mi_runto MAIN__
 mi_create_varobj "array" "array" "create local variable array"
 
 
-# Depending on the compiler version being used, the name of the 4-byte integer
-# and real types can be printed differently.  For instance, gfortran-4.1 uses
-# "int4" whereas gfortran-4.3 uses "integer(kind=4)".
-set int4 "(int4|integer\\(kind=4\\))"
+# Depending on the compiler being used,
+# the type names can be printed differently.
+set int4 [fortran_int4]
 
 set children [list [list "array.-1" "-1" 2 "$int4 \\(2\\)"] \
 		  [list "array.0" "0" 2 "$int4 \\(2\\)"] \
diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
index b81165e..9d47eba 100644
--- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
@@ -17,6 +17,7 @@
 # Array (VLA).
 
 load_lib mi-support.exp
+load_lib fortran.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
@@ -32,6 +33,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
      return -1
 }
 
+# Depending on the compiler being used,
+# the type names can be printed differently.
+set real [fortran_real4]
+
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
@@ -58,7 +63,7 @@ mi_gdb_test "503-var-evaluate-expression vla1_not_allocated" \
   "503\\^done,value=\"\\\[0\\\]\"" \
   "eval variable vla1_not_allocated"
 mi_list_array_varobj_children_with_index "vla1_not_allocated" "0" "1" \
-    "real\\\(kind=4\\\)" "get children of vla1_not_allocated"
+    "$real" "get children of vla1_not_allocated"
 
 
 
@@ -71,10 +76,10 @@ mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
 mi_gdb_test "510-data-evaluate-expression vla1" \
   "510\\^done,value=\"\\(.*\\)\"" "evaluate allocated vla"
 
-mi_create_varobj_checked vla1_allocated vla1 "real\\\(kind=4\\\) \\\(5\\\)" \
+mi_create_varobj_checked vla1_allocated vla1 "$real \\\(5\\\)" \
   "create local variable vla1_allocated"
 mi_gdb_test "511-var-info-type vla1_allocated" \
-  "511\\^done,type=\"real\\\(kind=4\\\) \\\(5\\\)\"" \
+  "511\\^done,type=\"$real \\\(5\\\)\"" \
   "info type variable vla1_allocated"
 mi_gdb_test "512-var-show-format vla1_allocated" \
   "512\\^done,format=\"natural\"" \
@@ -83,7 +88,7 @@ mi_gdb_test "513-var-evaluate-expression vla1_allocated" \
   "513\\^done,value=\"\\\[5\\\]\"" \
   "eval variable vla1_allocated"
 mi_list_array_varobj_children_with_index "vla1_allocated" "5" "1" \
-    "real\\\(kind=4\\\)" "get children of vla1_allocated"
+    "$real" "get children of vla1_allocated"
 
 
 set bp_lineno [gdb_get_line_number "vla1-filled"]
@@ -148,7 +153,7 @@ gdb_expect {
 	    "583\\^done,value=\"\\\[0\\\]\"" \
 	    "eval variable pvla2_not_associated"
 	mi_list_array_varobj_children_with_index "pvla2_not_associated" "0" "1" \
-	    "real\\\(kind=4\\\)" "get children of pvla2_not_associated"
+	    "$real" "get children of pvla2_not_associated"
     }
     -re "580\\^error,msg=\"value contents too large \\(\[0-9\]+ bytes\\).*${mi_gdb_prompt}$" {
 	# Undefined behaviour in gfortran.
@@ -173,9 +178,9 @@ mi_gdb_test "590-data-evaluate-expression pvla2" \
   "evaluate associated vla"
 
 mi_create_varobj_checked pvla2_associated pvla2 \
-  "real\\\(kind=4\\\) \\\(5,2\\\)" "create local variable pvla2_associated"
+  "$real \\\(5,2\\\)" "create local variable pvla2_associated"
 mi_gdb_test "591-var-info-type pvla2_associated" \
-  "591\\^done,type=\"real\\\(kind=4\\\) \\\(5,2\\\)\"" \
+  "591\\^done,type=\"$real \\\(5,2\\\)\"" \
   "info type variable pvla2_associated"
 mi_gdb_test "592-var-show-format pvla2_associated" \
   "592\\^done,format=\"natural\"" \
-- 
2.7.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] Fix indentation for printing Fortran types with pointers
  2017-08-21 12:20 [PATCH 0/4] More Fortran Patches Tim Wiederhake
@ 2017-08-21 12:20 ` Tim Wiederhake
  2017-09-04 13:35   ` Yao Qi
  2017-08-21 12:20 ` [PATCH 3/4] fortran: Testsuite, fix typos in vla-value Tim Wiederhake
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Tim Wiederhake @ 2017-08-21 12:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Frank Penczek

From: Frank Penczek <frank.penczek@intel.com>

Printing the prefix "PTR TO -> (" resp. "REF TO ->(" ignored the active
indentation level.  This caused inconsistent appearance of user-defined
Fortran types containing pointers.  Fix by using "fprintfi_filtered" with the
current indentation level for outputting the prefix string.  Add test case
ptr-indentation.

Example using 'ptype' on object of type:
  type TypeWithPointer
    integer i
    integer, pointer:: p
  end type TypeWithPointer

Before:
  type = Type typewithpointer
      integer(kind=4) :: i
  PTR TO -> ( integer(kind=4) :: p)
  End Type typewithpointer

After:
  type = Type typewithpointer
      integer(kind=4) :: i
      PTR TO -> ( integer(kind=4) :: p)
  End Type typewithpointer

xxxx-yy-zz  Frank Penczek  <frank.penczek@intel.com>
            Christoph Weinmann  <christoph.t.weinmann@intel.com>
            Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/ChangeLog:

	* f-typeprint.c (f_type_print_base): Use fprintfi_filtered
	to maintain proper indentation when printing pointers/refs.

testsuite/ChangeLog

	* gdb.fortran/ptr-indentation.f90: New file.
	* gdb.fortran/ptr-indentation.exp: New file.


2017-08-21  Frank Penczek  <frank.penczek@intel.com>
---
 gdb/f-typeprint.c                             |  8 +++---
 gdb/testsuite/gdb.fortran/ptr-indentation.exp | 41 +++++++++++++++++++++++++++
 gdb/testsuite/gdb.fortran/ptr-indentation.f90 | 30 ++++++++++++++++++++
 3 files changed, 75 insertions(+), 4 deletions(-)
 create mode 100644 gdb/testsuite/gdb.fortran/ptr-indentation.exp
 create mode 100644 gdb/testsuite/gdb.fortran/ptr-indentation.f90

diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 7dbe093..37d0d8e 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -309,13 +309,13 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
       break;
 
     case TYPE_CODE_PTR:
-      fprintf_filtered (stream, "PTR TO -> ( ");
-      f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+      fprintfi_filtered (level, stream, "PTR TO -> ( ");
+      f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
       break;
 
     case TYPE_CODE_REF:
-      fprintf_filtered (stream, "REF TO -> ( ");
-      f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+      fprintfi_filtered (level, stream, "REF TO -> ( ");
+      f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
       break;
 
     case TYPE_CODE_VOID:
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
new file mode 100644
index 0000000..ea510f1
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
@@ -0,0 +1,41 @@
+# Copyright 2017 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if {[skip_fortran_tests]} { return -1 }
+
+standard_testfile .f90
+load_lib fortran.exp
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
+    return -1
+}
+
+if {![runto MAIN__]} then {
+    untested "couldn't run to breakpoint MAIN__"
+    return -1
+}
+
+set int [fortran_int4]
+set real [fortran_real4]
+
+gdb_breakpoint [gdb_get_line_number "BP1"]
+gdb_continue_to_breakpoint "BP1"
+
+# Check the indentation when using ptype on pointers in user-defined types.
+gdb_test "ptype tinsta" \
+  [multi_line "type = Type tuserdef" \
+              "    $int :: i" \
+              "    PTR TO -> \\( $real :: ptr\\)" \
+              "End Type tuserdef"]
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.f90 b/gdb/testsuite/gdb.fortran/ptr-indentation.f90
new file mode 100644
index 0000000..045f5ef
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.f90
@@ -0,0 +1,30 @@
+! Copyright 2017 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+program main
+  implicit none
+
+  type tuserdef
+    integer :: i
+    real, pointer :: ptr
+  end type tuserdef
+  real, target :: rval
+
+  type(tuserdef), target:: tinsta,tinstb,tinstc
+
+  tinsta%i = 4
+  tinsta%ptr => rval                        !BP1
+
+end program main
-- 
2.7.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file.
  2017-08-21 12:20 [PATCH 0/4] More Fortran Patches Tim Wiederhake
                   ` (2 preceding siblings ...)
  2017-08-21 12:20 ` [PATCH 2/4] Fortran: Testsuite, fix differences in type naming Tim Wiederhake
@ 2017-08-21 12:20 ` Tim Wiederhake
  2017-09-04 13:32   ` Yao Qi
  3 siblings, 1 reply; 13+ messages in thread
From: Tim Wiederhake @ 2017-08-21 12:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Christoph Weinmann

From: Christoph Weinmann <christoph.t.weinmann@intel.com>

Remove code relevant for printing C/C++ Integer values in a
Fortran specific file to unify printing of Fortran values.

xxxx-yy-zz  Christoph Weinmann  <christoph.t.weinmann@intel.com>

gdb/ChangeLog:

	* f-valprint.c (f_val_print): Remove check for one byte
	sized integers. Remove printing of character type.

gdb/testsuite/ChangeLog:

	* gdb.fortran/printing-types.exp: New file.
	* gdb.fortran/printing-types.exp: New file.


---
 gdb/f-valprint.c                             | 18 ++------------
 gdb/testsuite/gdb.fortran/printing-types.exp | 35 ++++++++++++++++++++++++++++
 gdb/testsuite/gdb.fortran/printing-types.f90 | 27 +++++++++++++++++++++
 3 files changed, 64 insertions(+), 16 deletions(-)
 create mode 100644 gdb/testsuite/gdb.fortran/printing-types.exp
 create mode 100644 gdb/testsuite/gdb.fortran/printing-types.f90

diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 4234447..8fc894a 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -310,22 +310,8 @@ f_val_print (struct type *type, int embedded_offset,
 				      original_value, &opts, 0, stream);
 	}
       else
-	{
-	  val_print_scalar_formatted (type, embedded_offset,
-				      original_value, options, 0, stream);
-	  /* C and C++ has no single byte int type, char is used instead.
-	     Since we don't know whether the value is really intended to
-	     be used as an integer or a character, print the character
-	     equivalent as well.  */
-	  if (TYPE_LENGTH (type) == 1)
-	    {
-	      LONGEST c;
-
-	      fputs_filtered (" ", stream);
-	      c = unpack_long (type, valaddr + embedded_offset);
-	      LA_PRINT_CHAR ((unsigned char) c, type, stream);
-	    }
-	}
+	val_print_scalar_formatted (type, embedded_offset,
+				    original_value, options, 0, stream);
       break;
 
     case TYPE_CODE_STRUCT:
diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
new file mode 100644
index 0000000..085de4f
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/printing-types.exp
@@ -0,0 +1,35 @@
+# Copyright 2017 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if {[skip_fortran_tests]} { return -1 }
+
+standard_testfile .f90
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
+    return -1
+}
+
+if {![runto MAIN__]} then {
+    untested "Could not run to breakpoint MAIN__"
+    return -1
+}
+
+gdb_breakpoint [gdb_get_line_number "write"]
+gdb_continue_to_breakpoint "write"
+
+gdb_test "print oneByte"	" = 1"
+gdb_test "print twobytes"	" = 2"
+gdb_test "print chvalue"	" = \'a\'"
+gdb_test "print logvalue"	" = \.TRUE\."
diff --git a/gdb/testsuite/gdb.fortran/printing-types.f90 b/gdb/testsuite/gdb.fortran/printing-types.f90
new file mode 100644
index 0000000..749aa7c
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/printing-types.f90
@@ -0,0 +1,27 @@
+! Copyright 2017 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+program prog
+  integer(1) :: oneByte
+  integer(2) :: twoBytes
+  character  :: chValue
+  logical(1) :: logValue
+
+  oneByte  = 1
+  twoBytes = 2
+  chValue  = 'a'
+  logValue = .true.
+  write(*,*) s
+end
-- 
2.7.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] Fortran: Testsuite, fix differences in type naming.
  2017-08-21 12:20 ` [PATCH 2/4] Fortran: Testsuite, fix differences in type naming Tim Wiederhake
@ 2017-09-04 13:25   ` Yao Qi
  2017-09-08 13:17     ` Wiederhake, Tim
  0 siblings, 1 reply; 13+ messages in thread
From: Yao Qi @ 2017-09-04 13:25 UTC (permalink / raw)
  To: Tim Wiederhake; +Cc: gdb-patches, Bernhard Heckel

Tim Wiederhake <tim.wiederhake@intel.com> writes:

> gdb/Testsuite/Changelog:

s/Testsuite/testsuite/

> 	* gdb.fortran/vla-value.exp: Use type names defined in
> 	libfortran.

"Use type name from fortran_real4".

> 	* gdb.mi/mi-var-child-f.exp: Likewise.

"Use type name from fortran_int4".

> 	* gdb.mi/mi-vla-fortran.exp: Likewise.

otherwise, patch is good to me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/4] fortran: Testsuite, fix typos in vla-value.
  2017-08-21 12:20 ` [PATCH 3/4] fortran: Testsuite, fix typos in vla-value Tim Wiederhake
@ 2017-09-04 13:26   ` Yao Qi
  2017-09-08 13:17     ` Wiederhake, Tim
  0 siblings, 1 reply; 13+ messages in thread
From: Yao Qi @ 2017-09-04 13:26 UTC (permalink / raw)
  To: Tim Wiederhake; +Cc: gdb-patches, Bernhard Heckel

Tim Wiederhake <tim.wiederhake@intel.com> writes:

> gdb/testsuite/ChangeLog:
> 	* gdb.fortran/vla-ptype.exp: Fix typos.
> 	* gdb.fortran/vla-value.exp: Same.

It is obvious.  Patch is good to me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file.
  2017-08-21 12:20 ` [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file Tim Wiederhake
@ 2017-09-04 13:32   ` Yao Qi
  2017-09-08 13:18     ` Wiederhake, Tim
  0 siblings, 1 reply; 13+ messages in thread
From: Yao Qi @ 2017-09-04 13:32 UTC (permalink / raw)
  To: Tim Wiederhake; +Cc: gdb-patches, Christoph Weinmann

Tim Wiederhake <tim.wiederhake@intel.com> writes:

> Remove code relevant for printing C/C++ Integer values in a
> Fortran specific file to unify printing of Fortran values.

Does this patch affect the output of printing variables in Fortran?
If so, how does it affect the output?  It would be great to mention
these changes in commit log, at least.

>
> xxxx-yy-zz  Christoph Weinmann  <christoph.t.weinmann@intel.com>
>
> gdb/ChangeLog:
>
> 	* f-valprint.c (f_val_print): Remove check for one byte
> 	sized integers. Remove printing of character type.
>
> gdb/testsuite/ChangeLog:
>
> 	* gdb.fortran/printing-types.exp: New file.

gdb.fortran/printing-types.f90.

> 	* gdb.fortran/printing-types.exp: New file.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] Fix indentation for printing Fortran types with pointers
  2017-08-21 12:20 ` [PATCH 1/4] Fix indentation for printing Fortran types with pointers Tim Wiederhake
@ 2017-09-04 13:35   ` Yao Qi
  2017-09-08 13:19     ` Wiederhake, Tim
  0 siblings, 1 reply; 13+ messages in thread
From: Yao Qi @ 2017-09-04 13:35 UTC (permalink / raw)
  To: Tim Wiederhake; +Cc: gdb-patches, Frank Penczek

Tim Wiederhake <tim.wiederhake@intel.com> writes:

> xxxx-yy-zz  Frank Penczek  <frank.penczek@intel.com>
>             Christoph Weinmann  <christoph.t.weinmann@intel.com>
>             Bernhard Heckel  <bernhard.heckel@intel.com>
>
> gdb/ChangeLog:
>
> 	* f-typeprint.c (f_type_print_base): Use fprintfi_filtered
> 	to maintain proper indentation when printing pointers/refs.
>
> testsuite/ChangeLog
>
> 	* gdb.fortran/ptr-indentation.f90: New file.
> 	* gdb.fortran/ptr-indentation.exp: New file.

Patch is good to me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 3/4] fortran: Testsuite, fix typos in vla-value.
  2017-09-04 13:26   ` Yao Qi
@ 2017-09-08 13:17     ` Wiederhake, Tim
  0 siblings, 0 replies; 13+ messages in thread
From: Wiederhake, Tim @ 2017-09-08 13:17 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Thanks!

Pushed as e0f86435f8b3c61e21070a232a07c03928c2d544.

Tim

> -----Original Message-----
> From: Yao Qi [mailto:qiyaoltc@gmail.com]
> Sent: Monday, September 4, 2017 3:26 PM
> To: Wiederhake, Tim <tim.wiederhake@intel.com>
> Cc: gdb-patches@sourceware.org; Bernhard Heckel
> <bernhard.heckel@intel.com>
> Subject: Re: [PATCH 3/4] fortran: Testsuite, fix typos in vla-value.
> 
> Tim Wiederhake <tim.wiederhake@intel.com> writes:
> 
> > gdb/testsuite/ChangeLog:
> > 	* gdb.fortran/vla-ptype.exp: Fix typos.
> > 	* gdb.fortran/vla-value.exp: Same.
> 
> It is obvious.  Patch is good to me.
> 
> --
> Yao (齐尧)
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 2/4] Fortran: Testsuite, fix differences in type naming.
  2017-09-04 13:25   ` Yao Qi
@ 2017-09-08 13:17     ` Wiederhake, Tim
  0 siblings, 0 replies; 13+ messages in thread
From: Wiederhake, Tim @ 2017-09-08 13:17 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Thanks!

Fixed and pushed as 9e9af4be9f656f82922e6aaeb3b6421508403ea4.

Tim

> -----Original Message-----
> From: Yao Qi [mailto:qiyaoltc@gmail.com]
> Sent: Monday, September 4, 2017 3:25 PM
> To: Wiederhake, Tim <tim.wiederhake@intel.com>
> Cc: gdb-patches@sourceware.org; Bernhard Heckel
> <bernhard.heckel@intel.com>
> Subject: Re: [PATCH 2/4] Fortran: Testsuite, fix differences in type
> naming.
> 
> Tim Wiederhake <tim.wiederhake@intel.com> writes:
> 
> > gdb/Testsuite/Changelog:
> 
> s/Testsuite/testsuite/
> 
> > 	* gdb.fortran/vla-value.exp: Use type names defined in
> > 	libfortran.
> 
> "Use type name from fortran_real4".
> 
> > 	* gdb.mi/mi-var-child-f.exp: Likewise.
> 
> "Use type name from fortran_int4".
> 
> > 	* gdb.mi/mi-vla-fortran.exp: Likewise.
> 
> otherwise, patch is good to me.
> 
> --
> Yao (齐尧)
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file.
  2017-09-04 13:32   ` Yao Qi
@ 2017-09-08 13:18     ` Wiederhake, Tim
  0 siblings, 0 replies; 13+ messages in thread
From: Wiederhake, Tim @ 2017-09-08 13:18 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Thanks!

Clarified in the commit message that the output is unchanged. Pushed as 469412dd9ccc4de5874fd3299b105833f36b34cd.

Tim

> -----Original Message-----
> From: Yao Qi [mailto:qiyaoltc@gmail.com]
> Sent: Monday, September 4, 2017 3:32 PM
> To: Wiederhake, Tim <tim.wiederhake@intel.com>
> Cc: gdb-patches@sourceware.org; Weinmann, Christoph T
> <christoph.t.weinmann@intel.com>
> Subject: Re: [PATCH 4/4] Remove C/C++ relevant code in Fortran specific
> file.
> 
> Tim Wiederhake <tim.wiederhake@intel.com> writes:
> 
> > Remove code relevant for printing C/C++ Integer values in a
> > Fortran specific file to unify printing of Fortran values.
> 
> Does this patch affect the output of printing variables in Fortran?
> If so, how does it affect the output?  It would be great to mention
> these changes in commit log, at least.
> 
> >
> > xxxx-yy-zz  Christoph Weinmann  <christoph.t.weinmann@intel.com>
> >
> > gdb/ChangeLog:
> >
> > 	* f-valprint.c (f_val_print): Remove check for one byte
> > 	sized integers. Remove printing of character type.
> >
> > gdb/testsuite/ChangeLog:
> >
> > 	* gdb.fortran/printing-types.exp: New file.
> 
> gdb.fortran/printing-types.f90.
> 
> > 	* gdb.fortran/printing-types.exp: New file.
> 
> --
> Yao (齐尧)
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/4] Fix indentation for printing Fortran types with pointers
  2017-09-04 13:35   ` Yao Qi
@ 2017-09-08 13:19     ` Wiederhake, Tim
  0 siblings, 0 replies; 13+ messages in thread
From: Wiederhake, Tim @ 2017-09-08 13:19 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Thanks!

Pushed as a5ad232b3e6f39cf2955a8ec3aa4355359a9f72e.

Tim

> -----Original Message-----
> From: Yao Qi [mailto:qiyaoltc@gmail.com]
> Sent: Monday, September 4, 2017 3:36 PM
> To: Wiederhake, Tim <tim.wiederhake@intel.com>
> Cc: gdb-patches@sourceware.org; Penczek, Frank <frank.penczek@intel.com>
> Subject: Re: [PATCH 1/4] Fix indentation for printing Fortran types with
> pointers
> 
> Tim Wiederhake <tim.wiederhake@intel.com> writes:
> 
> > xxxx-yy-zz  Frank Penczek  <frank.penczek@intel.com>
> >             Christoph Weinmann  <christoph.t.weinmann@intel.com>
> >             Bernhard Heckel  <bernhard.heckel@intel.com>
> >
> > gdb/ChangeLog:
> >
> > 	* f-typeprint.c (f_type_print_base): Use fprintfi_filtered
> > 	to maintain proper indentation when printing pointers/refs.
> >
> > testsuite/ChangeLog
> >
> > 	* gdb.fortran/ptr-indentation.f90: New file.
> > 	* gdb.fortran/ptr-indentation.exp: New file.
> 
> Patch is good to me.
> 
> --
> Yao (齐尧)
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-09-08 13:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 12:20 [PATCH 0/4] More Fortran Patches Tim Wiederhake
2017-08-21 12:20 ` [PATCH 1/4] Fix indentation for printing Fortran types with pointers Tim Wiederhake
2017-09-04 13:35   ` Yao Qi
2017-09-08 13:19     ` Wiederhake, Tim
2017-08-21 12:20 ` [PATCH 3/4] fortran: Testsuite, fix typos in vla-value Tim Wiederhake
2017-09-04 13:26   ` Yao Qi
2017-09-08 13:17     ` Wiederhake, Tim
2017-08-21 12:20 ` [PATCH 2/4] Fortran: Testsuite, fix differences in type naming Tim Wiederhake
2017-09-04 13:25   ` Yao Qi
2017-09-08 13:17     ` Wiederhake, Tim
2017-08-21 12:20 ` [PATCH 4/4] Remove C/C++ relevant code in Fortran specific file Tim Wiederhake
2017-09-04 13:32   ` Yao Qi
2017-09-08 13:18     ` Wiederhake, Tim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).