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

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