This is the mail archive of the gdb-patches@sourceware.org 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: Handle SIGINT in Python


Hi,

On Jan 10, 2012, at 4:46 PM, Doug Evans wrote:

> On Tue, Jan 10, 2012 at 1:29 PM, Khoo Yit Phang <khooyp@cs.umd.edu> wrote:
>> 
>> There's one caveat: if an inferior is running via, e.g., gdb.execute("run"), SIGINT will interrupt the inferior but not the enclosing "python" command. I think it would be better to also interrupt the "python" command, but I'm not sure how to detect this case yet.
> 
> There is value in having the SIGINT *only* affect the inferior.
> It's up to the script to handle the various reasons why the inferior
> may have stopped, and you don't (generally) want to interfere with
> that (by interrupting the script too).

That makes sense, and I believe it's currently possible to detect that from Python via gdb.events.stop. It might be nicer to throw a custom exception (perhaps a subclass of KeyboardInterrupt), though that can be a different patch.

Yit
January 10, 2012


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