This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PR gdb/17445 fix


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)
>  	  continue;

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.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]