[Bug symtab/15391] DW_OP_GNU_implicit_pointer bug

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Tue Jun 13 13:22:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=15391

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andreas Arnez <arnez@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d5d1163eff2415a01895f1cff8bbee32b3f0ab66

commit d5d1163eff2415a01895f1cff8bbee32b3f0ab66
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date:   Tue Jun 13 15:20:26 2017 +0200

    write_pieced_value: Fix size capping logic

    A field f in a structure composed of DWARF pieces may be located in
    multiple pieces, where the first and last of those may contain bits from
    other fields as well.  So when writing to f, the beginning of the first
    and the end of the last of those pieces may have to be skipped.  But the
    logic in write_pieced_value for handling one of those pieces is flawed
    when the first and last piece are the same, i.e., f is contained in a
    single piece:

      < - - - - - - - - - piece_size - - - - - - - - - ->
      +-------------------------------------------------+
      | skipped_bits |   f_bits   | / / / / / / / / / / |
      +-------------------------------------------------+

    The current logic determines the size of the sub-piece to operate on by
    limiting the piece size to the bit size of f and then subtracting the
    skipped bits:

      min (piece_size, f_bits) - skipped_bits

    Instead of:

      min (piece_size - skipped_bits, f_bits)

    So the resulting sub-piece size is corrupted, leading to wrong handling of
    this piece in write_pieced_value.

    Note that the same bug was already found in read_pieced_value and fixed
    there (but not in write_pieced_value), see PR 15391.

    This patch swaps the calculations, bringing them into the same (correct)
    order as in read_pieced_value.

    gdb/ChangeLog:

        * dwarf2loc.c (write_pieced_value): Fix order of calculations for
        size capping.

    gdb/testsuite/ChangeLog:

        * gdb.dwarf2/var-pieces.exp: Add test case for modifying a
        variable at nonzero offset.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list