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: gdb-patches at sourceware dot org
- Cc: guile-user at gnu dot org
- Date: Fri, 03 Jan 2014 22:10:35 +0100
- Subject: Re: [PATCH v2 02/13] script language API for GDB: extension.[ch]
- Authentication-results: sourceware.org; auth=none
- Followup-to: gmane.comp.gdb.patches
- 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>
Doug Evans <xdje42@gmail.com> skribis:
> On Mon, Dec 23, 2013 at 1:57 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>> "Doug" == Doug Evans <xdje42@gmail.com> 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â.