From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23536 invoked by alias); 7 Jan 2014 13:10:45 -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 23524 invoked by uid 89); 7 Jan 2014 13:10:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: hera.aquilenet.fr Received: from hera.aquilenet.fr (HELO hera.aquilenet.fr) (141.255.128.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jan 2014 13:10:42 +0000 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0D9511A95; Tue, 7 Jan 2014 14:10:39 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0cfWKR-DVdD7; Tue, 7 Jan 2014 14:10:38 +0100 (CET) Received: from pluto (unknown [193.50.110.94]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C437E1A94; Tue, 7 Jan 2014 14:10:38 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Tom Tromey Cc: gdb-patches@sourceware.org, guile-user@gnu.org Subject: Re: [PATCH v2 02/13] script language API for GDB: extension.[ch] References: <52a7f3e8.e7ed440a.1c58.020f@mx.google.com> <87vbyffcwu.fsf@fleche.redhat.com> <87txdklqk4.fsf@gnu.org> <87r48kkc9g.fsf@fleche.redhat.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 18 =?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 Date: Tue, 07 Jan 2014 13:10:00 -0000 In-Reply-To: <87r48kkc9g.fsf@fleche.redhat.com> (Tom Tromey's message of "Mon, 06 Jan 2014 14:53:47 -0700") Message-ID: <87eh4krl81.fsf@gnu.org> User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2014-01/txt/msg00137.txt.bz2 Tom Tromey skribis: >>>>>> "Ludovic" =3D=3D Ludovic Court=C3=A8s writes: > > Ludovic> I=E2=80=99m not sure I understand the problem. > > Ludovic> What are extension languages typically expected to do when the = =E2=80=98quit=E2=80=99 > Ludovic> flag is set? > > The basic idea is that if some extension code is running, then C-c ought > to interrupt that code in the way expected by programmers writing code > in that language. > > Python provides a kind of low-level API to its equivalent of Guile's > SCM_TICK and async stuff. So the approach we took in gdb was to unify > gdb's implementation with Python's, when Python is enabled. This > ensures that a SIGINT delivery is handled a single time -- by Python if > Python code is running, and by gdb if gdb code is running. So do I get it right that it=E2=80=99s GDB that does signal(SIGINT, ...), a= nd its handler just calls PyOS_InterruptOccurred (or so) if Python code happens to be running? > One approach for multiple extension languages might be to notice when > switching languages and move the bit. However I didn't see any way to > do this in the Guile API. In Python it can be accomplished with > PyErr_SetInterrupt and PyOS_InterruptOccurred. Would it work, upon SIGINT, to do something like: (system-async-mark (lambda () (throw 'system-error ... EINTR))) That would eventually raise an exception in Scheme code. Ludo=E2=80=99.