This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 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: Tue, 4 Mar 2014 14:35:59 +0400
- Subject: [PATCH 2/3] gdb/python: raise TypeError instead of abort() on calling .value() method for label symbol object
- Authentication-results: sourceware.org; auth=none
- References: <1393929360-31299-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 2129d6f..67749e9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-04 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-03 Tom Tromey <tromey@redhat.com>
* elfread.c (probe_key): Change to bfd_data.
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 6900d58..5e22309 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, "cannot get the value of a label");
+ return NULL;
+ }
+
TRY_CATCH (except, RETURN_MASK_ALL)
{
if (frame_obj != NULL)
--
1.7.9.5