From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18017 invoked by alias); 11 Jan 2012 21:03:33 -0000 Received: (qmail 18008 invoked by uid 22791); 11 Jan 2012 21:03:31 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausc60ps301.us.dell.com (HELO ausc60ps301.us.dell.com) (143.166.148.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 21:03:15 +0000 X-Loopcount0: from 10.170.28.39 From: To: , CC: , Date: Wed, 11 Jan 2012 21:06:00 -0000 Subject: RE: Handle SIGINT in Python Message-ID: <09787EF419216C41A903FD14EE5506DD030F1EAD9E@AUSX7MCPC103.AMER.DELL.COM> References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes 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/msg00371.txt.bz2 I think the way to make this work is that a C-c in Python is a "KeyboardInt= errupt" Python exception. That can be caught in Python but rarely is. If = not, it would unwind to the interpreter. A normal Python interpreter would= print the default traceback for that exception, exactly as it does for any= other exception, it doesn't give interrupt special treatment.=20=20 To get what you're asking (C-c work like in non-Python settings in GDB) all= that would be needed is for the interpreter top level to check for specifi= cally the KeyboardInterrupt exception and give that to the GDB C-c handler,= rather than printing the default exception traceback. It would still do t= hat for other (non-interrupt) exceptions. paul -----Original Message----- From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware= .org] On Behalf Of Tom Tromey Sent: Wednesday, January 11, 2012 3:56 PM To: Doug Evans Cc: Khoo Yit Phang; gdb-patches@sourceware.org Subject: Re: Handle SIGINT in Python >>>>> "Doug" =3D=3D Doug Evans writes: Doug> There is value in having the SIGINT *only* affect the inferior. Doug> It's up to the script to handle the various reasons why the=20 Doug> inferior may have stopped, and you don't (generally) want to=20 Doug> interfere with that (by interrupting the script too). I think Python code should have to request something like this specially. = The scripting case is less usual than the interactive debugging (perhaps wi= th some Python helper code) case. I think it would be weird for the behavi= or the user sees, by default, to depend on whether Python or GDB code was a= ctive at the moment of C-c. That is, a C-c when processing a 'python' command in a breakpoint's 'comman= ds' list should have the same general effect as if we were processing any o= ther command. Tom