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

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