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]

[patch/rfc] Don't escape '\e'


This removes '\e' from charsets and then fixes the fallout. '\e' isn't part of ISO-C. I'll commit in the morning.

Andrew

2004-02-25  Andrew Cagney  <cagney@redhat.com>

	Fix PR i18n/1570.
	* charset.c (backslashable, backslashed, represented): Remove 'e'
	from list of escaped characters, not part of ISO-C.

Index: testsuite/ChangeLog
2004-02-26  Andrew Cagney  <cagney@redhat.com>

	* gdb.base/charset.c: Update copyright notice.
	(main, init_string): Remove the escape character '\e' tests.
	* gdb.base/printcmds.exp (test_print_all_chars): Ditto.
	* gdb.base/charset.exp (valid_host_charset): Ditto.
	* gdb.base/setvar.exp: Ditto.

Index: charset.c
===================================================================
RCS file: /cvs/src/src/gdb/charset.c,v
retrieving revision 1.6
diff -u -r1.6 charset.c
--- charset.c	4 Aug 2003 17:08:22 -0000	1.6
+++ charset.c	26 Feb 2004 05:33:39 -0000
@@ -518,9 +518,9 @@
 /* Default non-trivial conversion functions.  */
 
 
-static char backslashable[] = "abefnrtv";
-static char *backslashed[] = {"a", "b", "e", "f", "n", "r", "t", "v", "0"};
-static char represented[] = "\a\b\e\f\n\r\t\v";
+static char backslashable[] = "abfnrtv";
+static char *backslashed[] = {"a", "b", "f", "n", "r", "t", "v", "0"};
+static char represented[] = "\a\b\f\n\r\t\v";
 
 
 /* Translate TARGET_CHAR into the host character set, and see if it
Index: testsuite/gdb.base/charset.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/charset.c,v
retrieving revision 1.2
diff -u -r1.2 charset.c
--- testsuite/gdb.base/charset.c	24 Jan 2004 18:25:06 -0000	1.2
+++ testsuite/gdb.base/charset.c	26 Feb 2004 05:33:53 -0000
@@ -1,5 +1,25 @@
-/* Test GDB's character set support
-   Jim Blandy <jimb@cygnus.com> --- December 2001 */
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2001, 2004 Free Software Foundation, Inc.
+
+   Contributed by Red Hat, originally written by Jim Blandy.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+ 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+   Please email any bugs, comments, and/or additions to this file to:
+   bug-gdb@gnu.org  */
 
 #include <stdio.h>
 #include <string.h>
@@ -14,21 +34,20 @@
 
    [0] --- the `alert' character, '\a'
    [1] --- the `backspace' character, '\b'
