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

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