This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: dwarf-2 and multi-register value
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 21 Feb 2002 12:13:41 -0700
- Subject: Patch: dwarf-2 and multi-register value
- Reply-to: tromey at redhat dot com
This patch fixes a bug in our Dwarf-2 output.
Right now if a value spans multiple registers, then we emit a
DW_OP_reg for the first register. However, we really should be
emitting a sequence of DW_OP_reg/DW_OP_piece pairs describing the
entire value.
This patch implements that behavior.
A corresponding gdb patch is required. I'll be submitting that
shortly. (What is the protocol for changes like this? I assume I
need to wait for both approvals before committing either change.)
I tested this on a Linux native toolchain.
(And in a slightly different gcc, on a Linux-x-XStormy16 toolchain.)
Ok?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* dwarf2out.c (reg_loc_descriptor): Handle case where a value
spans multiple registers.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.355
diff -u -r1.355 dwarf2out.c
--- dwarf2out.c 2002/02/20 23:19:20 1.355
+++ dwarf2out.c 2002/02/21 18:35:38
@@ -7625,16 +7625,27 @@
rtx rtl;
{
dw_loc_descr_ref loc_result = NULL;
- unsigned reg;
+ unsigned reg, i, max;
if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
return 0;
reg = reg_number (rtl);
- if (reg <= 31)
- loc_result = new_loc_descr (DW_OP_reg0 + reg, 0, 0);
- else
- loc_result = new_loc_descr (DW_OP_regx, reg, 0);
+ max = HARD_REGNO_NREGS (reg, GET_MODE (rtl));
+ for (i = 0; i < max; ++i)
+ {
+ add_loc_descr (&loc_result,
+ new_loc_descr (reg <= 31 ? DW_OP_reg0 + reg : DW_OP_regx,
+ reg <= 31 ? 0 : reg,
+ 0));
+
+ if (max > 1)
+ add_loc_descr (&loc_result,
+ new_loc_descr (DW_OP_piece,
+ GET_MODE_SIZE (reg_raw_mode[reg]), 0));
+
+ ++reg;
+ }
return loc_result;
}