From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31648 invoked by alias); 25 Sep 2006 19:37:56 -0000 Received: (qmail 31640 invoked by uid 22791); 25 Sep 2006 19:37:56 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 25 Sep 2006 19:37:55 +0000 Received: (qmail 10934 invoked from network); 25 Sep 2006 19:37:53 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 25 Sep 2006 19:37:53 -0000 To: gdb-patches@sourceware.org Subject: Re: [RFC] Never silently discard internal errors References: <20060925184223.GA15314@nevyn.them.org> From: Jim Blandy Date: Mon, 25 Sep 2006 19:37:00 -0000 In-Reply-To: <20060925184223.GA15314@nevyn.them.org> (Daniel Jacobowitz's message of "Mon, 25 Sep 2006 14:42:23 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00175.txt.bz2 Daniel Jacobowitz writes: > Here's a problem that one of our customers turned up. He runs GDB > from inside Emacs, which means that its standard input is considered > to be a pipe, which is not a terminal. Accordingly query is suppressed. > Whether this is right everywhere or not is a question for another day, > but one particular thing we discovered was that GDB would mysteriously > quit out from under him, without telling him what it was doing. > > Eventually we tracked it down to an unrelated problem in the code he was > testing for me. Not too surprising - that's what all the gdb_assert's > and such are for, after all :-) But not only was it not asking permission > before it bailed, but it wasn't even leaving a useful message. > > I think the attached patch is reasonable. It changes error handling > such that if query is a no-op - for instance, from a script file, > or from a pipe - we dump out a message to stdout anyway before quitting > or dumping core. > > It's easy to see this behavior for yourself. Just put the line > "maint internal-error" in a text file, and start gdb with -x filename. > Watch it abort without saying goodbye. > > Any thoughts on this patch? Shall I commit it? What if we simply had 'query' itself print out the prompt, followed by "[answering 'y', since standard input is not a terminal]" (or something more tasteful)? Then you wouldn't have to go around decorating all the calls to query.