From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27340 invoked by alias); 5 Sep 2003 18:01:48 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27285 invoked from network); 5 Sep 2003 18:01:44 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 5 Sep 2003 18:01:44 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 7AC008003B1; Fri, 5 Sep 2003 14:01:40 -0400 (EDT) Message-ID: <3F58CF84.7040304@redhat.com> Date: Fri, 05 Sep 2003 18:01:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: RFC: fix problems with errors during quitting (killed.exp) References: <3F58B193.5090400@redhat.com> <20030905155833.GA27258@nevyn.them.org> In-Reply-To: <20030905155833.GA27258@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-09/txt/msg00082.txt.bz2 Daniel Jacobowitz wrote: > On Fri, Sep 05, 2003 at 11:53:55AM -0400, J. Johnston wrote: > >>The following patch fixes the problem that occurs when an error happens >>while >>quitting. Often an error() call gets triggered and the poor user is thrown >>back to the gdb command line where they try to quit again. I made an >>attempt >>to fix a similar problem by handling ptrace errors in quitting, however, >>thread-db.c gets >>into multiple precarious situations because it has to rely on libthread_db >>for information. When the thread has been killed/maimed, it gets errors >>when >>they are not expected and quitting becomes impossible. >> >>My new strategy is to intercept error() calls during quitting. Basically, >>a simple get/set function is set up to denote when we the user has confirmed >>a quit. If we get into top.c:throw_exception() and quit has been >>confirmed, it >>exits the program. This handles any number of messy kill scenarios and >>causes >>no regressions in the current testsuite. It fixes gdb.threads/killed.exp. >>I made the >>functions external so other parts of gdb can register a confirmed quit if >>necessary. I could >>make these routines static if this feature is not needed. I chose to exit >>with the >>code being passed on the jump. There may be a better constant choice. >> >>If anyone can think of scenario that this code is not going to handle >>correctly that might >>not be exercised by the testsuite, please let me know. >> >>Tested on x86 and ia64. >> >>Comments? > > > My immediate concern is, does killed.exp leave a stopped binary around? > It doesn't, but the debugged process going away was the cause of the error in the first place. I don't know if there are can't-quit scenarios where a process will be left around. Some fork/exec nightmare perhaps??, but I'm not sure what gdb could be expected to do in such a situation. -- Jeff J. > Other than that I like it. > > >>2003-09-04 Jeff Johnston >> >> * top.h (get_quit_confirmed, set_quit_confirmed): New prototypes. >> * top.c (get_quit_confirmed, set_quit_confirmed): New functions. >> (throw_exception): If quit confirmed, exit instead of jumping. > > >