This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 2/3] gdb/python: raise TypeError instead of abort on calling value method for label symbol object
- From: Maxim Bublis <satori at yandex-team dot ru>
- To: gdb-patches at sourceware dot org
- Cc: Maxim Bublis <satori at yandex-team dot ru>
- Date: Wed, 5 Mar 2014 17:41:03 +0400
- Subject: [PATCH v2 2/3] gdb/python: raise TypeError instead of abort on calling value method for label symbol object
- Authentication-results: sourceware.org; auth=none
- References: <1394026864-4691-1-git-send-email-satori at yandex-team dot ru>
---
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