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

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