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

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