Blame SOURCES/gdb-6.7-charsign-test.patch

475228
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
475228
From: Jan Kratochvil <jan.kratochvil@redhat.com>
475228
Date: Fri, 27 Oct 2017 21:07:50 +0200
475228
Subject: gdb-6.7-charsign-test.patch
475228
475228
;; Fix displaying of numeric char arrays as strings (BZ 224128).
475228
;;=fedoratest: But it is failing anyway, one should check the behavior more.
475228
475228
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128
475228
475228
2007-01-25  Jan Kratochvil <jan.kratochvil@redhat.com>
475228
475228
	* gdb.base/charsign.exp, gdb.base/charsign.c: New files.
475228
	[ stripped ]
475228
475228
2007-10-19  Jan Kratochvil <jan.kratochvil@redhat.com>
475228
475228
	Port to GDB-6.7 - only the testcase left, patch has been reverted,
475228
	char-vectors restricted.
475228
475228
diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c
475228
new file mode 100644
475228
--- /dev/null
475228
+++ b/gdb/testsuite/gdb.base/charsign.c
475228
@@ -0,0 +1,37 @@
475228
+/* This testcase is part of GDB, the GNU debugger.
475228
+
475228
+   Copyright 2007 Free Software Foundation, Inc.
475228
+
475228
+   This program is free software; you can redistribute it and/or modify
475228
+   it under the terms of the GNU General Public License as published by
475228
+   the Free Software Foundation; either version 2 of the License, or
475228
+   (at your option) any later version.
475228
+
475228
+   This program is distributed in the hope that it will be useful,
475228
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
475228
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
475228
+   GNU General Public License for more details.
475228
+ 
475228
+   You should have received a copy of the GNU General Public License
475228
+   along with this program; if not, write to the Free Software
475228
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
475228
+
475228
+   Please email any bugs, comments, and/or additions to this file to:
475228
+   bug-gdb@prep.ai.mit.edu  */
475228
+
475228
+int main()
475228
+{
475228
+  return 0;
475228
+}
475228
+
475228
+char n[]="A";
475228
+signed char s[]="A";
475228
+unsigned char u[]="A";
475228
+
475228
+typedef char char_n;
475228
+typedef signed char char_s;
475228
+typedef unsigned char char_u;
475228
+
475228
+char_n n_typed[]="A";
475228
+char_s s_typed[]="A";
475228
+char_u u_typed[]="A";
475228
diff --git a/gdb/testsuite/gdb.base/charsign.exp b/gdb/testsuite/gdb.base/charsign.exp
475228
new file mode 100644
475228
--- /dev/null
475228
+++ b/gdb/testsuite/gdb.base/charsign.exp
475228
@@ -0,0 +1,63 @@
475228
+# Copyright 2007 Free Software Foundation, Inc.
475228
+
475228
+# This program is free software; you can redistribute it and/or modify
475228
+# it under the terms of the GNU General Public License as published by
475228
+# the Free Software Foundation; either version 2 of the License, or
475228
+# (at your option) any later version.
475228
+# 
475228
+# This program is distributed in the hope that it will be useful,
475228
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
475228
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
475228
+# GNU General Public License for more details.
475228
+# 
475228
+# You should have received a copy of the GNU General Public License
475228
+# along with this program; if not, write to the Free Software
475228
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
475228
+
475228
+set testfile charsign
475228
+set srcfile ${testfile}.c
475228
+set binfile [standard_output_file ${testfile}]
475228
+
475228
+proc do_test { cflags } {
475228
+    global srcdir
475228
+    global binfile
475228
+    global subdir
475228
+    global srcfile
475228
+    global gdb_prompt
475228
+
475228
+    if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$cflags]] != "" } {
475228
+	untested "Couldn't compile test program"
475228
+	return -1
475228
+    }
475228
+
475228
+    # Get things started.
475228
+
475228
+    gdb_exit
475228
+    gdb_start
475228
+    gdb_reinitialize_dir $srcdir/$subdir
475228
+    gdb_load ${binfile}
475228
+
475228
+    # For C programs, "start" should stop in main().
475228
+
475228
+    gdb_test "p n" \
475228
+	     "= \"A\""
475228
+    gdb_test "p s" \
475228
+	     "= \\{65 'A', 0 '\\\\0'\\}"
475228
+    gdb_test "p u" \
475228
+	     "= \\{65 'A', 0 '\\\\0'\\}"
475228
+    gdb_test "p n_typed" \
475228
+	     "= \"A\""
475228
+    gdb_test "p s_typed" \
475228
+	     "= \\{65 'A', 0 '\\\\0'\\}"
475228
+    gdb_test "p u_typed" \
475228
+	     "= \\{65 'A', 0 '\\\\0'\\}"
475228
+}
475228
+
475228
+# The string identification works despite the compiler flags below due to
475228
+# gdbtypes.c:
475228
+#   if (name && strcmp (name, "char") == 0)
475228
+#     TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
475228
+
475228
+do_test {}
475228
+do_test {-fsigned-char}
475228
+do_test {-funsigned-char}