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

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