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

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