From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29678 invoked by alias); 17 Sep 2018 12:28:20 -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 29658 invoked by uid 89); 17 Sep 2018 12:28:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=concerns, Hx-languages-length:1388 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Sep 2018 12:28:18 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w8HCSCvB029782 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Sep 2018 08:28:17 -0400 Received: by simark.ca (Postfix, from userid 112) id 543D81E76F; Mon, 17 Sep 2018 08:28:12 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id BE0811E175; Mon, 17 Sep 2018 08:28:09 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Sep 2018 12:28:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org, Joel Brobecker Subject: Re: [PATCH] python: Make gdb.execute("show commands") work (PR 23669) In-Reply-To: <87zhwgmxy1.fsf@tromey.com> References: <20180917012350.10194-1-simon.marchi@polymtl.ca> <87zhwgmxy1.fsf@tromey.com> Message-ID: <3ccd2f0300762e59e5b160cf6a2f24dd@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00565.txt.bz2 On 2018-09-17 02:37, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Since commit > Simon> 56bcdbea2bed ("Let gdb.execute handle multi-line commands") > > Simon> trying to use a command like gdb.execute("show commands") in > Python > Simon> fails. GDB ends up trying to run the "commands" command. > > Simon> The reason is that GDB gets confused with the special "commands" > Simon> command. In process_next_line, the lookup_cmd_1 function > returns the > Simon> cmd_list_element representing the "commands" sub-command of > "show". > Simon> Lower, we check the cmd_list_element to see if it matches > various > Simon> control commands by name, including the "commands" command. > This is > Simon> where we wrongfully conclude that the executed command must be > Simon> "commands", when in reality it was "show commands". > > Simon> The fix proposed in this patch removes the comparisons by name, > instead > Simon> comparing the cmd_list_element object by pointer with the > objects > Simon> created at initialization time. > > Thanks for doing this. I think getting rid of command_name_equals is a > nice cleanup. The patch looks good to me. > > Tom Thanks I pushed it. I forgot to mention, but I intend to push this to the 8.2 branch. Any concerns about this? Simon