Blame SOURCES/gdb-vla-intel-fix-print-char-array.patch

190f2a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
190f2a
From: Sergio Durigan Junior <sergiodj@redhat.com>
190f2a
Date: Thu, 7 Dec 2017 16:20:31 -0500
190f2a
Subject: gdb-vla-intel-fix-print-char-array.patch
190f2a
190f2a
;; Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
190f2a
190f2a
Revert commit (only the part touching gdb/f-valprint.c):
190f2a
190f2a
  commit 469412dd9ccc4de5874fd3299b105833f36b34cd
190f2a
  Author: Christoph Weinmann <christoph.t.weinmann@intel.com>
190f2a
  Date:   Fri Sep 8 15:11:47 2017 +0200
190f2a
190f2a
      Remove C/C++ relevant code in Fortran specific file.
190f2a
190f2a
      Remove code relevant for printing C/C++ Integer values in a
190f2a
      Fortran specific file to unify printing of Fortran values.
190f2a
      This does not change the output.
190f2a
190f2a
And adjust its testcase.
190f2a
190f2a
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
190f2a
--- a/gdb/f-valprint.c
190f2a
+++ b/gdb/f-valprint.c
190f2a
@@ -313,8 +313,22 @@ f_val_print (struct type *type, LONGEST embedded_offset,
190f2a
 				      original_value, &opts, 0, stream);
190f2a
 	}
190f2a
       else
190f2a
-	val_print_scalar_formatted (type, embedded_offset,
190f2a
-				    original_value, options, 0, stream);
190f2a
+	{
190f2a
+	  val_print_scalar_formatted (type, embedded_offset,
190f2a
+				      original_value, options, 0, stream);
190f2a
+	  /* C and C++ has no single byte int type, char is used instead.
190f2a
+	     Since we don't know whether the value is really intended to
190f2a
+	     be used as an integer or a character, print the character
190f2a
+	     equivalent as well.  */
190f2a
+	  if (TYPE_LENGTH (type) == 1)
190f2a
+	    {
190f2a
+	      LONGEST c;
190f2a
+
190f2a
+	      fputs_filtered (" ", stream);
190f2a
+	      c = unpack_long (type, valaddr + embedded_offset);
190f2a
+	      LA_PRINT_CHAR ((unsigned char) c, type, stream);
190f2a
+	    }
190f2a
+	}
190f2a
       break;
190f2a
 
190f2a
     case TYPE_CODE_STRUCT:
190f2a
diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
190f2a
--- a/gdb/testsuite/gdb.fortran/printing-types.exp
190f2a
+++ b/gdb/testsuite/gdb.fortran/printing-types.exp
190f2a
@@ -29,7 +29,7 @@ if {![runto MAIN__]} then {
190f2a
 gdb_breakpoint [gdb_get_line_number "write"]
190f2a
 gdb_continue_to_breakpoint "write"
190f2a
 
190f2a
-gdb_test "print oneByte"	" = 1"
190f2a
+gdb_test "print oneByte"	" = 1 \'\\\\001\'"
190f2a
 gdb_test "print twobytes"	" = 2"
190f2a
 gdb_test "print chvalue"	" = \'a\'"
190f2a
 gdb_test "print logvalue"	" = \.TRUE\."