-   [2] --- the `escape' character, '\e'
-   [3] --- the `form feed' character, '\f'
-   [4] --- the `line feed' character, '\n'
-   [5] --- the `carriage return' character, '\r'
-   [6] --- the `horizontal tab' character, '\t'
-   [7] --- the `vertical tab' character, '\v'
-   [8  .. 33] --- the uppercase letters A-Z
-   [34 .. 59] --- the lowercase letters a-z
-   [60 .. 69] --- the digits 0-9
-   [70] --- the `cent' character
-   [71] --- a control character with no defined backslash escape
+   [2] --- the `form feed' character, '\f'
+   [3] --- the `line feed' character, '\n'
+   [4] --- the `carriage return' character, '\r'
+   [5] --- the `horizontal tab' character, '\t'
+   [6] --- the `vertical tab' character, '\v'
+   [7  .. 32] --- the uppercase letters A-Z
+   [33 .. 58] --- the lowercase letters a-z
+   [59 .. 68] --- the digits 0-9
+   [69] --- the `cent' character
+   [70] --- a control character with no defined backslash escape
 
    Feel free to extend these as you like.  */
 
-#define NUM_CHARS (72)
+#define NUM_CHARS (71)
 
 char ascii_string[NUM_CHARS];
 char iso_8859_1_string[NUM_CHARS];
@@ -39,21 +58,20 @@
 void
 init_string (char string[],
              char x,
-             char alert, char backspace, char escape, char form_feed,
+             char alert, char backspace, char form_feed,
              char line_feed, char carriage_return, char horizontal_tab,
              char vertical_tab, char cent, char misc_ctrl)
 {
   memset (string, x, NUM_CHARS);
   string[0] = alert;
   string[1] = backspace;
-  string[2] = escape;
-  string[3] = form_feed;
-  string[4] = line_feed;
-  string[5] = carriage_return;
-  string[6] = horizontal_tab;
-  string[7] = vertical_tab;
-  string[70] = cent;
-  string[71] = misc_ctrl;
+  string[2] = form_feed;
+  string[3] = line_feed;
+  string[4] = carriage_return;
+  string[5] = horizontal_tab;
+  string[6] = vertical_tab;
+  string[69] = cent;
+  string[70] = misc_ctrl;
 }
 
 
@@ -77,56 +95,56 @@
   /* Initialize ascii_string.  */
   init_string (ascii_string,
                120,
-               7, 8, 27, 12,
+               7, 8, 12,
                10, 13, 9,
                11, 120, 17);
-  fill_run (ascii_string, 8, 26, 65);
-  fill_run (ascii_string, 34, 26, 97);
-  fill_run (ascii_string, 60, 10, 48);
+  fill_run (ascii_string, 7, 26, 65);
+  fill_run (ascii_string, 33, 26, 97);
+  fill_run (ascii_string, 59, 10, 48);
 
   /* Initialize iso_8859_1_string.  */
   init_string (iso_8859_1_string,
                120,
-               7, 8, 27, 12,
+               7, 8, 12,
                10, 13, 9,
                11, 162, 17);
-  fill_run (iso_8859_1_string, 8, 26, 65);
-  fill_run (iso_8859_1_string, 34, 26, 97);
-  fill_run (iso_8859_1_string, 60, 10, 48);
+  fill_run (iso_8859_1_string, 7, 26, 65);
+  fill_run (iso_8859_1_string, 33, 26, 97);
+  fill_run (iso_8859_1_string, 59, 10, 48);
 
   /* Initialize ebcdic_us_string.  */
   init_string (ebcdic_us_string,
                167,
-               47, 22, 39, 12,
+               47, 22, 12,
                37, 13, 5,
                11, 74, 17);
   /* In EBCDIC, the upper-case letters are broken into three separate runs.  */
-  fill_run (ebcdic_us_string, 8, 9, 193);
-  fill_run (ebcdic_us_string, 17, 9, 209);
-  fill_run (ebcdic_us_string, 26, 8, 226);
+  fill_run (ebcdic_us_string, 7, 9, 193);
+  fill_run (ebcdic_us_string, 16, 9, 209);
+  fill_run (ebcdic_us_string, 25, 8, 226);
   /* The lower-case letters are, too.  */
-  fill_run (ebcdic_us_string, 34, 9, 129);
-  fill_run (ebcdic_us_string, 43, 9, 145);
-  fill_run (ebcdic_us_string, 52, 8, 162);
+  fill_run (ebcdic_us_string, 33, 9, 129);
+  fill_run (ebcdic_us_string, 42, 9, 145);
+  fill_run (ebcdic_us_string, 51, 8, 162);
   /* The digits, at least, are contiguous.  */
-  fill_run (ebcdic_us_string, 60, 10, 240);
+  fill_run (ebcdic_us_string, 59, 10, 240);
 
   /* Initialize ibm1047_string.  */
   init_string (ibm1047_string,
                167,
-               47, 22, 39, 12,
+               47, 22, 12,
                37, 13, 5,
                11, 74, 17);
   /* In EBCDIC, the upper-case letters are broken into three separate runs.  */
-  fill_run (ibm1047_string, 8, 9, 193);
-  fill_run (ibm1047_string, 17, 9, 209);
-  fill_run (ibm1047_string, 26, 8, 226);
+  fill_run (ibm1047_string, 7, 9, 193);
+  fill_run (ibm1047_string, 16, 9, 209);
+  fill_run (ibm1047_string, 25, 8, 226);
   /* The lower-case letters are, too.  */
-  fill_run (ibm1047_string, 34, 9, 129);
-  fill_run (ibm1047_string, 43, 9, 145);
-  fill_run (ibm1047_string, 52, 8, 162);
+  fill_run (ibm1047_string, 33, 9, 129);
+  fill_run (ibm1047_string, 42, 9, 145);
+  fill_run (ibm1047_string, 51, 8, 162);
   /* The digits, at least, are contiguous.  */
-  fill_run (ibm1047_string, 60, 10, 240);
+  fill_run (ibm1047_string, 59, 10, 240);
 
   puts ("All set!");            /* all strings initialized */
 }
Index: testsuite/gdb.base/charset.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/charset.exp,v
retrieving revision 1.2
diff -u -r1.2 charset.exp
--- testsuite/gdb.base/charset.exp	2 May 2003 14:23:39 -0000	1.2
+++ testsuite/gdb.base/charset.exp	26 Feb 2004 05:33:53 -0000
@@ -1,4 +1,6 @@
-# Copyright 2001 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2001, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,7 +17,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
 # Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# bug-gdb@gnu.org
 
 # Test GDB's character set support.
 
@@ -439,7 +441,7 @@
     
     # Compute a regexp matching the results we expect.  This is static,
     # but it's easier than writing it out.
-    regsub -all "." "abefnrtv" "(\\\\&|x)" escapes
+    regsub -all "." "abfnrtv" "(\\\\&|x)" escapes
     set uppercase "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     set lowercase "abcdefghijklmnopqrstuvwxyz"
     set digits "0123456789"
@@ -448,7 +450,7 @@
     send_gdb "print $var_name\n"
     # ${escapes}${uppercase}${lowercase}${digits}${octal}${octal}
     gdb_expect {
-        -re ".* = \"(\\\\a|x)(\\\\b|x)(\\\\e|x)(\\\\f|x)(\\\\n|x)(\\\\r|x)(\\\\t|x)(\\\\v|x)${uppercase}${lowercase}${digits}(\\\\\[0-9\]\[0-9\]\[0-9\]|x)(\\\\\[0-9\]\[0-9\]\[0-9\]|x).*\"\[\r\n\]+$gdb_prompt $" {
+        -re ".* = \"(\\\\a|x)(\\\\b|x)(\\\\f|x)(\\\\n|x)(\\\\r|x)(\\\\t|x)(\\\\v|x)${uppercase}${lowercase}${digits}(\\\\\[0-9\]\[0-9\]\[0-9\]|x)(\\\\\[0-9\]\[0-9\]\[0-9\]|x).*\"\[\r\n\]+$gdb_prompt $" {
             pass "print string in $target_charset"
         }
         -re "$gdb_prompt $" {
@@ -465,7 +467,7 @@
              "parse character literal in ${target_charset}"
 
     # Check that the character literal was encoded correctly.
-    gdb_test "print 'A' == $var_name\[8\]" \
+    gdb_test "print 'A' == $var_name\[7\]" \
              " = 1" \
              "check value of parsed character literal in ${target_charset}"
 
@@ -475,14 +477,14 @@
              "parse string literal in ${target_charset}"
 
     # Check that the string literal was encoded correctly.
-    gdb_test "print \"q\"\[0\] == $var_name\[50\]" \
+    gdb_test "print \"q\"\[0\] == $var_name\[49\]" \
              " = 1" \
              "check value of parsed string literal in ${target_charset}"
 
     # Test handling of characters in the target charset which
     # can't be translated into the host charset.
     if {! [string compare $target_charset iso-8859-1]} {
-        gdb_test "print iso_8859_1_string\[70\]" \
+        gdb_test "print iso_8859_1_string\[69\]" \
                  " = \[0-9-\]+ '\\\\242'" \
                  "print character with no equivalent in host character set"
         gdb_test "print iso_8859_1_string + 70" \
@@ -493,7 +495,7 @@
     # Make sure that we don't apply the ISO-8859-1 `print_literally'
     # function to ASCII.
     if {! [string compare $target_charset ascii]} {
-        gdb_test "print iso_8859_1_string\[70\]" \
+        gdb_test "print iso_8859_1_string\[69\]" \
                  " = \[0-9-\]+ '\\\\242'" \
                  "print ASCII unprintable character"
         gdb_test "print iso_8859_1_string + 70" \
@@ -502,7 +504,7 @@
     }
 
     # Try printing characters with backslash escape equivalents.
