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

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