On Wed, Oct 08, 2025 at 09:35:06AM +0100, Yury Khrustalev wrote:
> I think we have 2 things here:
> 
> 1. Detect situation when we work with something like svbool_t
> 2. Decide what to do in this case (i.e. what attributes to add to
> whatever DIEs).
> 
> I agree on the latter that we should have DW_AT_bit_stride in the array
> type but I think DW_AT_bit_size 1 in the base type (element type) would
> not solve the issue with GDB reading 1 byte for each vector element
> because it really looks at the type description at this point.

I think both are desirable from the DWARF POV.  What exactly GDB does with
it is a question on GDB.

> > But I'll stress out this should be done solely for the targets which have
> > such kind of VECTOR_BOOLEAN_TYPE_Ps, not all because many have other
> > implementation.  And even if aarch64 doesn't have 2/4/8-bit strided bool
> > vectors (really don't know), it is quite likely RISC-V has those.
> 
> Could you point me in the direction of implementing target dependent
> code for generating DWARF information?

First of all, it should use the VECTOR_BOOLEAN_TYPE_P macro to decide, and
then either it can derive stuff from TYPE_MODE, or if that doesn't work
it can use a target hook.
There are various dwarf related target hooks and language hooks.
Just grep for targetm or lang_hooks in dwarf2out.cc.
So, perhaps have a target hook that given a VECTOR_BOOLEAN_TYPE_P
returns you the bit stride, with 0 meaning handle it as now.

        Jakub

Reply via email to