From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2156 invoked by alias); 4 Oct 2011 15:40:14 -0000 Received: (qmail 2146 invoked by uid 22791); 4 Oct 2011 15:40:13 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_GJ X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Oct 2011 15:39:49 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p94Fdl9Y009054 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Oct 2011 11:39:47 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p94Fdk12000702; Tue, 4 Oct 2011 11:39:47 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p94FdjWs014443; Tue, 4 Oct 2011 11:39:45 -0400 From: Tom Tromey To: Jan Kratochvil Cc: Paul Koning , pmuldoon@redhat.com, gdb-patches@sourceware.org Subject: Re: Python: fetch value when building gdb.Value object References: <36B29E9D-F2B3-446F-AF8A-97254A3AAEE2@comcast.net> <20111001090443.GA11227@host1.jankratochvil.net> Date: Tue, 04 Oct 2011 15:40:00 -0000 In-Reply-To: <20111001090443.GA11227@host1.jankratochvil.net> (Jan Kratochvil's message of "Sat, 1 Oct 2011 11:04:43 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2011-10/txt/msg00084.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Paul> If so, most of the Python code seems to be a candidate for Paul> RETURN_MASK_ERROR. Jan> In fact I do not know, it is a Python thing. Jan> RETURN_MASK_ALL is right if returned PyExc_KeyboardInterrupt will really abort Jan> any execution of Python code. It is probably so, as suggested by: Jan> http://docs.python.org/library/exceptions.html#exceptions.KeyboardInterrupt Jan> RETURN_MASK_ERROR is right otherwise, but only if it is safe to Jan> longjmp out from a code called by Python. This may not be true. Jan> Python may be C++ exceptions throwing safe but it cannot be safe Jan> for the GDB longjmp exceptions. But this case would mean Python is Jan> buggy for CTRL-C on its own so RETURN_MASK_ERROR probably is not Jan> right. I think the Python code in GDB should use RETURN_MASK_ALL in all cases. The C-c case should be turned into PyExc_KeyboardInterrupt. Other exceptions should either be ignored or turned into the appropriate Python exception, depending on the situation. Letting the C-c case longjmp over the Python implementation is bad, I would imagine it will result in crashes. Ignoring it is also bad. Paul> Probably related: I just tried an infinite Python loop and found Paul> that control-C had no effect. I wonder if the Python interpreter Paul> is setting up its own control-C trap (quite possibly -- that's a Paul> Python exception after all) and we're losing it somewhere along Paul> the lines. Jan> Yes, this is the kind of bug from it, thanks for checking it. I suspect we have to override Python's SIGINT handling. I haven't investigated. Jan> 2011-10-01 Jan Kratochvil Jan> * python/py-value.c (valpy_getitem): New variable back_to. Register Jan> xfree of field to it. Call do_cleanups for it. Use RETURN_MASK_ERROR Jan> instead of RETURN_MASK_ALL. This patch runs the cleanups too late. They have to be done before GDB_PY_HANDLE_EXCEPTION, as that has an early return in it. Cleanest is probably doing it all inside the TRY_CATCH. Tom