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.
On Thu, Jun 30, 2005 at 09:02:34PM +1200, Nick Roberts wrote:
> Daniel Jacobowitz writes:
> > On Thu, Jun 30, 2005 at 09:29:16AM +1200, Nick Roberts wrote:
> > >
> > > This patch adjusts the offset from 0 to 1 to allow the display of arrays
> > > in Fortran using variable objects.
> >
> > I see that you're hardcoding this based on language. Can we do it
> > based on type instead? Specifically, TYPE_LOW_BOUND and
> > TYPE_HIGH_BOUND. We have got type information here - unless I'm
> > misreading, var->type should be the type of the array.
>
> They look pretty similar to me.
>
> C:
>
> (top-gdb) p TYPE_LOW_BOUND(var->type)
> $18 = 0
> (top-gdb) p* var->type->main_type
> $33 = {code = TYPE_CODE_ARRAY, upper_bound_type = BOUND_SIMPLE,
> lower_bound_type = BOUND_SIMPLE, name = 0x0, tag_name = 0x0,
> objfile = 0x8357618, target_type = 0x8372c74, flags = 0, nfields = 1,
> vptr_fieldno = -1, fields = 0x837496c, vptr_basetype = 0x0, type_specific = {
> cplus_stuff = 0x0, floatformat = 0x0}}
>
> Fortran:
>
> (top-gdb) p TYPE_LOW_BOUND(var->type)
> $3 = 0
> (top-gdb) p* var->type->main_type
> $8 = {code = TYPE_CODE_ARRAY, upper_bound_type = BOUND_SIMPLE,
> lower_bound_type = BOUND_SIMPLE, name = 0x0, tag_name = 0x0,
> objfile = 0x8357618, target_type = 0x83654cc, flags = 0, nfields = 1,
> vptr_fieldno = -1, fields = 0x83655c4, vptr_basetype = 0x0,
> type_specific = {cplus_stuff = 0x0, floatformat = 0x0}}
>
> I need more of a clue to follow your suggestion.
Well, that's what was SUPPOSED to happen, anyway.
<1><a52>: Abbrev Number: 4 (DW_TAG_array_type)
DW_AT_sibling : <a62>
DW_AT_type : <a62>
<2><a5b>: Abbrev Number: 5 (DW_TAG_subrange_type)
DW_AT_type : <a62>
DW_AT_upper_bound : 4
I would have expected there to be a lower bound also... but there just
isn't. Your patch is more or less OK. Let me reply to it to pick up
some formatting comments.
--
Daniel Jacobowitz
CodeSourcery, LLC