From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14109 invoked by alias); 20 Mar 2013 16:42:04 -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 14091 invoked by uid 89); 20 Mar 2013 16:41:57 -0000 X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 20 Mar 2013 16:41:54 +0000 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 r2KGfrR1010275 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Mar 2013 12:41:53 -0400 Received: from localhost.localdomain (ovpn-116-94.ams2.redhat.com [10.36.116.94]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2KGfp1D024779; Wed, 20 Mar 2013 12:41:52 -0400 Message-ID: <5149E6CF.2050900@redhat.com> Date: Wed, 20 Mar 2013 16:45:00 -0000 From: Phil Muldoon MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [patch][python] Fix some unguarded GDB calls. References: <5149BAA9.8020902@redhat.com> <87hak69jqg.fsf@fleche.redhat.com> In-Reply-To: <87hak69jqg.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-03/txt/msg00749.txt.bz2 On 20/03/13 15:25, Tom Tromey wrote: >>>>>> "Phil" == Phil Muldoon writes: > > Phil> 2013-03-20 Phil Muldoon > Phil> * python/py-utils.c (get_addr_from_python): Use exception handler > Phil> for value_as_address. > Phil> * python/py-cmd.c (gdbpy_parse_command_name): Use exception > Phil> handler for lookup_cmd_1.. > Phil> * python/python.c (execute_gdb_command): Move bpstat_do_actions > Phil> into exception handler. > > Phil> + if (except.reason < 0) > Phil> + { > Phil> + gdbpy_convert_exception (except); > Phil> + return NULL; > Phil> + } > > Use GDB_PY_HANDLE_EXCEPTION instead. Can't as this function returns char *. I did check the callers, and they do a null check though, and deal with python exceptions. I get this if I use that macro: ../../gdb/gdb/python/py-cmd.c: In function gdbpy_parse_command_name: ../../gdb/gdb/python/py-cmd.c:367:3: error: return from incompatible pointer type [-Werror] > Phil> get_addr_from_python (PyObject *obj, CORE_ADDR *addr) > > This is documented as being able to throw gdb exceptions. > It is fine by me if you want to fix that (it certainly looks simpler > than fixing the one caller in infpy_search_memory), but then the intro > comment for the function needs an update. Yeah I can fix that. Cheers Phil