From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22125 invoked by alias); 28 Aug 2013 14:52:35 -0000 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 Received: (qmail 22115 invoked by uid 89); 28 Aug 2013 14:52:34 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Aug 2013 14:52:34 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7SEqV5j005548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Aug 2013 10:52:31 -0400 Received: from barimba (ovpn-113-142.phx2.redhat.com [10.3.113.142]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7SEqToH002202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 28 Aug 2013 10:52:30 -0400 From: Tom Tromey To: Phil Muldoon Cc: "gdb-patches\@sourceware.org" Subject: Re: [patch] [python] PR python/15461 (gate architecture calls) References: <521DE761.6010403@redhat.com> Date: Wed, 28 Aug 2013 14:52:00 -0000 In-Reply-To: <521DE761.6010403@redhat.com> (Phil Muldoon's message of "Wed, 28 Aug 2013 13:04:49 +0100") Message-ID: <87k3j5x3yq.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-08/txt/msg00830.txt.bz2 >>>>> "Phil" == Phil Muldoon writes: Phil> This patch gates calls to architecture.name and Phil> architecture.disassemble. If the underlying GDB architecture is NULL, Phil> calls to those Python functions will result in an assert call. Thanks. Phil> +/* Require a valid Architecture. */ Phil> +#define ARCHPY_REQUIRE_VALID (arch_obj, arch) \ Phil> + do { \ Phil> + arch = arch_object_to_gdbarch (arch_obj); \ Phil> + if (arch == NULL) \ Phil> + error (_("Architecture is invalid.")); \ Phil> + } while (0) I think it would be simpler to either: * Have this set the python exception and not call error, or * Likewise but just have it be done in arch_object_to_gdbarch. With the current approach you have to have a try/catch and then throw an exception; but really all you want is to set the python exception -- which is cheaper to do directly. Phil> # You should have received a copy of the GNU General Public License Phil> # along with this program. If not, see . Phil> +load_lib gdb-python.exp It would be handy to get this hunk in sooner. It's obvious fwiw. Tom