Patchwork [DWARF] Fix multiple register spanning location.

login
register
mail settings
Submitter Christian Bruel
Date April 29, 2013, 8:48 a.m.
Message ID <517E33C1.5020809@st.com>
Download mbox | patch
Permalink /patch/240341/
State New
Headers show

Comments

Christian Bruel - April 29, 2013, 8:48 a.m.
Hello,

We noticed a few failures with the gdb testsuite due to incorrect
mapping of floating point, noticed on SH that defines both
TARGET_DWARF_REGISTER_SPAN and DBX_REGISTER_NUMBER.

The problem was that the converted pseudo reg was never converted to the
dbx format when fed from 'multiple_reg_loc_descriptor'

reg tested for sh-elf (including gdb). bootstrap OK for arm-none-eabi,
sh64-elf and x86_64-unknown-linux-gnu

Note that this could apply to the ARM, C6X, RS6000, MIPS targets that
also defines the same macro combination. Although asking approval from
the DWARF maintainers, feedback from the respective arch maintainers
would be appreciated as I don't run the gdb testsuite on those targets.

Many thanks,

Christian

Patch

2013-04-26  Christian Bruel  <christian.bruel@st.com>

	* dwarf2out.c (multiple_reg_loc_descriptor): Use DBX_REGISTER_NUMBER
	 for spaning registers.

2013-04-26  Christian Bruel  <christian.bruel@st.com>

	* gcc.dg/debug/dwarf2/dwarf_span.c: New test case.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 198287)
+++ dwarf2out.c	(working copy)
@@ -10656,7 +10656,8 @@  multiple_reg_loc_descriptor (rtx rtl, rtx regs,
     {
       dw_loc_descr_ref t;
 
-      t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
+      reg = REGNO (XVECEXP (regs, 0, i));
+      t = one_reg_loc_descriptor (DBX_REGISTER_NUMBER (reg),
 				  VAR_INIT_STATUS_INITIALIZED);
       add_loc_descr (&loc_result, t);
       size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));

Index: testsuite/gcc.dg/debug/dwarf2/dwarf_span.c
===================================================================
--- testsuite/gcc.dg/debug/dwarf2/dwarf_span.c	(revision 0)
+++ testsuite/gcc.dg/debug/dwarf2/dwarf_span.c	(revision 0)
@@ -0,0 +1,18 @@ 
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-g -dA" } */
+/* { dg-final { scan-assembler-times "DW_OP_regx" 4 } } */
+
+double
+add_double (register double u, register double v)
+{
+  return u + v;
+}
+
+double
+wack_double (register double u, register double v)
+{
+  register double l = u, r = v;
+  l = add_double (l, r);
+  return l + r;
+}