This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 02/13] script language API for GDB: extension.[ch]
- From: ludo at gnu dot org (Ludovic CourtÃs)
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org, guile-user at gnu dot org
- Date: Tue, 07 Jan 2014 14:10:38 +0100
- Subject: Re: [PATCH v2 02/13] script language API for GDB: extension.[ch]
- Authentication-results: sourceware.org; auth=none
- References: <52a7f3e8 dot e7ed440a dot 1c58 dot 020f at mx dot google dot com> <87vbyffcwu dot fsf at fleche dot redhat dot com> <CAP9bCMQx_pDKsRTDv5h62kqO4==MTJ80XsZ2RYfpzsjDT1u68g at mail dot gmail dot com> <87txdklqk4 dot fsf at gnu dot org> <87r48kkc9g dot fsf at fleche dot redhat dot com>
Tom Tromey <tromey@redhat.com> skribis:
>>>>>> "Ludovic" == Ludovic CourtÃs <ludo@gnu.org> writes:
>
> Ludovic> Iâm not sure I understand the problem.
>
> Ludovic> What are extension languages typically expected to do when the âquitâ
> 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âs GDB that does signal(SIGINT, ...), and
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â.