[RFC] PR gdb/17445 fix

Pierre Muller pierre.muller@ics-cnrs.unistra.fr
Wed Oct 1 07:45:00 GMT 2014


  Bug report gdb/17445
shows that use of explicit xmm15 register in windows x86_64
code leads to wrong unwinding of stacktrace by GDB.
  This problem comes from the fact that
the return address column is set to 32 for x86_64 pe objects,
while it is 16 for other targets.
  Dwarf x86_64 register 16 is RIP,
while register 32 is XMM15.
  The reason for this was apparently that the value of
the return address column is also interpreted as the highest
index of the register that needs to be saved according to the ABI 
which is indeed different for Microsoft.
  Nevertheless, I found nothing inside DWARF4 documentation
that makes any relation between the resisters that should be saved
and the return address column.
  I came to the conclusion that this is a mis-interpretation
of the dwarf standard that is specific to GNU bfd-gas-gdb.
  The patch proposed below tries to fix the current PR
by removing the above assumptions and restoring RIP
as return address register for pe(i)-x86-64 targets.

 Comments most welcome,

Pierre Muller
Pascal language maintainer for GDB.

PS: One problem is that I was not able to correctly run
the testsuite before and after my patch, as
there are still cygwin/mingw specific issues with testsuite runs.


ChangeLog (needs to be split into binutils/gas/gdb directories)

2014-10-01  Pierre Muller  <muller@sourceware.org>

        PR gdb/17445
        * binutils/dwarf.c (display_debug_frames): Handle return address
column
        specifically, do not limit num_regs to the value of return address
        column.
        Modified handling of DW_CFA_restore{_extended} to check that
        a valid storage is present at restore point.

        * gas/config/tc-i386.c (x86_dwarf2_return_column): Remove special
        value for x86_64 pe coff return address column.
        This restores RIP register for return address column.

        * gdb/dwarf2-frame.c (dwarf2_frame_cache): Avoid double handling of
        return address column.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-PR-17445-v5.patch
Type: application/octet-stream
Size: 6072 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20141001/1a8d9eb2/attachment.obj>


More information about the Binutils mailing list