-    set escapees {a b e f n r t v}
+    set escapees {a b f n r t v}
     for {set i 0} {$i < [llength $escapees]} {incr i} {
         set escape [lindex $escapees $i]
         send_gdb "print $var_name\[$i\]\n"
@@ -541,7 +543,7 @@
     # get the unescaped character, in the target character set.
     gdb_test "print '\\q'" " = \[0-9-\]+ 'q'" \
              "print escape that doesn't exist in $target_charset"
-    gdb_test "print '\\q' == $var_name\[50\]" " = 1" \
+    gdb_test "print '\\q' == $var_name\[49\]" " = 1" \
              "check value of escape that doesn't exist in $target_charset"
 }
 
Index: testsuite/gdb.base/printcmds.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/printcmds.exp,v
retrieving revision 1.11
diff -u -r1.11 printcmds.exp
--- testsuite/gdb.base/printcmds.exp	14 Jan 2003 04:34:45 -0000	1.11
+++ testsuite/gdb.base/printcmds.exp	26 Feb 2004 05:33:55 -0000
@@ -1,5 +1,7 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003 Free
-# Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
 # Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# bug-gdb@gnu.org
 
 # This file was written by Fred Fish. (fnf@cygnus.com)
 
@@ -161,7 +163,7 @@
     gdb_test "p ctable1\[24\]"  " = 24 '\\\\030'"
     gdb_test "p ctable1\[25\]"  " = 25 '\\\\031'"
     gdb_test "p ctable1\[26\]"  " = 26 '\\\\032'"
