From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32188 invoked by alias); 10 Jan 2012 21:29:32 -0000 Received: (qmail 32179 invoked by uid 22791); 10 Jan 2012 21:29:31 -0000 X-SWARE-Spam-Status: No, hits=-1.0 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 21:29: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 8FC98B40927; Tue, 10 Jan 2012 16:29:16 -0500 (EST) From: Khoo Yit Phang Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Handle SIGINT in Python Date: Tue, 10 Jan 2012 21:31:00 -0000 Message-Id: Cc: Khoo Yit Phang To: gdb-patches@sourceware.org Mime-Version: 1.0 (Apple Message framework v1084) X-CSD-MailScanner-ID: 8FC98B40927.A8B15 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: 1326835756.73693@6y2Twx9jD534x6f5asUZCA 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/msg00320.txt.bz2 Hi, I've written a patch to GDB's Python support to allow SIGINT to interrupt a= running script to address the bug http://sourceware.org/bugzilla/show_bug.= cgi?id=3D13265 (I've attached my patch to that page). It works by installing a Python-specific SIGINT handler just before executi= ng a Python script, and restoring the original SIGINT handler after executi= on as well as at calls to gdb.execute(...). 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. Yit January 10, 2012