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

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