From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18118 invoked by alias); 3 Jan 2014 21:11:03 -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 18095 invoked by uid 89); 3 Jan 2014 21:11:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: plane.gmane.org Received: from plane.gmane.org (HELO plane.gmane.org) (80.91.229.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 03 Jan 2014 21:11:01 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VzC15-0000hM-Pe for gdb-patches@sourceware.org; Fri, 03 Jan 2014 22:10:51 +0100 Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Jan 2014 22:10:51 +0100 Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 Jan 2014 22:10:51 +0100 To: gdb-patches@sourceware.org From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH v2 02/13] script language API for GDB: extension.[ch] Followup-To: gmane.comp.gdb.patches Date: Fri, 03 Jan 2014 21:11:00 -0000 Message-ID: <87txdklqk4.fsf@gnu.org> References: <52a7f3e8.e7ed440a.1c58.020f@mx.google.com> <87vbyffcwu.fsf@fleche.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 14 =?utf-8?Q?Niv=C3=B4se?= an 222 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) Cc: guile-user@gnu.org X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00021.txt.bz2 Doug Evans skribis: > On Mon, Dec 23, 2013 at 1:57 PM, Tom Tromey wrote: >>>>>>> "Doug" == Doug Evans writes: >> >> Doug> +void >> Doug> +clear_quit_flag (void) >> Doug> +{ >> Doug> + int i; >> Doug> + const struct extension_language_defn *extlang; >> Doug> + >> Doug> + ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang) >> Doug> + { >> Doug> + if (extlang->ops->clear_quit_flag != NULL) >> Doug> + extlang->ops->clear_quit_flag (extlang); >> Doug> + } >> Doug> + >> Doug> + quit_flag = 0; >> Doug> +} >> >> I don't think this will work properly. It seems to me that a given >> interrupt may be processed multiple times -- once by each extension >> language. > > Guile doesn't provide the same hooks that Python does for SIGINT > (PyErr_SetInterrupt, et.al.) so I expect this part to need some work. > >> The way it works right now, if Python handles the "quit", then Python >> clears the flag -- which also clears gdb's notion of the flag, because >> the two are identical. >> >> With the above it seems that Python could clear its flag -- but leave >> other extension languages unaware that the interrupt was handled. So, a >> subsequent call into Guile will presumably erroneously throw an >> exception. > > We carefully manage entry and exit to/from extension languages. > It should be possible to manage SIGINT across these boundaries. > v3 coming up, but I'm leaving this part to v4. I’m not sure I understand the problem. What part of the code calls signal(2) or sigaction(2) in the end? There can only be one SIGINT handler in the process anyway, so I guess it has to be installed by GDB (the extension-language-independent part), no? What are extension languages typically expected to do when the ‘quit’ flag is set? (And happy new year, where applicable! ;-)) Ludo’.