From patchwork Thu May 3 19:41:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 27096 Received: (qmail 65501 invoked by alias); 3 May 2018 19:41:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 65490 invoked by uid 89); 3 May 2018 19:41:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:g21-v6s, Hx-spam-relays-external:209.85.128.196, H*RU:209.85.128.196 X-HELO: mail-wr0-f196.google.com Received: from mail-wr0-f196.google.com (HELO mail-wr0-f196.google.com) (209.85.128.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 May 2018 19:41:19 +0000 Received: by mail-wr0-f196.google.com with SMTP id g21-v6so18772649wrb.8 for ; Thu, 03 May 2018 12:41:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=76rSCWw3a2Oe3TIMpKaRh/uF9jQ49wraXddsLp/uQ1w=; b=GeY1Ji01Ery3EfWOfsmW0MDbDcJ1nSknc5DxOPgyJrYf0DiRHs25SX8pG2SGn8aGoy qm3N38Ca3pN5WTbvu4ZI+qV53hybAdAglwoBZYAiuK0xCPa4UJkWvdP6246Hnp+Dvyxv 5TG/cVm93DDgw46Kv4FbjcPJmN/5lKCKf8c9Yb65ZmBRvxIBkvl6a20WKT+FZuGDC46p P5oHy81L6Dp6575xMb9H/BNqLEyIbL+jTHrUH3AYMeRWkKHcuS2BgfIAL28CBFFmGJYL pcN8TwfUDAKhybAkrvAkM9HXnh3E4/R7TSgaoDgI3w2Mc5w3NgYwYqpeuKkcIk+zCgAH ZywQ== X-Gm-Message-State: ALQs6tCP/rK+HEh239VTvMLGLZNhtK0/YaFbvvV+zL2S/lx/aPhM0y5D hHqe4gQhuocbAHZCCGH/d/D94A== X-Google-Smtp-Source: AB8JxZqHzxjrKE+dkq98AqNR2VwgBnBpbRB5gnUTGbbUCsXiniPlD7WVHGbDDgxn22MnVkn3ZqNNiQ== X-Received: by 2002:adf:be90:: with SMTP id i16-v6mr20227691wrh.63.1525376477225; Thu, 03 May 2018 12:41:17 -0700 (PDT) Received: from localhost (host81-147-175-127.range81-147.btcentralplus.com. [81.147.175.127]) by smtp.gmail.com with ESMTPSA id u35-v6sm15514229wrc.29.2018.05.03.12.41.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 12:41:16 -0700 (PDT) Date: Thu, 3 May 2018 20:41:15 +0100 From: Andrew Burgess To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] gdb/testsuite: Fix broken regexp in gdbstub case Message-ID: <20180503194115.GJ3375@embecosm.com> References: <1ec70ce9afe8bebbb3f0257778943d4634ea126b.1523286728.git.andrew.burgess@embecosm.com> <092e44fd-096b-e96b-542b-a8eb4c5c5f1d@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <092e44fd-096b-e96b-542b-a8eb4c5c5f1d@redhat.com> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes * Pedro Alves [2018-04-13 13:12:30 +0100]: > On 04/09/2018 04:15 PM, Andrew Burgess wrote: > > When $use_gdb_stub is true then, when we start an MI target there's a > > regexp to match GDB's startup pattern. Unfortunately the pattern is > > broken, and we're also missing a timeout case in the match list (which > > would have helped point out that the regexp was broken). > > That seems to have been added by: > https://sourceware.org/ml/gdb-patches/2015-12/msg00357.html > > curious how it seems to have worked back then. I wonder whether > it was GDB's CLI-in-MI output that changed meanwhile? > > I'd have appreciated a bit more detail on what is actually broken in > the pattern. The git log above gives no clue, and the diff is not > exactly easy to read. I trust that it's now correct though. Thus, OK. I aim to please, so here's a revised commit message detailing what changed. The actual patch content hasn't changed. I'll wait a few days, but if I don't hear anything I'll assume your approval above still stands and apply the patch. Thanks, Andrew --- gdb/testsuite: Fix broken regexp in gdbstub case When $use_gdb_stub is true then, when we start an MI target there's a regexp to match GDB's startup pattern. Unfortunately the pattern is broken, and we're also missing a timeout case in the match list (which would have helped point out that the regexp was broken). The changes to the regexp are: 1. Remove '${run_match}' prefix, the issued command doesn't include '${run_prefix}' so expecting '${run_match}' is wrong. 2. Replaced '\\n' with '\\\\n' in order to match literal '\n' in GDBs output (that is, match a backslash followed by 'n', not a newline character). 3. Replaced a '.' (matching any character) with '\.' to match a '.' and moved the '\.' into the correct place in the regexp. 4. Replaced '\r\n' with '[\r\n]+' to match the end of a line. This change isn't esential, but matches the other end of line patterns within this regexp. Here's an example of the output that the regexp should match taken from a testfile log, the first line is the command sent to GDB, and the remaining lines are the response from GDB: jump *_start &"jump *_start\n" ~"Continuing at 0x10074.\n" ^running *running,thread-id="all" (gdb) gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_run_cmd_full): Fix regexp and add a timeout. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/lib/mi-support.exp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 2846da74e47..851e490f4de 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -979,7 +979,11 @@ proc mi_run_cmd_full {use_mi_command args} { send_gdb "jump *$start\n" warning "Using CLI jump command, expect run-to-main FAIL" gdb_expect { - -re "${run_match}&\"jump \\*${start}\\n\"\[\r\n\]+~\"Continuing at 0x\[0-9A-Fa-f\]+\\n.\"\[\r\n\]+\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n${mi_gdb_prompt}" {} + -re "&\"jump \\*${start}\\\\n\"\[\r\n\]+~\"Continuing at 0x\[0-9A-Fa-f\]+\.\\\\n\"\[\r\n\]+\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\[\r\n\]+${mi_gdb_prompt}" {} + timeout { + perror "Unable to start target" + return -1 + } } return 0 }