From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27597 invoked by alias); 5 Mar 2013 02:24:40 -0000 Received: (qmail 27588 invoked by uid 22791); 5 Mar 2013 02:24:37 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Mar 2013 02:24:31 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UChYM-0000au-EU from Yao_Qi@mentor.com ; Mon, 04 Mar 2013 18:24:30 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Mar 2013 18:24:30 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Mon, 4 Mar 2013 18:24:29 -0800 Message-ID: <51355731.3090609@codesourcery.com> Date: Tue, 05 Mar 2013 02:24:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Joel Brobecker CC: Subject: Re: [PATCH] Fix a bug in tstatus.exp matching tstatus output References: <1362411345-22308-1-git-send-email-yao@codesourcery.com> <20130304162248.GB4472@adacore.com> In-Reply-To: <20130304162248.GB4472@adacore.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 X-SW-Source: 2013-03/txt/msg00132.txt.bz2 On 03/05/2013 12:22 AM, Joel Brobecker wrote: >> In gdb testsuite, both "\\\(" and "\\(" are used. After reading >> section "4.3. Backslashes" in book "Exploring Expect", I think they >> are the same on effect. > > I don't understand why the third backslash would be needed, though. > The first two is the backslash escaping the '(' character in the > regular expression. The third one escapes the '(' as the TCL string > level, but I don't think it is a special character (like '[' is, > for instance), is it? > Right, of course we can use two backslashes here. Backslash translation is done by Tcl and pattern matcher. In Tcl, "Sequences that have no special translation are replaced by the character without the backslash" [1], and in pattern matcher, use "backslashes to force the following character into its literal equivalent." [2] For "\\(", Tcl will translate it to "\(" and pattern matcher will treat it as literal "(". For "\\\(", Tcl will tranlate it "\(" as well, because it translates "\\" to "\" and "\(" to "(". Here is the updated patch using two backslashes. -- Yao (齐尧) gdb/testsuite: 2013-03-05 Yao Qi * gdb.trace/tstatus.exp (run_trace_experiment): Escape parentheses by "\\". --- gdb/testsuite/gdb.trace/tstatus.exp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gdb/testsuite/gdb.trace/tstatus.exp b/gdb/testsuite/gdb.trace/tstatus.exp index 483bb20..3271ace 100644 --- a/gdb/testsuite/gdb.trace/tstatus.exp +++ b/gdb/testsuite/gdb.trace/tstatus.exp @@ -99,7 +99,7 @@ proc run_trace_experiment {} { gdb_test_no_output "tstop because I can" "trace stopped with note" gdb_test_multiple "tstatus" "check on trace status after stop" { - -re "Trace stopped by a tstop command (because I can)\..*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" { + -re "Trace stopped by a tstop command \\(because I can\\)\..*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" { pass "tstatus reports trace stop reason" } -re "Trace stopped by a tstop command\..*\r\n$gdb_prompt $" { -- 1.7.7.6