From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15615 invoked by alias); 17 Sep 2013 13:07:41 -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 15476 invoked by uid 89); 17 Sep 2013 13:07:40 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Sep 2013 13:07:40 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE,SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VLuzl-0004cQ-Pf from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 17 Sep 2013 06:07:09 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 17 Sep 2013 06:07:09 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Tue, 17 Sep 2013 06:07:07 -0700 From: Yao Qi To: Subject: [PATCH 2/4] Transform "\r\n" in pattern to "\r+\n" Date: Tue, 17 Sep 2013 13:07:00 -0000 Message-ID: <1379423179-8515-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1379423179-8515-1-git-send-email-yao@codesourcery.com> References: <87a9ldyu8k.fsf@fleche.redhat.com> <1379423179-8515-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00500.txt.bz2 This patch transforms the "\r\n" in pattern to "\r+\n". Note that "\r\n" in variable can't be transformed by this patch. gdb/testsuite: 2013-09-17 Yao Qi * 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(-) 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"] } +# 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 +} + # # @@ -2914,6 +2934,8 @@ proc gdb_expect { args } { set expcode $args } + set expcode [gdb_transform_eol $expcode] + upvar timeout timeout 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$" } + 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