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

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