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

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