This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Python convenience functions that return GDB values cause segfault
On Wed, Feb 4, 2009 at 8:31 AM, Jim Blandy <jimb@red-bean.com> wrote:
> I've run out of time to play with this right now, but if I can later
> I'll try to change the patch as you suggest.
(I don't know why I thought this was going to be more involved...)
commit b5b76eeb4f5140875682693d194c78e29fe2baad
Author: Jim Blandy <jimb@red-bean.com>
Date: Tue Feb 3 17:05:18 2009 -0800
Properly hand off GDB values returned by convenience functions.
* gdb/python/python-value.c (convert_value_from_python):
Properly hand off GDB values returned by convenience
functions.
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 37e2fec..e21d667 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -820,7 +820,7 @@ convert_value_from_python (PyObject *obj)
do_cleanups (old);
}
else if (PyObject_TypeCheck (obj, &value_object_type))
- value = ((value_object *) obj)->value;
+ value = value_copy (((value_object *) obj)->value);
else
error (_("Could not convert Python object: %s"),
PyString_AsString (PyObject_Str (obj)));