From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7029 invoked by alias); 11 Jan 2012 18:48:25 -0000 Received: (qmail 7007 invoked by uid 22791); 11 Jan 2012 18:48:23 -0000 X-SWARE-Spam-Status: No, hits=-1.4 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; Wed, 11 Jan 2012 18:48:10 +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 7FD91B4015D; Wed, 11 Jan 2012 13:48:05 -0500 (EST) Subject: Re: Make the "python" command resemble the standard Python interpreter Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Khoo Yit Phang In-Reply-To: Date: Wed, 11 Jan 2012 19:04:00 -0000 Cc: Khoo Yit Phang , gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <48619020-0550-4888-9F05-158DB065252B@cs.umd.edu> References: <94906C8E-C23D-4DA3-989D-DDCCFA20FC35@cs.umd.edu> To: Kevin Pouget X-CSD-MailScanner-ID: 7FD91B4015D.AA0F8 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: 1326912485.7126@eca6U0cTWQOoAGfv0NvL0Q 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/msg00361.txt.bz2 Hi, On Jan 11, 2012, at 1:31 PM, Kevin Pouget wrote: > On Wed, Jan 11, 2012 at 4:53 PM, Khoo Yit Phang wrote: >=20 >>>> + p =3D command_line_input (prompt, 0, "python"); >>>> + do_cleanups (cleanup); >>>> + } >>>=20 >>> I'm not sure about that, but isn't the clean up supposed to be >>> executed even if an exception is thrown? it seems not to be the case >>> here >>=20 >> Are you referring to do_cleanups? If I understand correctly, it's to han= dle the case where an exception is not thrown (see, e.g., py-value.c). >=20 > I think that's you're supposed to use the cleanup machinery when you > don't explicitely handle the exception. Here you code looks like: >=20 >> TRY_CATCH >> { >> do_something_dangerous() >> } >> handle_exception_if_any() >> continue_anyway() >=20 > so I think it's safe to simply call "gdbpy_suspend_sigint_handler" > after the exception handling. I don't think that's right. I traced this, and the cleanup function isn't c= alled if I don't use do_cleanup. In this case, it must be called to restore= the SIGINT handler to Python. In many other places I've looked that use TR= Y_CATCH, do_cleanup is called at the end too. Yit January 11, 2012