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

Khoo Yit Phang khooyp@cs.umd.edu
Wed Jul 25 21:13:00 GMT 2012


Hi,

Other than the comments below, I've updated the patch to address your review.

Thanks!

Yit
July 25, 2012

On Jul 25, 2012, at 1:36 PM, Khoo Yit Phang wrote:

> Hi,
> 
> On Jul 25, 2012, at 1:28 PM, Tom Tromey wrote:
> 
>>>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> writes:
>> 
>> Yit> +static sig_t gdbpy_saved_sigint_handler;
>> 
>> Rather than use a global, it seems a bit better to me to store the old
>> signal handler in the python_env, and then restore it from there.
> 
> Actually, that's not the behavior I'm going for: instead of restoring the old signal handler, I'm preserving whatever changes to the signal handler that has been made in the nested Python context (if it can ever happen). E.g.:
> 
> (gdb) ... at this point, it's the FOO handler ...
> (gdb) py
>>>> gdb.execute("... something that changes the signal handler to BAR ...")
>>>> ^D
> (gdb) ... at this point, it's the BAR handler ...
> 
>> Yit> +      gdbpy_suspend_sigint_handler ();
>> 
>> This addition handles one instance of the python->gdb transition, but
>> there are many more to fix.
> 
> I think it's okay to handle just the long-running python->gdb transitions, or those where SIGINT is critical to correct functionality. Are there other long-running python->gdb transitions that I should fix?
> 
> Yit
> July 25, 2012


-------------- next part --------------
A non-text attachment was scrubbed...
Name: python-handle-sigint
Type: application/octet-stream
Size: 4249 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120725/c085c2f6/attachment.obj>


More information about the Gdb-patches mailing list