This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: PATCH: Start Fortran support for variable objects.
Daniel Jacobowitz writes:
> On Fri, Jul 01, 2005 at 04:32:54PM +1200, Nick Roberts wrote:
> > So I should have done:
> >
> > (top-gdb) p TYPE_LOW_BOUND(var->type->main_type->fields->type)
> > $1 = 1
> > (top-gdb) p TYPE_HIGH_BOUND(var->type->main_type->fields->type)
> > $2 = 4
>
> Right - specifically, TYPE_LOW_BOUND (TYPE_INDEX_TYPE (var->type))
> is supposed to be the lower bound for an array. Tricky. It comes from
> read_subrange_type in dwarf2read.c for dwarf2.
Or even TYPE_ARRAY_LOWER_BOUND_VALUE (var->type)?
Presumably these macros are more general than dwarf2. I don't understand the
connection with read_subrange_type.
...
> First of all, never reference ->main_type - see above for the right way
> to get the low bound. An even better way (it seems) is to call
> get_discrete_bounds. Take a look at value_subscript for an example.
Better than TYPE_LOW_BOUND?
...
> So let's use TYPE_LOW_BOUND for now; does that eliminate the need for
> the fortran-specific code?
OK. And, in future, bear get_discrete_bounds in mind?
Nick