This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

Re: Python convenience functions that return GDB values causesegfault


El mar, 03-02-2009 a las 17:09 -0800, Jim Blandy escribiÃ:
>    else if (PyObject_TypeCheck (obj, &value_object_type))
> -    value = ((value_object *) obj)->value;
> +    {
> +      value_object *value_obj = (value_object *) obj;
> +      value = value_obj->value;
> +      value_obj->owned_by_gdb = 1;
> +    }

To properly "give the value back" to GDB, you'd have to reinsert it into
the all_values list, and remove it from the values_in_python list. But
then when the GDB frees the value, the Python gdb.Value object would be
pointing to garbage...

I think it's better to return a copy of the value.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


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