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

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