This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Check sign of '\377'


Hello,

This checks that the sign of '\377' matches the value printed by the target program. Should help detect the charset failures some targets have been seeing.

Thanks to corinna for explaining the problem.

committed,
Andrew
2003-03-29  Andrew Cagney  <cagney at redhat dot com>

	* gdb.base/sizeof.c (main): Print the value of '\377'.
	* gdb.base/sizeof.exp: Check the sign of '\377'.

Index: gdb.base/sizeof.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sizeof.c,v
retrieving revision 1.3
diff -u -r1.3 sizeof.c
--- gdb.base/sizeof.c	21 Feb 2002 01:55:05 -0000	1.3
+++ gdb.base/sizeof.c	30 Mar 2003 04:04:35 -0000
@@ -114,6 +114,7 @@
   printf ("sizeof (long double) == %d\n", sizeof (long double));
 
   /* Signed char?  */
+  printf ("valueof ('\\377') == %d\n", '\377');
   printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1);
   printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1);
   printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1);
Index: gdb.base/sizeof.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sizeof.exp,v
retrieving revision 1.4
diff -u -r1.4 sizeof.exp
--- gdb.base/sizeof.exp	21 Feb 2002 01:55:05 -0000	1.4
+++ gdb.base/sizeof.exp	30 Mar 2003 04:04:35 -0000
@@ -154,10 +154,12 @@
 
 # Check that GDB and the target agree over the sign of a character.
 
+set signof_byte [get_valueof "/d" "'\\377'" -1]
 set signof_char [get_valueof "/d" "(int) (char) -1" -1]
 set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1]
 set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1]
 
+check_valueof "'\\\\377'" ${signof_byte}
 check_valueof "(int) (char) -1" ${signof_char}
 check_valueof "(int) (signed char) -1" ${signof_signed_char}
 check_valueof "(int) (unsigned char) -1" ${signof_unsigned_char}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]