From patchwork Mon Feb 18 11:04:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 31494 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: 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 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 To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward 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 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-IsSubscribed: yes 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 * main.c (captured_main_1): Disable styling in batch mode. --- gdb/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 #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);