From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37681 invoked by alias); 18 Mar 2016 19:25:04 -0000 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 Received: (qmail 37646 invoked by uid 89); 18 Mar 2016 19:25:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1605, press X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Mar 2016 19:25:02 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id AF7B08E39D for ; Fri, 18 Mar 2016 19:18:46 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2IJIYkB028091 for ; Fri, 18 Mar 2016 15:18:46 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 13/30] Don't call clear_quit_flag in prepare_to_throw_exception Date: Fri, 18 Mar 2016 19:25:00 -0000 Message-Id: <1458328714-4938-14-git-send-email-palves@redhat.com> In-Reply-To: <1458328714-4938-1-git-send-email-palves@redhat.com> References: <1458328714-4938-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-03/txt/msg00363.txt.bz2 I think this is reminiscent of the time when a longjmp would always jump to the top level. Nowaways code that throw exceptions other than a quit, which may even be caught and handled without reaching the top level. Certainly such exceptions shouldn't clear an interrupt request... (We also need to get rid of prepare_to_throw_exception in order to be able to just do "throw ex;" in C++.) One could argue that we should clear the quit flag when we throw a quit from the SIGINT handler, when immediate_quit is in effect, to handle a race, here: immediate_quit++; QUIT; ... that's the usual pattern code must use when enabling immediate_quit. The QUIT is there to catch the case of Ctrl-C having already been pressed before immediate_quit was enabled. However, this can happen: immediate_quit++; << Ctrl-C pressed here too. QUIT; And in that case, if the quit flag was already set, it'll stay set even after throwing a quit from the SIGINT handler. The end result is a double quit. But OTOH, the user did press Ctrl-C two times. Since I'm getting rid of immediate_quit, I'm not bothering with this. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * exceptions.c (prepare_to_throw_exception): Don't clear the quit flag. --- gdb/exceptions.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 8ba86fc..b457838 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -30,7 +30,6 @@ void prepare_to_throw_exception (void) { - clear_quit_flag (); immediate_quit = 0; } -- 2.5.0