This is the mail archive of the
mailing list for the binutils project.
Re: [RFC] PR gdb/17445 fix
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: pierre dot muller at ics-cnrs dot unistra dot fr (Pierre Muller)
- Cc: binutils at sourceware dot org, gdb-patches at sourceware dot org
- Date: Thu, 6 Nov 2014 18:55:07 +0100 (CET)
- Subject: Re: [RFC] PR gdb/17445 fix
- Authentication-results: sourceware.org; auth=none
Pierre Muller wrote:
> * gdb/dwarf2-frame.c (dwarf2_frame_cache): Avoid double handling of
> return address column.
Commenting just on the GDB part, this seems incorrect:
> /* Use the GDB register number as the destination index. */
> int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, column);
> + /* Do not handle return address here, it is done in the next
> + loop. This also avoids problem with pei-x86-64 target
> + having retaddr_column set to 32 (which is xmm15). */
> + if (column == fs->retaddr_column)
> + continue;
> /* If there's no corresponding GDB register, ignore it. */
> if (regnum < 0 || regnum >= num_regs)
The "next loop" does not handle the return address. It handles *other*
registers that *refer* to the return address.
Usually, you have a "return address column" in DWARF, which may or may
not itself refer to a register of the platform, and then you have some
other rule (either explicit or implicitly defined by the ABI) where the
PC refers to the return address column. Conceptually, unwinding is
performed in two parts: first, the return address is computed following
the instructions for the return address column, and then the PC is set
to the unwound return address value (or some value derived from it).
On some platforms, the return address itself does not correspond to any
register, and is *only* used for setting the PC. On some other platforms,
the return address itself corresponds to an actual hardware register, and
the unwind instructions for the return address column are in fact also
used to determine the unwound value of that register.
The latter is the case e.g. on s390, where %r14 is used as return address
column. The unwind instructions for %r14 are used both to unwind the
actual value of %r14, and to unwind the value of the PC.
Your patch would break that usage since you now no longer apply the
contents of the return address column to unwind register %r14 on s390.
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain