Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Maxim Bublis <satori@yandex-team.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
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
Date: Wed, 05 Mar 2014 13:34:00 -0000	[thread overview]
Message-ID: <64F4FC80-53C2-47F4-A889-D19AE1304C0B@yandex-team.ru> (raw)
In-Reply-To: <83eh2hsy77.fsf@gnu.org>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 7090 bytes --]

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 TypeError 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: <gdb-patches-return-110916-listarch-gdb-patches=sources.redhat.com@sourceware.org>
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: <gdb-patches.sourceware.org>
List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-patches/>
List-Post: <mailto:gdb-patches@sourceware.org>
List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs>
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ºYES_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 <satori@yandex-team.ru>
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 <pmuldoon@redhat.com>
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 additional work here should be done.
On the other hand there is no testcase for typedef symbol object .value() method call.
Maybe you could provide me a help with writing such testcase as I do not quietly 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: <gdb-patches-return-110918-listarch-gdb-patches=sources.redhat.com@sourceware.org>
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: <gdb-patches.sourceware.org>
List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-patches/>
List-Post: <mailto:gdb-patches@sourceware.org>
List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs>
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 <satori@yandex-team.ru>
To: gdb-patches@sourceware.org
Cc: Maxim Bublis <satori@yandex-team.ru>
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  <satori@yandex-team.ru>
+
+	* 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  <vapier@gentoo.org>

 	* 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


  reply	other threads:[~2014-03-05 13:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 10:36 [PATCH 0/3] Fixed abortion using Python API for label symbol object Maxim Bublis
2014-03-04 10:37 ` [PATCH 3/3] gdb/doc/python.texi: documented gdb.SYMBOL_LOC_LABEL. Added notion on possible exception thrown from symbol object .value() method Maxim Bublis
2014-03-04 16:53   ` Eli Zaretskii
2014-03-05 13:34     ` Maxim Bublis [this message]
2014-03-05 13:41   ` [PATCH v2 3/3] gdb/doc/python.texi: documented gdb.SYMBOL_LOC_LABEL, added notion on possible exceptions thrown from symbol object value method Maxim Bublis
2014-03-05 17:12     ` Eli Zaretskii
2014-03-04 10:37 ` [PATCH 1/3] gdb/testsuite/gdb.python: Added testcase for .value() method Maxim Bublis
2014-03-05 13:41   ` [PATCH v2 1/3] gdb/testsuite/gdb.python: Added testcase for value method Maxim Bublis
     [not found]     ` <1394026864-4691-2-git-send-email-satori@yandex-team.ru>
2014-04-14  7:41       ` [PATCH v2 2/3] gdb/python: raise TypeError instead of abort on calling value method for label symbol object Phil Muldoon
2014-04-16 17:20         ` Maxim Bublis
2014-04-17 12:44           ` Maxim Bublis
2014-03-04 10:37 ` [PATCH 2/3] gdb/python: raise TypeError instead of abort() on calling .value() " Maxim Bublis
2014-03-04 17:57   ` Phil Muldoon
     [not found]     ` <07E7B14B-748D-4CF7-A8AD-623AF5D6E701@yandex-team.ru>
2014-03-06  8:37       ` Phil Muldoon
2014-03-25 16:51 ` [PATCH 0/3] Fixed abortion using Python API " Maxim Bublis
2014-03-25 19:51   ` Phil Muldoon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64F4FC80-53C2-47F4-A889-D19AE1304C0B@yandex-team.ru \
    --to=satori@yandex-team.ru \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox