[Bug gdb/25143] New: Incompatibility between Clang and GDB for variables described using call-clobbered registers

david.stenberg at ericsson dot com sourceware-bugzilla@sourceware.org
Tue Oct 29 10:22:00 GMT 2019


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

            Bug ID: 25143
           Summary: Incompatibility between Clang and GDB for variables
                    described using call-clobbered registers
           Product: gdb
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: david.stenberg at ericsson dot com
  Target Milestone: ---

Spawned from the following post on the mailing thread:
https://sourceware.org/ml/gdb/2019-10/msg00002.html

Clang currently emits location list entries that cover all bytes of a call,
including in cases where the location is a scratch register. This results in
variables that are described using scratch registers being printed with
potentially stale register values, instead of <optimized out>, when unwinding
in GDB, due to GDB not knowing which registers are preserved or not.

GCC emits one byte shorter location list entries around calls for scratch
register locations, meaning that the variable is printable before executing the
call, but not when unwinding, so this is not an issue when debugging GCC-built
binaries in GDB.

This ticket is about describing which registers are preserved or not for more
targets by overriding the {target}_dwarf2_frame_init_reg() hook, as a way of
solving that incompatibility with Clang, instead of having to introduce GCC's
location list trimming in Clang.

See the mailing list post for an example where variables are currently printed
incorrectly for Clang-built binaries.

Here is the corresponding LLVM ticket:
https://bugs.llvm.org/show_bug.cgi?id=39752

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


More information about the Gdb-prs mailing list