Re: [3/3] RFC - optional patch to restore DW_AT_data_member_location

Doug Evans
2012-08-21T22:12:25Z

On Tue, Aug 21, 2012 at 9:37 AM, Tom Tromey <tromey@redhat.com> wrote:
> This patch reimplements DW_AT_data_member_location for variables
> appearing in a Fortran common block.
>
> This attribute is not specified by DWARF. It is apparently an old
> approach used by gfortran prior to 2008; at least it appeared in
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057
>
> This patch is based on the idea that such attributes are relatively
> rare. So, rather than implement complicated support for them, gdb just
> rewrites them into an ordinary location expression that uses the common
> block's location as a subroutine.
>
> I've included a new test case, which I made by editing the assembly
> output of gfortran by hand.
>
> Built and regtested on x86-64 Fedora 16.
>
> I consider this patch optional, because I think it is too much
> complicated code in support of a marginal and obsolete feature.
> However, I wrote it in case someone thinks that supporting 4 year old
> versions of gfortran is important.
>
> Tom
>
> * dwarf2read.c (mark_common_block_symbol_computed): New function.
> (read_common_block): Handle child DIEs with
> DW_AT_data_member_location.
> (new_symbol_full): Add special case for common blocks.
>
> * gdb.dwarf2/dw2-common-block.S: New file.
> * gdb.dwarf2/dw2-common-block.exp: New file.

I'm all for holding off until someone presents a *compelling* use case.