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


On Wed, Feb 4, 2009 at 8:22 AM, Thiago Jung Bauermann
<bauerman@br.ibm.com> wrote:
> 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.

You're certainly right.

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.


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