* python/py-value.c (valpy_get_address): Use Py_XINCREF.
authorPaul Koning <pkoning@equallogic.com>
Mon, 3 Oct 2011 16:14:39 +0000 (16:14 +0000)
committerPaul Koning <pkoning@equallogic.com>
Mon, 3 Oct 2011 16:14:39 +0000 (16:14 +0000)
(value_to_value_object): Fetch value if it was lazy.

gdb/ChangeLog
gdb/python/py-value.c

index 931fb05f025bd0f3e6b1e4469a294050821a5c80..625bbbb16b9c5e2da2284d7aa0aa12337832342a 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-03  Paul Koning  <paul_koning@dell.com>
+
+       * python/py-value.c (valpy_get_address): Use Py_XINCREF.
+       (value_to_value_object): Fetch value if it was lazy.
+
 2011-10-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Code cleanup.
index fc5053a77b48ec8c1353547717d21283f96f9bab..252d9b947a84af4ba32856c96af64fb35f8e1bc0 100644 (file)
@@ -209,7 +209,7 @@ valpy_get_address (PyObject *self, void *closure)
        val_obj->address = value_to_value_object (res_val);
     }
 
-  Py_INCREF (val_obj->address);
+  Py_XINCREF (val_obj->address);
 
   return val_obj->address;
 }
@@ -1045,7 +1045,15 @@ PyObject *
 value_to_value_object (struct value *val)
 {
   value_object *val_obj;
+  volatile struct gdb_exception except;
 
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    {
+      if (value_lazy (val))
+       value_fetch_lazy (val);
+    }
+  GDB_PY_HANDLE_EXCEPTION (except);
+  
   val_obj = PyObject_New (value_object, &value_object_type);
   if (val_obj != NULL)
     {