This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH PR gdb/16841] virtual inheritance via typedef cannot find base
- From: Tom Tromey <tom at tromey dot com>
- To: Weimin Pan <weimin dot pan at oracle dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 28 Jul 2018 20:28:12 -0600
- Subject: Re: [PATCH PR gdb/16841] virtual inheritance via typedef cannot find base
- References: <1532128565-75923-1-git-send-email-weimin.pan@oracle.com>
Thanks for the patch. There are a few small issues with it.
First, git says that most of the lines in the valops.c part have a
trailing space. Please remove those.
Weimin> + for (index = 0; index < TYPE_NFIELDS (domain); index++)
I think the loop limit should be TYPE_N_BASECLASSES.
And, is it possible for the desired type to be a base class of a base class?
I suspect so, but I didn't try to check; in this case you will need some
recursion here, and also I think a new test for this case would be good.
Weimin> + if (TYPE_FIELDS (domain)[index].type == curtype)
It is more idiomatic to write TYPE_FIELD_TYPE (domain, index) here.
Also I think you need check_typedef on the left-hand-side.
Otherwise perhaps using a typedef for a base class would confuse gdb
(depending on whether the compiler emits typedefs here or not).
Weimin> + else
Weimin> + mem_offset = value_as_long (ptr);
This line is indented too far.
thanks,
Tom