Message ID | 20190218110353.5160-1-alan.hayward@arm.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 60342 invoked by alias); 18 Feb 2019 11:04:07 -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 60311 invoked by uid 89); 18 Feb 2019 11:04:06 -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.2 spammy=H*RU:15.20.1622.18, H*r:15.20.1622.18, Hx-spam-relays-external:15.20.1622.18 X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00087.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Feb 2019 11:04:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JC83oxNNx9+0P1Af6xMlLHJPL8ZBhQ9HMBEIGynMKh8=; b=M4Sw2EWji7/+P+00beusXu29GF3HbF5ok/xae2bYVk2xB8eX4AO56yEjvXwOcSDypiAKf9GQN4tsXjmI1QdekjL/Rc4NIf4rBxRWcnD8fQTlpqwURBzB2cGn9LDwFGqCxd+h9OCsdeAl2p2FyL3DsBIRa5YlUGQnxYA67ZXKU7A= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2504.eurprd08.prod.outlook.com (10.172.251.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.18; Mon, 18 Feb 2019 11:04:01 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::e974:35a7:c83c:e5b7]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::e974:35a7:c83c:e5b7%3]) with mapi id 15.20.1622.018; Mon, 18 Feb 2019 11:04:01 +0000 From: Alan Hayward <Alan.Hayward@arm.com> To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org> CC: nd <nd@arm.com>, Alan Hayward <Alan.Hayward@arm.com> Subject: [RFC/PATCH] Disable styling when running in batch mode Date: Mon, 18 Feb 2019 11:04:01 +0000 Message-ID: <20190218110353.5160-1-alan.hayward@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-IsSubscribed: yes |
Commit Message
Alan Hayward
Feb. 18, 2019, 11:04 a.m. UTC
The GCC Guality testsuite within GCC compiles C/C++ files in GCC at various optimization levels then debugs them in GDB, checking that program values can be read. This is done within the dejagnu framework. The new style options in GDB have broken many of the tests due to the testsuite being unable to process the new control characters. The fix in Guality is to either to improve the string matching or to disable styling on the cli or init file (after checking gdb is recent enough to support styling). This fix will also need making an any other testsuites in the wild that use GDB. An alternative would be to automatically disable styling when using GDB in batch mode. The reasoning here is that batch mode is only used when automating GDB and any output will be processed later either with text processing tools or viewed in text editors, many of these will not correctly handle the control characters by default. This ensures GDB continues to work as expected. Anyone who explicitly wants styling in batch mode can enable it either in the init file or adding to the batch file - but that would not be the standard use case. Patch simply disables style after reading the batch command flag, before reading in the init file or batch file. gdb/ChangeLog: 2019-02-18 Alan Hayward <alan.hayward@arm.com> * main.c (captured_main_1): Disable styling in batch mode. --- gdb/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Comments
> From: Alan Hayward <Alan.Hayward@arm.com> > CC: nd <nd@arm.com>, Alan Hayward <Alan.Hayward@arm.com> > Date: Mon, 18 Feb 2019 11:04:01 +0000 > > Patch simply disables style after reading the batch command flag, before > reading in the init file or batch file. > > gdb/ChangeLog: > > 2019-02-18 Alan Hayward <alan.hayward@arm.com> > > * main.c (captured_main_1): Disable styling in batch mode. If this is accepted, it should be documented in the GDB manual and in NEWS. Thanks.
>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
Alan> Patch simply disables style after reading the batch command flag, before
Alan> reading in the init file or batch file.
I had left this enabled intentionally, but after thinking about it, I
think your rationale makes sense; and in any case the rare user who
wants batch mode with styling can use -iex or the like to re-enable it.
So, I think the patch is ok.
thanks,
Tom
> On 19 Feb 2019, at 17:36, Tom Tromey <tom@tromey.com> wrote: > >>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes: > > Alan> Patch simply disables style after reading the batch command flag, before > Alan> reading in the init file or batch file. > > I had left this enabled intentionally, but after thinking about it, I > think your rationale makes sense; and in any case the rare user who > wants batch mode with styling can use -iex or the like to re-enable it. > > So, I think the patch is ok. > Thanks. In addition to the patch, I’ve been wondering if we want a command line argument to explicitly enable or disable style. I think the answer is no, because it’s better for the user to add to the init file or batch script. (But thought that it is worth mentioning). > On 18 Feb 2019, at 16:00, Eli Zaretskii <eliz@gnu.org> wrote: > >> From: Alan Hayward <Alan.Hayward@arm.com> >> CC: nd <nd@arm.com>, Alan Hayward <Alan.Hayward@arm.com> >> Date: Mon, 18 Feb 2019 11:04:01 +0000 >> >> Patch simply disables style after reading the batch command flag, before >> reading in the init file or batch file. >> >> gdb/ChangeLog: >> >> 2019-02-18 Alan Hayward <alan.hayward@arm.com> >> >> * main.c (captured_main_1): Disable styling in batch mode. > > If this is accepted, it should be documented in the GDB manual and in > NEWS. > > Thanks. Agreed. I’ll post a patch for this later this week. Alan.
>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
Alan> In addition to the patch, I’ve been wondering if we want a command line
Alan> argument to explicitly enable or disable style. I think the answer is no,
I agree, let's not -- it's easy enough to do with -ex/-iex/etc, and
styling doesn't seem so very important that it deserves a new command
line option.
Tom
diff --git a/gdb/main.c b/gdb/main.c index a7283902fe..e14dd06fa8 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -47,6 +47,7 @@ #include "common/signals-state-save-restore.h" #include <vector> #include "common/pathstuff.h" +#include "cli/cli-style.h" /* The selected interpreter. This will be used as a set command variable, so it should always be malloc'ed - since @@ -850,7 +851,12 @@ captured_main_1 (struct captured_main_args *context) } if (batch_flag) - quiet = 1; + { + quiet = 1; + + /* Disable all output styling when running in batch mode. */ + cli_styling = 0; + } } save_original_signals_state (quiet);