-    gdb_test "p ctable1\[27\]"  " = 27 '\\\\e'"
+    gdb_test "p ctable1\[27\]"  " = 27 '\\\\033'"
     gdb_test "p ctable1\[28\]"  " = 28 '\\\\034'"
     gdb_test "p ctable1\[29\]"  " = 29 '\\\\035'"
     gdb_test "p ctable1\[30\]"  " = 30 '\\\\036'"
@@ -479,7 +481,7 @@
     gdb_test "p &ctable1\[2*8\]" \
 	" = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
     gdb_test "p &ctable1\[3*8\]" \
-	" = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\e\\\\034\\\\035\\\\036\\\\037\"..."
+	" = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035\\\\036\\\\037\"..."
     gdb_test "p &ctable1\[4*8\]" \
 	" = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..."
     gdb_test "p &ctable1\[5*8\]" \
Index: testsuite/gdb.base/setvar.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/setvar.exp,v
retrieving revision 1.7
diff -u -r1.7 setvar.exp
--- testsuite/gdb.base/setvar.exp	15 Jan 2004 22:23:26 -0000	1.7
+++ testsuite/gdb.base/setvar.exp	26 Feb 2004 05:33:55 -0000
@@ -1,25 +1,7 @@
-# Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2004
-# Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-#   Copyright (C) 1988, 1990, 1991, 1992, 1994, 1995
-#   Free Software Foundation, Inc.
+# Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+# 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -36,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
 # Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# bug-gdb@gnu.org
 
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
@@ -140,7 +122,7 @@
 
 test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.0\'"        "set variable char=0" 
 test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'"        "set variable char=1" 
-test_set "set variable v_char=27" "print v_char" ".\[0-9\]* = 27 \'.e\'"        "set variable char=27 (Esc)" 
+test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'"        "set variable char=7 (Bel)" 
 test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'"        "set variable char=32 (SPC)" 
 test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'"        "set variable char=65 ('A')" 
 test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'"        "set variable char=97 ('a')" 
@@ -151,7 +133,7 @@
 #    
 test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.0\'"                 "set variable signed char=0" 
 test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'"        "set variable signed char=1" 
-test_set "set variable v_signed_char=27" "print v_signed_char" ".\[0-9\]* = 27 \'.e\'"        "set variable signed char=27 (Esc)" 
+test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'"        "set variable signed char=7 (Bel)" 
 test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'"        "set variable signed char=32 (SPC)" 
 test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'"        "set variable signed char=65 ('A')" 
 test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'"        "set variable signed char=97 ('a')" 
@@ -170,7 +152,7 @@
 #
 test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.0\'"        "set variable unsigned char=0" 
 test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'"        "set variable unsigned char=1" 
-test_set "set variable v_unsigned_char=27" "print v_unsigned_char" ".\[0-9\]* = 27 \'.e\'"        "set variable unsigned char=27 (Esc)" 
+test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'"        "set variable unsigned char=7 (Bel)" 
 test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'"        "set variable unsigned char=32 (SPC)" 
 test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'"        "set variable unsigned char=65 ('A')" 
 test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'"        "set variable unsigned char=97 ('a')" 

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