From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100492 invoked by alias); 3 Mar 2016 10:25:40 -0000 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 Received: (qmail 100434 invoked by uid 89); 3 Mar 2016 10:25:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=chapter, Phil, H*M:eurprd04, Undefined X-HELO: emea01-db3-obe.outbound.protection.outlook.com Received: from mail-db3on0056.outbound.protection.outlook.com (HELO emea01-db3-obe.outbound.protection.outlook.com) (157.55.234.56) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Thu, 03 Mar 2016 10:25:37 +0000 Received: from VI1PR0401MB1776.eurprd04.prod.outlook.com (10.165.234.150) by VI1PR0401MB1774.eurprd04.prod.outlook.com (10.165.234.148) with Microsoft SMTP Server (TLS) id 15.1.415.20; Thu, 3 Mar 2016 10:25:31 +0000 Received: from VI1PR0401MB1776.eurprd04.prod.outlook.com ([10.165.234.150]) by VI1PR0401MB1776.eurprd04.prod.outlook.com ([10.165.234.150]) with mapi id 15.01.0415.024; Thu, 3 Mar 2016 10:25:31 +0000 From: Catalin-Dan Udma To: Phil Muldoon , Catalin Udma , "gdb-patches@sourceware.org" Subject: RE: [PATCH] python: Use console format for output of gdb.execute command Date: Thu, 03 Mar 2016 10:25:00 -0000 Message-ID: References: <1456756452-15880-1-git-send-email-catalin.udma@freescale.com> <56D76731.7060202@redhat.com> In-Reply-To: <56D76731.7060202@redhat.com> authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=nxp.com; x-microsoft-exchange-diagnostics: 1;VI1PR0401MB1774;5:QBk+b0hdq+CMV2KL6+YlQpHBPY19rdzlcchLR78kKmzHxO15qzclBquoPcbH33ASVmx1xQL/xjPA5Ob+6AKTgiBqfegAgUNNo0cE7bksl45gsgZzNXUc/oo+UXRTWlLOvm62fihNtOQL9GoB0982Dg==;24:cEkhITA5X6EoVGRbROIZcBT3W1HcpPgw3QTUJTgBYVdkGY0tXpXM7nVfKaeo9VRIfP254GtZtQ+o4spoTUg/iVGO0cTg+z8Dj3OGqpj58jc= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0401MB1774; x-ms-office365-filtering-correlation-id: 1c7cd824-10af-44a8-3dec-08d3434e264a x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:VI1PR0401MB1774;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0401MB1774; x-forefront-prvs: 0870212862 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(6009001)(52034003)(13464003)(3846002)(87936001)(33656002)(1096002)(6116002)(66066001)(102836003)(76576001)(5002640100001)(586003)(74316001)(3660700001)(5003600100002)(5008740100001)(2906002)(106116001)(10400500002)(5001960100004)(3280700002)(2501003)(5004730100002)(11100500001)(107886002)(54356999)(50986999)(5001770100001)(86362001)(92566002)(2950100001)(2900100001)(19580395003)(76176999)(77096005)(19580405001)(189998001)(122556002)(1220700001)(40100003)(7059030)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB1774;H:VI1PR0401MB1776.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2016 10:25:31.5937 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB1774 X-SW-Source: 2016-03/txt/msg00044.txt.bz2 Thank you, Phil, for review. I added more info inline. Regards, Catalin > -----Original Message----- > From: Phil Muldoon [mailto:pmuldoon@redhat.com] >=20 > While I have no problems with the patch, is the expectation that if > the interpreter is in MI mode and a command has previously output that > structured output, isn't the inverse the bug? Shouldn't gdb.execute > honor the interpreter instead of forcing one?=20 [Catalin Udma]From GDB manual (7.11.50.20160229, chapter 23.2.2.1 Basic Pyt= hon): "gdb.execute (command [, from tty [, to string]]) [Function] Evaluate command, a string, as a gdb CLI command" Therefore a CLI command is expected and the output should be printed in CL= I format Only the MI commands should be printed on MI format. Here some examples (gdb without this patch): "info break" (CLI command) is always shown in CLI format, even interpreter = is MI: 1.=20 info break &"info break\n" ~"Num Type Disp Enb Address What\n" ~"1 breakpoint keep y 0x000000000000abcd \n" 2 python gdb.execute("info break") &"python gdb.execute(\"info break\")\n" ~"Num Type Disp Enb Address What\n" ~"1 breakpoint keep y 0x000000000000abcd \n" Based on the gdb manual definition, gdb.execute cannot directly execute a M= I command, e.g: python gdb.execute("-break-list") &"python gdb.execute(\"-break-list\")\n" &"Traceback (most recent call last):\n" &" File \"\", line 1, in \n" &"gdb.error: Undefined command: \"-break-list\". Try \"help\".\n" &"Error while executing Python code.\n" ^error,msg=3D"Error while executing Python code." This can be done only using gdb.execute("interpreter-exec mi '-break-list'= "). We can have a MI output for MI command, however this (e.g interpreter-exec)= it is a CLI command. This patch does not break the above command: using interpreter-exec + MI co= mmand, the output is MI format. >I'm not too sure on > this, not being an MI expert, or whether some commands in GDB > arbitrarily output one or the other. I'll dig around when I find some > time and see if I can find anything definitive. >=20 > The other thought of course is, if this is right, it arguably > introduces an API regression. So we might have to work with some > compatibility mode for existing scripts. [Catalin Udma] I expect to have no regression with the existing scripts. Bu= t I'm happy to=20 take into consideration any use case I have missed and update the patch acc= ordingly.=20 By the way, I ran the gdb dejagnu testsuite and found no regression with th= is patch. >=20 > A tricky bug! >=20 > Cheers >=20 > Phil