[PATCH v3 PR gdb/16841] virtual inheritance via typedef cannot find base

Weimin Pan weimin.pan@oracle.com
Tue Sep 18 23:26:00 GMT 2018



On 9/18/2018 4:59 AM, Tom Tromey wrote:
>>>>>> ">" == Weimin Pan <weimin.pan@oracle.com> writes:
>>> +2018-09-12  Weimin Pan  <weimin.pan@oracle.com>
>>> +
>>> +	PR gdb/16841
> This should read "PR c++/16841".  The robot doesn't care but I suppose
> it's a bit clearer for humans.

Done.

>>> +	PR gdb/16841
> Here too.

Done.

>>> +        gdb_test "print ${scope}d" " = 6.5999999999999996"
> It's best with floats to use a number that is exact.
> So, instead of 6.6, 6.25 or something like that.

Using 6.6 will result in an inexact number as well. Will change it to 
"6.25".

> The code has a loop to deal with multiple inheritance but the test
> doesn't exercise this case.  I think an additional for that would be
> good.

Sorry, which case is not exercised? Could it be printing superbase class 
member in base?

>>> +		      if (get_baseclass_offset (domain, curtype, v, &boff,
>>> +						&isvirt))
>>> +		        mem_offset += boff;
>>> +		      else
>>> +		        {
>>> +		          struct type *t = check_typedef (value_type (this_v));
>>> +		          t = check_typedef (TYPE_TARGET_TYPE (t));
>>> +		          if (get_baseclass_offset (t, curtype, this_v,
>>> +						    &boff, &isvirt))
>>> +		            mem_offset += boff;
> Could you explain this "else" block?  I did not understand the reason
> for it.  I suppose it could use a comment.

There is a brief comment:

                     /* Find class offset of type CURTYPE from either its
                          parent type DOMAIN or the type of implied 
this.  */

i.e. trying to find the class offset for CURTYPE first from its parent 
type DOMAIN.
If failed,  try to find it from the type of the implied this.

Thanks for your comments.

Weimin

>
> thanks,
> Tom



More information about the Gdb-patches mailing list