From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15302 invoked by alias); 1 Oct 2013 13:23:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 15291 invoked by uid 89); 1 Oct 2013 13:23:40 -0000 Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Oct 2013 13:23:40 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT autolearn=no version=3.3.2 X-HELO: mailhost.u-strasbg.fr Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antispam (Postfix) with ESMTP id 613AC140269; Tue, 1 Oct 2013 15:23:36 +0200 (CEST) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id 5040214021B; Tue, 1 Oct 2013 15:23:36 +0200 (CEST) Received: from md13.u-strasbg.fr (md13.u-strasbg.fr [130.79.200.248]) by mr6.u-strasbg.fr (Postfix) with ESMTP id 28B13140B98; Tue, 1 Oct 2013 15:23:34 +0200 (CEST) Received: from ms13.u-strasbg.fr (ms13.u-strasbg.fr [130.79.204.113]) by md13.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r91DNXWM012108 ; Tue, 1 Oct 2013 15:23:34 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (Authenticated sender: mullerp) by ms13.u-strasbg.fr (Postfix) with ESMTPSA id 804521FD84; Tue, 1 Oct 2013 15:23:32 +0200 (CEST) From: "Pierre Muller" To: "'Keith Seitz'" Cc: "'gdb-patches'" References: <002901cebaf2$35ec65a0$a1c530e0$@muller@ics-cnrs.unistra.fr> <003801cebaf3$888993e0$999cbba0$@muller@ics-cnrs.unistra.fr> <524A231F.1050101@redhat.com> In-Reply-To: <524A231F.1050101@redhat.com> Subject: RE: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar Date: Tue, 01 Oct 2013 13:23:00 -0000 Message-ID: <000601cebea9$6c4bf1f0$44e3d5d0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-10/txt/msg00046.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Keith Seitz > Envoy=E9=A0: mardi 1 octobre 2013 03:19 > =C0=A0: Pierre Muller > Cc=A0: 'gdb-patches' > Objet=A0: Re: [RFC 5/6] Handle "set print sevenbit-strings on" in print_wchar >=20 > On 09/26/2013 01:03 PM, Pierre Muller wrote: >=20 > > 2013-09-26 Pierre Muller > > > > valprint.c (print_wchar): Honor sevenbit_strings value. > > >=20 > [Your ChangeLog entry got munged...] I would prefer that you ChangeLog > entry be a little more explicit about what changed, e.g., "Print escaped > characters if sevenbit-strings is set." >=20 > I think this patch is okay, but it definitely needs a test (and a > maintainer to approve). It took me a non-trivial amount of time to > actually get the patch to show any difference in the output. >=20 > The trick (on linux) was changing the charset to something where > (char)0x80 and up are printable characters. I used CP1252, and then I > could see what this patch actually did. Sorry, I should have mentioned that.. =20 > Perhaps this can be used in a test that will run on more than just MinGW > hosts. What about the following: Pierre ChangeLog entry: 2013-10-01 Pierre Muller * valprint.c (print_wchar): Print all char above seven-bit as octal or hexadecimal if SEVENBIT_STRINGS is non-zero. testsuite ChangeLog: 2013-10-01 Pierre Muller gdb.base/charset.exp: Add test to print char \242 in charset CP1252 with or without "set print sevenbit-strings on". --- gdb/testsuite/gdb.base/charset.exp | 13 +++++++++++++ gdb/valprint.c | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp index a5dbb28..01129e4 100644 --- a/gdb/testsuite/gdb.base/charset.exp +++ b/gdb/testsuite/gdb.base/charset.exp @@ -627,5 +627,18 @@ foreach name {short int long} { "assign string to $name array" } =20 +# Set the target charset to CP1252. +gdb_test_no_output "set charset CP1252" + +# \242 is a valid CP1252 character. +gdb_test "print \"\\242\"" " =3D \".\"" \ + "\\242 character in CP1252" + +gdb_test_no_output "set print sevenbit-strings on" + +# \242 is a valid CP1252 character, nut must now be printed in octal. +gdb_test "print \"\\242\"" " =3D \"\\\\242\"" \ + "\\242 character in CP1252, with seven-bit limitation" + =20 gdb_exit=20 diff --git a/gdb/valprint.c b/gdb/valprint.c index 0f6d65e..912352c 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1926,9 +1926,10 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int need_escape =3D *need_escapep; =20 *need_escapep =3D 0; - if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w) - && w !=3D LCST ('8') - && w !=3D LCST ('9')))) + if (gdb_iswprint (w) + && (!sevenbit_strings || (w > 0 && w < 0x7f)) + && (!need_escape || (!gdb_iswdigit (w) + && w !=3D LCST ('8') && w !=3D LCST ('9')))) { gdb_wchar_t wchar =3D w; =20 --=20 1.7.9