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


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