From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3082 invoked by alias); 10 Jan 2012 22:00:32 -0000 Received: (qmail 3054 invoked by uid 22791); 10 Jan 2012 22:00:31 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from router-304.cs.umd.edu (HELO bacon.cs.umd.edu) (128.8.127.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Jan 2012 22:00:18 +0000 Received: from wireless-206-196-163-53.umd.edu (wireless-206-196-163-53.umd.edu [206.196.163.53]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 7A314B403C1; Tue, 10 Jan 2012 17:00:16 -0500 (EST) Subject: Re: Handle SIGINT in Python Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Khoo Yit Phang In-Reply-To: Date: Tue, 10 Jan 2012 22:09:00 -0000 Cc: Khoo Yit Phang , gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Doug Evans X-CSD-MailScanner-ID: 7A314B403C1.A77CB X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-50, required 5, autolearn=not spam, ALL_TRUSTED -50.00) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-CSD-MailScanner-Watermark: 1326837616.73529@4MRVHzHkNAxi3TYRkGO/Sg Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00326.txt.bz2 Hi, On Jan 10, 2012, at 4:46 PM, Doug Evans wrote: > On Tue, Jan 10, 2012 at 1:29 PM, Khoo Yit Phang wrote: >>=20 >> There's one caveat: if an inferior is running via, e.g., gdb.execute("ru= n"), SIGINT will interrupt the inferior but not the enclosing "python" comm= and. I think it would be better to also interrupt the "python" command, but= I'm not sure how to detect this case yet. >=20 > 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 p= atch. Yit January 10, 2012