Handle SIGINT in Python

Tom Tromey tromey@redhat.com
Fri Jan 20 21:40:00 GMT 2012


>>>>> "Yit" == Khoo Yit Phang <khooyp@cs.umd.edu> writes:

Tom> Could we possibly solve this problem without constantly resetting the
Tom> SIGINT handler?  Maybe via a combination of a global flag plus a call
Tom> into Python from handle_sigint?

Yit> It is possible, I just need a way to call PySet_Interrupt. But it
Yit> seems to be that it would require adding hooks to events-top.c and,
Yit> which seems like a separate project.

I think of it more as a different implementation of the feature...

Tom> Our python->gdb exception story is not super.  And, we lose information
Tom> in the round trip.  This might (or might not...) be a prerequisite to
Tom> solving this problem.

Yit> I don't think it's a problem, unless for nested calls to python like
Yit> "py gdb.execute('py ...')".

You can't fully predict what gdb actions will cause Python code to run.

Also, Python frequently calls into gdb.  Any place in gdb that invokes
QUIT could potentially see a C-c.  However, IIUC, with your patch these
QUITs will be inactive if there is Python code up the stack -- but this
means that some slow things in gdb will be uninterruptible.

Tom



More information about the Gdb-patches mailing list