From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27134 invoked by alias); 2 Aug 2012 17:09:26 -0000 Received: (qmail 27114 invoked by uid 22791); 2 Aug 2012 17:09:24 -0000 X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Aug 2012 17:09:02 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q72H925V001927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Aug 2012 13:09:02 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q72H91Ad029387; Thu, 2 Aug 2012 13:09:01 -0400 Message-ID: <501AB42C.4000701@redhat.com> Date: Thu, 02 Aug 2012 17:09:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: RFC: clear quit_flag in quit, not throw_exception References: <87mx2dqnk8.fsf@fleche.redhat.com> In-Reply-To: <87mx2dqnk8.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2012-08/txt/msg00082.txt.bz2 On 08/02/2012 05:13 PM, Tom Tromey wrote: > I noticed that throw_exception clears quit_flag and immediate_quit. > > This seems like it could cause gdb to miss C-c sometimes. > In particular, if a SIGINT arrives and then, before QUIT is called, some > code in gdb throws an unrelated exception, then the SIGINT will > effectively be ignored. > > It seems to me that it is just as safe, and more correct, to clear these > flags in the quit function. If the unrelated exception/error unwinds things all the way up to the top prompt, managing to bypass all QUIT calls, then we'll end up with a dangling quit until the next command it entered (resulting in a spurious, delayed "Quit"), it seems to me. If that analysis is correct, maybe we should also clear or handle these somehow somewhere near the top loop? > > Tom > > * exceptions.c (throw_exception): Don't clear quit_flag or > immediate_quit. > * utils.c (quit): Clear quit_flag and immediate_quit. > --- > gdb/exceptions.c | 3 --- > gdb/utils.c | 3 +++ > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gdb/exceptions.c b/gdb/exceptions.c > index 7db9df9..84c21a2 100644 > --- a/gdb/exceptions.c > +++ b/gdb/exceptions.c > @@ -221,9 +221,6 @@ exceptions_state_mc_action_iter_1 (void) > void > throw_exception (struct gdb_exception exception) > { > - quit_flag = 0; > - immediate_quit = 0; > - > do_cleanups (all_cleanups ()); > > /* Jump to the containing catch_errors() call, communicating REASON > diff --git a/gdb/utils.c b/gdb/utils.c > index c69c3e0..6ba8c62 100644 > --- a/gdb/utils.c > +++ b/gdb/utils.c > @@ -1055,6 +1055,9 @@ print_sys_errmsg (const char *string, int errcode) > void > quit (void) > { > + quit_flag = 0; > + immediate_quit = 0; > + > #ifdef __MSDOS__ > /* No steenking SIGINT will ever be coming our way when the > program is resumed. Don't lie. */ > -- Pedro Alves