From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1282 invoked by alias); 22 Jan 2007 14:41:08 -0000 Received: (qmail 1250 invoked by uid 22791); 22 Jan 2007 14:41:07 -0000 X-Spam-Check-By: sourceware.org Received: from w099.z064220152.sjc-ca.dsl.cnc.net (HELO bluesmobile.corp.specifix.com) (64.220.152.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 22 Jan 2007 14:41:01 +0000 Received: from fishpond.diveadx.com (bluesmobile.corp.specifix.com [192.168.1.32]) by bluesmobile.corp.specifix.com (Postfix) with ESMTP id C60D73B7EB; Mon, 22 Jan 2007 06:40:55 -0800 (PST) From: Fred Fish Reply-To: fnf@specifix.com To: Mark Kettenis Subject: Re: [RFC] Patch for QUIT macro support Date: Mon, 22 Jan 2007 14:41:00 -0000 User-Agent: KMail/1.9.5 Cc: drow@false.org, gdb-patches@sources.redhat.com References: <200610130543.25806.fnf@specifix.com> <200610130648.31875.fnf@specifix.com> <200610151800.k9FI0fDS016688@elgar.sibelius.xs4all.nl> In-Reply-To: <200610151800.k9FI0fDS016688@elgar.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_1zMtFdWrr+wy48U" Message-Id: <200701220740.53051.fnf@specifix.com> 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: 2007-01/txt/msg00454.txt.bz2 --Boundary-00=_1zMtFdWrr+wy48U Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 328 On Sunday 15 October 2006 11:00, Mark Kettenis wrote: > We really should not put history in our comments. Good point. Here is a patch with updated comments. It would be good if someone could independently review, test, and approve this, particularly anyone using an interface other than the normal command line one. -Fred --Boundary-00=_1zMtFdWrr+wy48U Content-Type: text/x-diff; charset="utf-8"; name="quit.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="quit.diff" Content-length: 1484 2007-01-22 Fred Fish * event-top.c (handle_sigint): Set quit_flag. (async_request_quit): Don't set quit_flag. Avoid calling quit() if quit_flag has already been reset. Index: event-top.c =================================================================== RCS file: /cvs/src/src/gdb/event-top.c,v retrieving revision 1.48 diff -u -p -r1.48 event-top.c --- event-top.c 9 Jan 2007 17:58:50 -0000 1.48 +++ event-top.c 22 Jan 2007 14:35:14 -0000 @@ -961,6 +961,13 @@ handle_sigint (int sig) { signal (sig, handle_sigint); + /* We could be running in a loop reading in symfiles or something so + it may be quite a while before we get back to the event loop. So + set quit_flag to 1 here. Then if QUIT is called before we get to + the event loop, we will unwind as expected. */ + + quit_flag = 1; + /* If immediate_quit is set, we go ahead and process the SIGINT right away, even if we usually would defer this to the event loop. The assumption here is that it is safe to process ^C immediately if @@ -989,7 +996,14 @@ handle_sigterm (int sig) void async_request_quit (gdb_client_data arg) { - quit_flag = 1; + /* If the quit_flag has gotten reset back to 0 by the time we get + back here, that means that an exception was thrown to unwind + the current command before we got back to the event loop. So + there is no reason to call quit again here. */ + + if (quit_flag == 0) + return; + quit (); } --Boundary-00=_1zMtFdWrr+wy48U--