Message ID | 32795df0-3a46-2b7d-3db8-2902e0f55481@arm.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 47526 invoked by alias); 3 Jul 2019 13:35:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 47518 invoked by uid 89); 3 Jul 2019 13:35:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1246, stephen X-HELO: EUR04-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr70080.outbound.protection.outlook.com (HELO EUR04-HE1-obe.outbound.protection.outlook.com) (40.107.7.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Jul 2019 13:35:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4ptKtTLb83kKxjddTuHFAyn3GIyOzlB8xBAtH9Ajb/o=; b=kt9bQI60IAyQVaZrRca8M+w8iFL6+MfFyviGz542DnPYLrPZfG/xaoDX4bYFCpcguark7zN73PSdaLtKspcBupT091K2OOY6llZ88cKapSQ7Jg3bRvlnCsVKkx9PZbgfu2t6xNDR8cU6O3OMH4FoSGyvC0PeHZVHQ0HmqS3nKj0= Received: from VI1PR08MB3200.eurprd08.prod.outlook.com (52.133.15.152) by VI1PR08MB2861.eurprd08.prod.outlook.com (10.170.236.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Wed, 3 Jul 2019 13:35:33 +0000 Received: from VI1PR08MB3200.eurprd08.prod.outlook.com ([fe80::a420:c6e1:2e3a:9433]) by VI1PR08MB3200.eurprd08.prod.outlook.com ([fe80::a420:c6e1:2e3a:9433%7]) with mapi id 15.20.2032.019; Wed, 3 Jul 2019 13:35:33 +0000 From: Richard Bunt <Richard.Bunt@arm.com> To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org> CC: nd <nd@arm.com> Subject: [PATCH] Restore original GDB prompt in define.exp Date: Wed, 3 Jul 2019 13:35:32 +0000 Message-ID: <32795df0-3a46-2b7d-3db8-2902e0f55481@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Richard.Bunt@arm.com; x-ms-oob-tlc-oobclassifiers: OLM:2582; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="utf-8" Content-ID: <78CB46BB95A26449830EA07F265E73D7@eurprd08.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Richard.Bunt@arm.com X-IsSubscribed: yes |
Commit Message
Richard Bunt
July 3, 2019, 1:35 p.m. UTC
define.exp will fail on a GDB which has set a custom prompt to identify itself. This is because the test resets the prompt to a hard coded "(gdb)" but then verifies the success of this against the value in $gdb_prompt, which is set to the custom prompt. define.exp has been modified to reset the prompt to $gdb_prompt rather than a hard coded "(gdb)". Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64. gdb/testsuite/ChangeLog: 2019-06-08 Richard Bunt <richard.bunt@arm.com> Stephen Roberts <stephen.roberts@arm.com> * gdb.base/define.exp: Restore original prompt. Change-Id: Ie1b883be7cd77f2208ef9db6eadde1fd0d6a4e53 --- gdb/testsuite/gdb.base/define.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4
Comments
>>>>> "Richard" == Richard Bunt <Richard.Bunt@arm.com> writes:
Richard> 2019-06-08 Richard Bunt <richard.bunt@arm.com>
Richard> Stephen Roberts <stephen.roberts@arm.com>
Richard> * gdb.base/define.exp: Restore original prompt.
Thank you for the patch.
This is ok.
Richard> -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" {
Richard> +gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" {
This is peculiar because both the original code and the new code have
backslashes in the "set" command -- gdb_prompt is actually a regexp, not
just a plain string. But, it works anyhow, I guess something along the
way is ignoring the "\". So, although it is weird, your patch doesn't
make it any worse.
Tom
On Jul 03 2019, Tom Tromey <tom@tromey.com> wrote: >>>>>> "Richard" == Richard Bunt <Richard.Bunt@arm.com> writes: > > Richard> -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" { > Richard> +gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" { > > This is peculiar because both the original code and the new code have > backslashes in the "set" command -- gdb_prompt is actually a regexp, not > just a plain string. But, it works anyhow, I guess something along the > way is ignoring the "\". That's because it's a var_string, not a var_string_noescape. Andreas.
On 7/3/19 3:48 PM, Andreas Schwab wrote: > On Jul 03 2019, Tom Tromey <tom@tromey.com> wrote: > >>>>>>> "Richard" == Richard Bunt <Richard.Bunt@arm.com> writes: >> >> Richard> -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" { >> Richard> +gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" { >> >> This is peculiar because both the original code and the new code have >> backslashes in the "set" command -- gdb_prompt is actually a regexp, not >> just a plain string. But, it works anyhow, I guess something along the >> way is ignoring the "\". > > That's because it's a var_string, not a var_string_noescape. > > Andreas. > Thanks for the comments. Based on these I would like to submit a v2 (when it's ready) which saves the literal prompt from "show prompt" and restores from this. I think this is a more robust solution as it will not break if someone is indeed using $gdb_prompt with a more complex regular expression and doesn't unnecessarily rely on the escape behavior of the GDB prompt. Note: The test case which sets the prompt to \\(blah\\) still covers this escaping behavior, but I see no need for the prompt restore test to rely on it. Many thanks, Rich
diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index 0590da9..7bd4b7e 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -292,7 +292,7 @@ gdb_test_multiple "set prompt \\(blah\\) " "set gdb_prompt" { } } -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" { +gdb_test_multiple "set prompt $gdb_prompt " "reset gdb_prompt" { -re "$gdb_prompt $" { pass "reset gdb_prompt" }