This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] gdb/python: raise TypeError instead of abort() on calling .value() method for label symbol object


---
 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]