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

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