From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11433 invoked by alias); 5 Mar 2014 13:34:49 -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 11420 invoked by uid 89); 5 Mar 2014 13:34:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=BAYES_00,KAM_STOCKGEN,SPF_PASS autolearn=no version=3.3.2 X-HELO: forward-corp1e.mail.yandex.net Received: from forward-corp1e.mail.yandex.net (HELO forward-corp1e.mail.yandex.net) (77.88.60.199) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 05 Mar 2014 13:34:46 +0000 Received: from smtpcorp4.mail.yandex.net (smtpcorp4.mail.yandex.net [95.108.252.2]) by forward-corp1e.mail.yandex.net (Yandex) with ESMTP id AEAF0640137; Wed, 5 Mar 2014 17:34:41 +0400 (MSK) Received: from smtpcorp4.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp4.mail.yandex.net (Yandex) with ESMTP id 8B4232C07C0; Wed, 5 Mar 2014 17:34:41 +0400 (MSK) Received: from unknown (unknown [2a02:6b8:0:408:f552:3e3:fe7a:878a]) by smtpcorp4.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id tRWpedFkqb-YfMGOh98; Wed, 5 Mar 2014 17:34:41 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: c38f9595-aa69-458d-88a0-a3322d5b63c5 Authentication-Results: smtpcorp4.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: [PATCH 3/3] gdb/doc/python.texi: documented gdb.SYMBOL_LOC_LABEL. Added notion on possible exception thrown from symbol object .value() method From: Maxim Bublis In-Reply-To: <83eh2hsy77.fsf@gnu.org> Date: Wed, 05 Mar 2014 13:34:00 -0000 Cc: gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <64F4FC80-53C2-47F4-A889-D19AE1304C0B@yandex-team.ru> References: <1393929360-31299-1-git-send-email-satori@yandex-team.ru> <1393929360-31299-4-git-send-email-satori@yandex-team.ru> <83eh2hsy77.fsf@gnu.org> To: Eli Zaretskii X-SW-Source: 2014-03/txt/msg00113.txt.bz2 Hi > I have a question regarding the last part: is it wise to throw an > exception when a symbol has no value? how about returning None > instead? There is already implemented similar behavior for LOC_TYPEDEF, it raises Ty= peError exception, I think there is no good reason to break current API. >From gdb-patches-return-110916-listarch-gdb-patches=sources.redhat.com@sourceware.org Wed Mar 05 13:39:16 2014 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 13944 invoked by alias); 5 Mar 2014 13:39:16 -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 Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 13928 invoked by uid 89); 5 Mar 2014 13:39:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: forward-corp1f.mail.yandex.net Received: from forward-corp1f.mail.yandex.net (HELO forward-corp1f.mail.yandex.net) (95.108.130.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 05 Mar 2014 13:39:15 +0000 Received: from smtpcorp4.mail.yandex.net (smtpcorp4.mail.yandex.net [95.108.252.2]) by forward-corp1f.mail.yandex.net (Yandex) with ESMTP id A9F3424200D6; Wed, 5 Mar 2014 17:39:10 +0400 (MSK) Received: from smtpcorp4.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp4.mail.yandex.net (Yandex) with ESMTP id 85DE42C07C0; Wed, 5 Mar 2014 17:39:10 +0400 (MSK) Received: from unknown (unknown [2a02:6b8:0:408:f552:3e3:fe7a:878a]) by smtpcorp4.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id fsFoPs5pkT-dAM4mJZT; Wed, 5 Mar 2014 17:39:10 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 3eb675e6-d571-4c96-ad3e-8b88b0d8f9bc Authentication-Results: smtpcorp4.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: [PATCH 2/3] gdb/python: raise TypeError instead of abort() on calling .value() method for label symbol object From: Maxim Bublis In-Reply-To: <53161401.5080408@redhat.com> Date: Wed, 05 Mar 2014 13:39:00 -0000 Cc: gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: <07E7B14B-748D-4CF7-A8AD-623AF5D6E701@yandex-team.ru> References: <1393929360-31299-1-git-send-email-satori@yandex-team.ru> <1393929360-31299-3-git-send-email-satori@yandex-team.ru> <53161401.5080408@redhat.com> To: Phil Muldoon X-SW-Source: 2014-03/txt/msg00114.txt.bz2 Content-length: 732 > This patch looks fine to me apart from one further small aside (please > wait for a maintainer to approve your patch, regardless). In the > documentation you note there are other types of symbol that can > produce this error: e.g., SYMBOL_LOC_TYPEDEF. Can you please audit and > include checks for all, while you are there? I noticed only the > explicit LOC_LABEL check in the patch above. There is already implemented similar behavior for LOC_TYPEDEF, so no additi= onal work here should be done. On the other hand there is no testcase for typedef symbol object .value() m= ethod call. Maybe you could provide me a help with writing such testcase as I do not qu= ietly understand how typedef symbol object could be retrieved. >From gdb-patches-return-110918-listarch-gdb-patches=sources.redhat.com@sourceware.org Wed Mar 05 13:41:39 2014 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 15907 invoked by alias); 5 Mar 2014 13:41:38 -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 Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 15755 invoked by uid 89); 5 Mar 2014 13:41:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: satori.sandbox-dev.search.yandex.net Received: from satori.sandbox-dev.search.yandex.net (HELO satori.sandbox-dev.search.yandex.net) (5.255.204.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Mar 2014 13:41:36 +0000 Received: by satori.sandbox-dev.search.yandex.net (Postfix, from userid 30101) id F17C8F40C3D; Wed, 5 Mar 2014 17:41:32 +0400 (MSK) From: Maxim Bublis To: gdb-patches@sourceware.org Cc: Maxim Bublis Subject: [PATCH v2 2/3] gdb/python: raise TypeError instead of abort on calling value method for label symbol object Date: Wed, 05 Mar 2014 13:41:00 -0000 Message-Id: <1394026864-4691-2-git-send-email-satori@yandex-team.ru> In-Reply-To: <1394026864-4691-1-git-send-email-satori@yandex-team.ru> References: <1394026864-4691-1-git-send-email-satori@yandex-team.ru> In-Reply-To: <1393929360-31299-3-git-send-email-satori@yandex-team.ru> X-SW-Source: 2014-03/txt/msg00116.txt.bz2 Content-length: 1079 --- gdb/ChangeLog | 6 ++++++ gdb/python/py-symbol.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8108e50..19ec13c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-03-05 Maxim Bublis + + * gdb/python/py-symbol.c (sympy_value): Throw TypeError exception + instead of abort on calling value method for + symbol object with SYMBOL_LOC_LABEL address class. + 2014-03-05 Mike Frysinger * remote-sim.c (gdbsim_load): Add const to prog. diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index 6900d58..6303cea 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -262,6 +262,12 @@ sympy_value (PyObject *self, PyObject *args) return NULL; } + if (SYMBOL_CLASS (symbol) == LOC_LABEL) + { + PyErr_SetString (PyExc_TypeError, "It is not possible to compute the value of a label."); + return NULL; + } + TRY_CATCH (except, RETURN_MASK_ALL) { if (frame_obj != NULL) -- 1.7.9.5