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