[PATCH 3/3] gold: Handle DW_AT_high_pc as offset from DW_AT_low_pc in gdb-index.cc.

Mark Wielaard mjw@redhat.com
Fri Apr 27 23:08:00 GMT 2012


On Fri, 2012-04-27 at 11:21 -0700, Cary Coutant wrote:
> >   off_t low_pc = die->ref_attribute(elfcpp::DW_AT_low_pc, &shndx);
> > -  off_t high_pc = die->ref_attribute(elfcpp::DW_AT_high_pc, &shndx2);
> > -  if ((low_pc != 0 || high_pc != 0) && low_pc != -1 && high_pc != -1)
> > +  off_t high_pc = die->address_attribute(elfcpp::DW_AT_high_pc, &shndx2);
> > +  if (high_pc == -1)
> > +    {
> > +      high_pc = die->uint_attribute(elfcpp::DW_AT_high_pc);
> > +      high_pc += low_pc;
> > +      shndx2 = shndx;
> > +    }
> > +  if ((low_pc != 0 || high_pc != 0) && low_pc != -1)
> >     {
> >       if (shndx != shndx2)
> >         {
> 
> You should change the first call for low_pc to use
> die->address_attribute() as well.

Yes, of course, good point.
Adjusted patch attached (with that line changed and not including
ChangeLog file and regenerated Makefile.in file in the patch).

2012-04-26  Mark Wielaard  <mjw@redhat.com>

    * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
    * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
    * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
    DW_AT_high_pc as offset from DW_AT_low_pc.

    * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
    * testsuite/Makefile.in: Regenerate.
    * testsuite/gdb_index_test_3.c: New test source file.
    * testsuite/gdb_index_test_3.sh: New test source file.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-gold.patch
Type: text/x-patch
Size: 5946 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20120427/e2005cd8/attachment.bin>


More information about the Binutils mailing list