[patch] DW_AT_byte_size for array type entries

Ken Werner ken@linux.vnet.ibm.com
Tue Nov 2 08:23:00 GMT 2010


On Tuesday, October 19, 2010 8:16:05 pm Ken Werner wrote:
> On Tuesday, October 19, 2010 1:23:57 pm Ken Werner wrote:
> > Hi,
> > 
> > Section 5.4 of the DWARF standard allows to specify extra padding bytes
> > for array type entries by using the DW_AT_byte_size attribute. This is
> > used for example to specify the types for OpenCL 3-component vectors
> > whose size and alignment are those of 4-component vectors. Currently the
> > GDB does not understand this mechanism and the attached patch attempts
> > to fix this. It extends the DWARF reader (dwarf2read.c:read_array_type)
> > to respect the DW_AT_byte_size attribute and set the length of the array
> > accordingly. This breaks the code that assumes that the number of
> > elements of an array is simply the length of the array type divided by
> > the length of the element type. Therefore the patch queries the number
> > of array elements using the get_array_bounds function that has been
> > enhanced to only return the bounds if they are defined
> > (TYPE_ARRAY_[LOWER|UPPER]_BOUND_IS_UNDEFINED). In order to prevent the
> > inclusion of the valprint.h header the
> > get_array_bounds function has been moved from valprint.[c|h] to
> > gdbtypes.[c|h].
> > Tested on i686-*-linux-gnu with no regressions.
> 
> Hm, that patch lacks the chunk that changes the c_type_print_varspec_suffix
> function. Here is the full version.

Any objections/comments on that patch?

Thanks
Ken



More information about the Gdb-patches mailing list