From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id DCB8B3854812 for ; Tue, 18 May 2021 14:10:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DCB8B3854812 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 14IEAjEG012973 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 May 2021 10:10:49 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 14IEAjEG012973 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id BF3181E783; Tue, 18 May 2021 10:10:44 -0400 (EDT) Subject: Re: [RFC][gdb/cli] Ignore error in gdb command script To: Tom de Vries , Marco Barisione Cc: Tom Tromey , GDB patches mailing list References: <20210518095958.GA22771@delia> <44B64C9E-9E19-47BD-80CD-0C660C7A9D94@undo.io> From: Simon Marchi Message-ID: <453ffcaa-2a21-62a7-d449-28c7c187231a@polymtl.ca> Date: Tue, 18 May 2021 10:10:44 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 18 May 2021 14:10:45 +0000 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 14:10:52 -0000 On 2021-05-18 9:57 a.m., Tom de Vries wrote:> On 5/18/21 1:12 PM, Marco Barisione wrote: >> On 18 May 2021, at 10:59, Tom de Vries wrote: >>> Hi, >>> >>> While trying to reproduce a failing test-case from the testsuite on the >>> command line using a gdb command script, I ran into the problem that a command >>> failed which stopped script execution. >>> >>> I could work around this by splitting the script at each error, but I realized >>> it would be nice if I could tell gdb to ignore the error. >>> >>> Inspired by make, I chose the '-' prefix. >> >> As MI commands are prefixed by “-“, isn’t there a risk of confusion? >> > > Ah, right, I tend to forget about MI, good point. > >> There’s also a “-” command (see tui/tui-win.c) which will stop working with >> your patch. > > I see, that's: > ... > $ gdb -q -batch -ex "help -" > Scroll window backward. > Usage: - [N] [WIN] > Scroll window WIN N lines backwards. Both WIN and N are optional, N > defaults to 1, and WIN defaults to the currently focused window. > ... > > FWIW, did not find any documentation for this command. > > Anyway, the '-' prefix seems a poor choice. > > I've updated the patch to implement the ignore-errors idiom natively (so > it also works without python). > > Also, I've managed to fix the hang, by copying some code from > execute_gdb_command. That sounds useful. I think that "ignore-errors" is a good initial name, because it's clear and self-describing. We can always find and add a short alias later. I didn't look much at the patch itself, but read the commit message. I would vote for implementing it as a command, to avoid adding more complexity / exceptions / special cases in the command handling code. Simon