From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28182 invoked by alias); 17 Sep 2013 23:11:35 -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 28168 invoked by uid 89); 17 Sep 2013 23:11:34 -0000 Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.213) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Sep 2013 23:11:34 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_40,KAM_ADVERT2,KHOP_THREADED,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 8219DC0AAF; Wed, 18 Sep 2013 01:11:30 +0200 (CEST) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id 715ABC0AB9; Wed, 18 Sep 2013 01:11:30 +0200 (CEST) Received: from md15.u-strasbg.fr (md15.u-strasbg.fr [130.79.200.204]) by mr3.u-strasbg.fr (Postfix) with ESMTP id 48912C0AAF; Wed, 18 Sep 2013 01:11:28 +0200 (CEST) Received: from ms18.u-strasbg.fr (ms18.u-strasbg.fr [130.79.204.118]) by md15.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r8HNAjca018295 ; Wed, 18 Sep 2013 01:10:46 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (Authenticated sender: mullerp) by ms18.u-strasbg.fr (Postfix) with ESMTPSA id 523651FD77; Wed, 18 Sep 2013 01:10:44 +0200 (CEST) From: "Pierre Muller" To: "'Yao Qi'" , References: <87a9ldyu8k.fsf@fleche.redhat.com> <1379423179-8515-1-git-send-email-yao@codesourcery.com> <1379423179-8515-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1379423179-8515-3-git-send-email-yao@codesourcery.com> Subject: RE: [PATCH 2/4] Transform "\r\n" in pattern to "\r+\n" Date: Tue, 17 Sep 2013 23:11:00 -0000 Message-ID: <006001ceb3fb$226d8890$674899b0$@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-09/txt/msg00558.txt.bz2 Hi Yao, I tried this some time ago, see: https://sourceware.org/ml/gdb-patches/2010-06/msg00039.html but I ended up with something much more complicated ... The primary reason is that your code below will also change [\r\n] into [\r+\n] which is not really what it should do... It could also interfere with messages (not patterns) in expcode that contain \r\n sequences... Finally, I think that there is also a completely orthogonal solution to the problem you mention, which is to force GDB to use binary mode for stdout and stderr instead of text mode. Your patch to fix the ordering of stderr versus stdout output seem to work, so the only remaining specific mingw host is that GDB uses text mode for its stdout and stderr. This is an adaptation/simplification of a previous idea I proposed, to add: maint set testsuite-mode on/off command, which was both setting stdout and stderr to binary mode and=20 disabled any buffering for this handles. https://sourceware.org/ml/gdb-patches/2013-07/msg00701.html I will try to submit this patch shortly. Pierre Muller > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Yao Qi > Envoy=E9=A0: mardi 17 septembre 2013 15:06 > =C0=A0: gdb-patches@sourceware.org > Objet=A0: [PATCH 2/4] Transform "\r\n" in pattern to "\r+\n" >=20 > This patch transforms the "\r\n" in pattern to "\r+\n". Note that > "\r\n" in variable can't be transformed by this patch. >=20 > gdb/testsuite: >=20 > 2013-09-17 Yao Qi >=20 > * lib/gdb.exp (gdb_transform_eol): New proc. > (gdb_expect): Invoke gdb_transform_eol. > * lib/mi-support.exp (mi_gdb_test): Likewise. > --- > gdb/testsuite/lib/gdb.exp | 22 ++++++++++++++++++++++ > gdb/testsuite/lib/mi-support.exp | 2 ++ > 2 files changed, 24 insertions(+), 0 deletions(-) >=20 > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 9b319e2..30d8755 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -2903,6 +2903,26 @@ proc send_gdb { string } { > return [remote_send host "$string"] > } >=20 > +# Transform the end-of-line in PATTERN. In test cases, we assume > +# that end-of-line is "\r\n", but that is not true on some targets. > +# this proc transforms "\r\n" to the desired form. > + > +proc gdb_transform_eol { pattern } { > + > + if [ishost "i?86-*-mingw*"] { > + # On Windows, when a file is opened in text mode, a "\n" is > + # always expanded to "\r\n", so gdb on Windows is outputting > + # "\r\n", and when that goes through the PTY, the '\n' is > + # being expanded to "\r\n", hence "\r\r\n". > + # Expand "\r\n" in $expcode to "\r+\n" in order to match > + # "\r\r\n". > + regsub -all {\\r\\n} $pattern {\\r+\\n} pattern > + regsub -all {\r\n} $pattern {\r+\n} pattern > + } > + > + return $pattern > +} > + > # > # >=20 > @@ -2914,6 +2934,8 @@ proc gdb_expect { args } { > set expcode $args > } >=20 > + set expcode [gdb_transform_eol $expcode] > + > upvar timeout timeout >=20 > if [target_info exists gdb,timeout] { > diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi- > support.exp > index 86a0fd6..a9b22c2 100644 > --- a/gdb/testsuite/lib/mi-support.exp > +++ b/gdb/testsuite/lib/mi-support.exp > @@ -597,6 +597,8 @@ proc mi_gdb_test { args } { > set question_string "^FOOBAR$" > } >=20 > + set pattern [gdb_transform_eol $pattern] > + > if $verbose>2 then { > send_user "Sending \"$command\" to gdb\n" > send_user "Looking to match \"$pattern\"\n" > -- > 1.7.7.6