This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4]: Handle SIGINT under Python by raising KeyboardInterrupt


On Jul 31, 2012, at 9:58 AM, Tom Tromey wrote:

>>>>>> "Yit" == Khoo Yit Phang <> writes:
> I am wondering if the appended patch is correct.
> It removes the check of immediate_quit from async_request_quit.
> It also changes all the places that set immediate_quit to immediately
> call QUIT afterward; the idea being that this handles the race
> situation.  It also changes prompt_for_continue to use quit rather than
> a call to async_request_quit, which has the same effect but doesn't rely
> on the handling of immediate_quit.

It does look like the check for immediate_quit was put in to handle the call to async_request_quit inside prompt_for_continue (, so it seems correct to me. This patch, with your other patch, solves the SIGINT problem in Python and GDB as far as I can tell, and works with my Python readline patch (after removing the calls to suspend_sigint_handler from my other patch).

Just to clarify about QUIT just after immediate_quit, is it to handle Ctrl-C that occurs before immediate_quit, where it would not have triggered before this patch (and simply left a quit event in the event queue)?

> A couple notes though...
> First, it seems to me that immediate_quit and quit_flag ought to be
> of type sig_atomic_t.  And, immediate_quit should be set and cleared,
> not incremented and decremented.  I assume these aren't really needed in
> practice, they are just pedantically more correct.

What about making a cleanup-based interface for immediate_quit? This would ensure that correctly scoped use of immediate_quit, assuming that all such uses can be block-scoped.

July 31

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]