[PATCH] Fix mi "-var-create" regression

Luis Machado lgustavo@codesourcery.com
Mon Oct 15 12:21:00 GMT 2012


On 10/14/2012 02:18 PM, Joel Brobecker wrote:
> I don't feel entirely comfortable approving this patch, not because
> I think it's iffy, but just because I don't have a good knowledge
> of what is going on for you (RTTI is C++, and I don't follow C++
> support). If no one else has the time to officially review your patch
> within the next week or so, I will take a deeper look. It does look
> reasonable.
>

The biggest problem caused by this regression is the breakage of 
information sent to IDEs based on MI output, as Marc pointed out.

Eclipse, for example, will attempt to list registers and gdb will end up 
throwing these errors, causing eclipse to get all confused when trying 
to display the register values.

This is more about a regression of a generic gdb feature than a fix to a 
C++ feature.

> I did notice a couple of things (besides the unnecessary parens):
>
>> -      if (TYPE_CODE (result) == TYPE_CODE_PTR
>> +      /* If result's target type is TYPE_CODE_VOID, do not try fetching its rtti
>> +	 type.  GDB will try to dereference the void pointer and will throw an
>> +	 error when trying to do so.  */
>
> Can you reformat the comment to fit within 70 characters. That's the
> soft line limit...
>

Fixed.

>> +      if ((TYPE_CODE (result) == TYPE_CODE_PTR
>>   	  || TYPE_CODE (result) == TYPE_CODE_REF)
>> +	&&  ((TYPE_TARGET_TYPE (result) != NULL)
>> +	&&  TYPE_CODE (TYPE_TARGET_TYPE (result)) != TYPE_CODE_VOID))
>
> I don't think that you need to test for the TYPE_TARGET_TYPE, since
> you already know that it's either a PTR or REF type, which always
> have a TARGET_TYPE.
>

Well spotted. I fixed this now.

Thanks,
Luis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtti-print-object.diff
Type: text/x-patch
Size: 905 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20121015/46181144/attachment.bin>


More information about the Gdb-patches mailing list