This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[debug/13267] proposed patch to dwarf2out.c
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fnf at ninemoons dot com
- Date: Tue, 2 Mar 2004 17:04:19 -0500
- Subject: [debug/13267] proposed patch to dwarf2out.c
Comment says all. Untested except for a few manual cases; if this is
"the right way to do it" I'll run the full testsuite. Is this the
right way to do it?
2004-03-02 DJ Delorie <dj@redhat.com>
* dwarf2out.c (add_location_or_const_value_attribute): Adjust
for when a variable is stored in a larger-sized memory
location.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.498
diff -p -C2 -r1.498 dwarf2out.c
*** dwarf2out.c 1 Mar 2004 04:07:36 -0000 1.498
--- dwarf2out.c 2 Mar 2004 22:00:25 -0000
*************** Software Foundation, 59 Temple Place - S
*** 67,70 ****
--- 67,71 ----
#include "cgraph.h"
#include "input.h"
+ #include "genrtl.h"
#ifdef DWARF2_DEBUGGING_INFO
*************** add_location_or_const_value_attribute (d
*** 9760,9763 ****
--- 9761,9787 ----
else
{
+ int rmode = GET_MODE (rtl);
+ int rsize = GET_MODE_SIZE (rmode);
+ int dmode = TYPE_MODE (TREE_TYPE (decl));
+ int dsize = GET_MODE_SIZE (dmode);
+
+ /* If a variable is declared "register" yet is smaller than
+ a register, then if we store the variable to memory, it
+ looks like we're storing a register-sized value, when in
+ fact we are not. We need to adjust the offset of the
+ storage location to reflect the actual value's bytes,
+ else gdb will not be able to display it. */
+ if (BYTES_BIG_ENDIAN && rsize > dsize)
+ {
+ int pmode = GET_MODE (XEXP (rtl, 0));
+ rtx rtl2, rtl3;
+
+ rtl2 = gen_rtx_PLUS (pmode,
+ XEXP (rtl, 0),
+ GEN_INT (rsize-dsize));
+ rtl3 = simplify_rtx(rtl2);
+ rtl2 = rtl3 ? rtl3 : rtl2;
+ rtl = gen_rtx_MEM (dmode, rtl2);
+ }
case REG:
case SUBREG: