This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Dynamic array bounds problem
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Jonas Maebe <jonas dot maebe at elis dot ugent dot be>
- Cc: archer at sourceware dot org
- Date: Wed, 24 Dec 2008 16:22:04 +0100
- Subject: Re: Dynamic array bounds problem
- References: <F2824F33-B4CC-45AB-ACCA-F44CA071172C@elis.ugent.be>
Hi Jonas,
On Wed, 24 Dec 2008 11:11:12 +0100, Jonas Maebe wrote:
> struct {
> intptr_t refcount;
> intptr_t high;
> char data[1];
> } dynarr_t;
>
> A dynamic array variable is always a pointer which is either NULL (not
> allocated) or which points to the "data" field of the above struct (so
> the length and refcount are at negative offsets). The lower bound is
> always 0, the current upper bound is stored in the "high" field.
Just be sure DW_TAG_variable's DW_AT_location gives the address of the pointer
to dynaddr_t, not the pointer value itself.
> When I change the language in gdb from Pascal to Fortran it still prints
The patch works even for C variable-length-arrays, it is mostly invoked by
check_typedef(). Still there were missing some check_typedef()s at some
places of the Fortran support part of GDB.
> I'm new to git (I know cvs and svn) so I'm not sure what the proper way
> is to identify the revision I'm using, but the last commit in my git log
> is f2deac9fa3dfd4d9010e3590963ded5f0d56fe0a
This GIT tag should work (although there is an update now). You should check
that TYPE_DYNAMIC is present in the sources.
> Any hints on what I might be doing wrong?
Some basic hints can be given by `set debug target 1' to at least see which
addresses are being read while evaluating the array boundaries.
> I can provide a compiled program if required.
Yes, interested in checking it as the DWARF dump above looks fine to me.
Regards,
Jan