From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114964 invoked by alias); 22 Aug 2018 09:07:11 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 114954 invoked by uid 89); 22 Aug 2018 09:07:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=out, CORE X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Aug 2018 09:07:09 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0EB8587916; Wed, 22 Aug 2018 09:07:08 +0000 (UTC) Received: from blade.nx (ovpn-116-229.ams2.redhat.com [10.36.116.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94C0B2026D74; Wed, 22 Aug 2018 09:07:07 +0000 (UTC) Received: by blade.nx (Postfix, from userid 1000) id EA2F380A67E3; Wed, 22 Aug 2018 10:07:06 +0100 (BST) Date: Wed, 22 Aug 2018 09:07:00 -0000 From: Gary Benson To: Pedro Alves Cc: Ruslan Kabatsayev , psmith@gnu.org, gdb@sourceware.org Subject: Re: gdb -batch always exits with status 0 Message-ID: <20180822090706.GA26554@blade.nx> References: <20180705144659.GA29169@blade.nx> <2c7ad73e90cc7417bd23b4529261d8c737668571.camel@gnu.org> <20180817110354.GB32726@blade.nx> <20180817152345.GA2920@blade.nx> <20180817160325.GA12274@blade.nx> <3408f7e7-91c9-1230-dbf1-51a3bdd0c6f6@redhat.com> MIME-Version: 1.0 In-Reply-To: <3408f7e7-91c9-1230-dbf1-51a3bdd0c6f6@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00046.txt.bz2 On 17 August 2018 at 19:29, Pedro Alves wrote: > To me, it feels like you're not discussing the real issue. > > GDB _does_ stop processing scripts on first error. > > $ cat file1 > fail1 > fail2 > fail3 > $ cat file2 > fail4 > fail5 > fail6 > $ gdb -q -x file1 -x file2 > file1:1: Error in sourced command file: > Undefined command: "fail1". Try "help". > file2:1: Error in sourced command file: > Undefined command: "fail4". Try "help". > (gdb) > > Note, fail2, fail3, fail5 and fail6 were not run. > > What GDB does not do is consider an error from inside a script > sourced from the shell command line as reason to fail out. So for > example above, I think Gary is arguing that GDB should have behaved > like this: > > $ gdb -q -x file1 -x file2 > file1:1: Error in sourced command file: > Undefined command: "fail1". Try "help". > (gdb) > > I.e., "file2" was not sourced. > > In this aspect, "-ex" behaves exactly like "-x" -- you can think > of -ex as gdb internally pasting the -ex command in a script > and then sourcing it with -x. I don't know if I'm overthinking things, but basically I looked at the different places a command error can occur: /etc/gdbinit ~/.gdbinit -ix -iex -cd -d PROG -p CORE .gdbinit in cwd -x -ex For some of these it does seem to make sense to exit, e.g. if processing "-p PID" fails to end up attached to a process. But nobody is asking for change, nobody's having a problem with this, so I'm going to leave this here. Cheers, Gary