From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.comp.gdb.patches,gmane.lisp.guile.user Subject: Re: [PATCH v2 02/13] script language API for GDB: extension.[ch] Date: Tue, 07 Jan 2014 14:10:38 +0100 Message-ID: <87eh4krl81.fsf@gnu.org> References: <52a7f3e8.e7ed440a.1c58.020f@mx.google.com> <87vbyffcwu.fsf@fleche.redhat.com> <87txdklqk4.fsf@gnu.org> <87r48kkc9g.fsf@fleche.redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389100255 4540 80.91.229.3 (7 Jan 2014 13:10:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jan 2014 13:10:55 +0000 (UTC) Cc: gdb-patches@sourceware.org, guile-user@gnu.org To: Tom Tromey Original-X-From: gdb-patches-return-108935-gdb-gdb-patches=m.gmane.org@sourceware.org Tue Jan 07 14:11:02 2014 Return-path: Envelope-to: gdb-gdb-patches@plane.gmane.org Original-Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W0WQi-0003Ud-AJ for gdb-gdb-patches@plane.gmane.org; Tue, 07 Jan 2014 14:10:48 +0100 DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=d1kUGh3N5cU/0+RX6TDwbGms5Q/o22SMPBWEyOc6ieZ QTkDzh37JQDzjUJJT45u0RqHJQDfwjFiaRCuLb14TC+U78HaW86LH7ua1cg3L61D YDENCaXihr/cToU4XepDaQ4YjMmszUppEBECV/xdzE1/+noKgLPfeMF3elV4M5pM = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=UGoMMZP91sMnXf6klL71aRKKGZM=; b=UwS1A+uYZoYK+CE/g ktzWrMXiFzUeGzJjdmdsXla6g5i/ufr40pmHWSIE/N7fNH9o577bVhJp2XAoFMpj 1tvwxI9oP73ZCApXWPHNSygE6Lq7YvI0nqjuiJUvd96mqUIQoA1aWOVlRNpKA5FR c8YzkE517dBjt0EH7Q9cgZBGF4= Original-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-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: gdb-patches-owner@sourceware.org Original-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 Original-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 Original-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) Original-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) Original-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) 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 In-Reply-To: <87r48kkc9g.fsf@fleche.redhat.com> (Tom Tromey's message of "Mon, 06 Jan 2014 14:53:47 -0700") User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) Xref: news.gmane.org gmane.comp.gdb.patches:93937 gmane.lisp.guile.user:10984 Archived-At: 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.