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

Tom Tromey tom@tromey.com
Tue Sep 18 11:59:00 GMT 2018


>>>>> ">" == 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.

>> +	PR gdb/16841

Here too.

>> +        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.

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.

>> +		      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.

thanks,
Tom



More information about the Gdb-patches mailing list