From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1820 invoked by alias); 28 Jun 2010 19:51:56 -0000 Received: (qmail 1812 invoked by uid 22791); 28 Jun 2010 19:51:55 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Mon, 28 Jun 2010 19:51:52 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5SJpoo9028451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Jun 2010 15:51:50 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5SJpn5W018963; Mon, 28 Jun 2010 15:51:49 -0400 Received: from opsy.redhat.com (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 o5SJpmYX003906; Mon, 28 Jun 2010 15:51:49 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 921A5378967; Mon, 28 Jun 2010 13:51:48 -0600 (MDT) From: Tom Tromey To: Phil Muldoon Cc: gdb-patches ml Subject: Re: [python][patch] Inferior and Thread information support. References: <4BFA6E82.3070704@redhat.com> <4C1B16BF.3040000@redhat.com> <4C209107.9010800@redhat.com> <4C2869BB.3050304@redhat.com> Reply-To: tromey@redhat.com Date: Mon, 28 Jun 2010 19:51:00 -0000 In-Reply-To: <4C2869BB.3050304@redhat.com> (Phil Muldoon's message of "Mon, 28 Jun 2010 10:22:03 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-06/txt/msg00653.txt.bz2 >>>>> "Phil" == Phil Muldoon writes: Phil> + cleanup = ensure_python_env (python_gdbarch, python_language); Phil> + Phil> + thread_obj = create_thread_object (tp); Phil> + if (!thread_obj) Phil> + { Phil> + warning (_("Cannot create Python InferiorThread object.")); Phil> + gdbpy_print_stack (); Phil> + do_cleanups (cleanup); Tom> I don't think there is any need for a warning here. Tom> The exception should suffice. Phil> OK Actually I meant that you should remove the call to warning but leave in the gdbpy_print_stack. Phil> + buffer = xmalloc (length); Phil> + make_cleanup (xfree, buffer); Phil> + Phil> + read_memory (addr, buffer, length); Phil> + } Phil> + GDB_PY_HANDLE_EXCEPTION (except); Tom> GDB_PY_HANDLE_EXCEPTION returns from the function; this will leave the Tom> cleanups dangling. You have to run the cleanups before the return. Phil> OK The new code looks like this: Phil> + if (except.reason < 0) Phil> + { Phil> + do_cleanups (cleanups); Phil> + return PyErr_Format (PyExc_RuntimeError, "%s", except.message); Phil> + } ... but this does the wrong thing for RETURN_QUIT. Instead I think you should do if (except.reason < 0) { do_cleanups ...; GDB_PY_HANDLE_EXCEPTION (...); } This is a little redundant but it will do the right thing -- and will continue to do so if we ever split the different kinds of gdb exceptions into different Python exceptions. This patch is ok with those changes. Thanks for persevering. Tom