Re: [PATCH][gdb/symtab] Fix gdb.base/vla-optimized-out.exp with clang

Gary Benson via Gdb-patches
2020-11-25T15:25:34Z

Gary Benson wrote:
> Thank you for picking this up Tom (de Vries). Your patch looks good,
> however I wanted to point out that the location expressions Clang
> generates for gdb.base/vla-ptr.exp don't end with DW_OP_stack_value:
>
> < 2><0x000000a3> DW_TAG_variable
> DW_AT_location len 0x0002: 9168: DW_OP_fbreg -24
> DW_AT_name __vla_expr0
> DW_AT_type <0x00000118>
> DW_AT_artificial yes(1)
> < 2><0x000000af> DW_TAG_variable
> DW_AT_location len 0x0002: 9160: DW_OP_fbreg -32
> DW_AT_name __vla_expr1
> DW_AT_type <0x00000118>
> DW_AT_artificial yes(1)
>
> It wasn't obvious to me how GDB with your patch would handle these.
> Did you check your patch using that test?

I forgot to add, that I did, and the final test failed with my setup:

gdb.base/vla-ptr.exp
...
print td_vla
GCC compiled: $6 = {4, 5, 6, 7, 8}
Clang-12 compiled: $6 = 0x7fffffffc0d0

But! This is potentially a different issue. I don't think that test
accesses the array's size, and I've definitely seen typedef-related
failures with Clang compared with GCC.

(I don't need you to debug this for me, I'm just making sure you're
aware!)

Thanks,
Gary

--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat