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

Gary Benson gbenson@redhat.com
Thu Nov 26 10:10:23 GMT 2020


Tom de Vries wrote:
> On 11/25/20 4:25 PM, Gary Benson wrote:
> > 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?
> 
> Yes.
> 
> > 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!)
> 
> Yes, I've seen this, I've filed a clang PR (
> https://bugs.llvm.org/show_bug.cgi?id=48247 ), then committed an xfail
> in gdb (
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=da39d3ba57639b715dea7ce68b6a4a3d70dfcb03
> ).

Amazing, thank you!

Cheers,
Gary

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



More information about the Gdb-patches mailing list