This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix -fvar-tracking
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org,Richard Henderson <rth at redhat dot com>,Roland McGrath <roland at redhat dot com>
- Date: Wed, 8 Jun 2005 09:48:16 +0200
- Subject: Re: [PATCH] Fix -fvar-tracking
- References: <20050603234255.GH22349@devserv.devel.redhat.com>
> 2005-06-04 Jakub Jelinek <jakub@redhat.com>
>
> * dwarf2out.c (add_loc_descr_op_piece): New function.
> (multiple_reg_loc_descriptor, concat_loc_descriptor,
> loc_descriptor): Use it.
>
> * var-tracking.c: Include regs.h and expr.h.
> (emit_note_insn_var_location): Skip over pieces where offset
> is smaller than previous offset plus previous piece mode size.
> Optimize adjacent hard registers or memory locations.
> * Makefile.in (var-tracking.o): Depend on $(REGS_H) and $(EXPR_H).
>
Minor nit: you have added add_loc_descr_op_piece to the
(DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO) section of dwarf2out.c, while
it is only used in the DWARF2_DEBUGGING_INFO section, resulting in a
bootstrap failure on systems that don't use DWARF-2 debug info at all (e.g.
Solaris 2.6 and below).
I've installed the following fix as obvious, tested on sparc-sun-solaris2.5.1
and x86_64-suse-linux, please do not forget it when backporting the patch to
the 4.0 branch, TIA.
2005-06-08 Eric Botcazou <ebotcazou@libertysurf.fr>
PR debug/21946
* dwarf2out.c (add_loc_descr_op_piece): Move to the
DWARF2_DEBUGGING_INFO section.
--
Eric Botcazou
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.599
diff -u -p -r1.599 dwarf2out.c
--- dwarf2out.c 8 Jun 2005 05:05:15 -0000 1.599
+++ dwarf2out.c 8 Jun 2005 07:11:01 -0000
@@ -2659,7 +2659,6 @@ static const char *dwarf_stack_op_name (
static dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom,
unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT);
static void add_loc_descr (dw_loc_descr_ref *, dw_loc_descr_ref);
-static void add_loc_descr_op_piece (dw_loc_descr_ref *, int);
static unsigned long size_of_loc_descr (dw_loc_descr_ref);
static unsigned long size_of_locs (dw_loc_descr_ref);
static void output_loc_operands (dw_loc_descr_ref);
@@ -2997,7 +2996,6 @@ new_loc_descr (enum dwarf_location_atom
return descr;
}
-
/* Add a location description term to a location description expression. */
static inline void
@@ -3012,27 +3010,6 @@ add_loc_descr (dw_loc_descr_ref *list_he
*d = descr;
}
-
-/* Optionally add a DW_OP_piece term to a location description expression.
- DW_OP_piece is only added if the location description expression already
- doesn't end with DW_OP_piece. */
-
-static void
-add_loc_descr_op_piece (dw_loc_descr_ref *list_head, int size)
-{
- dw_loc_descr_ref loc;
-
- if (*list_head != NULL)
- {
- /* Find the end of the chain. */
- for (loc = *list_head; loc->dw_loc_next != NULL; loc = loc->dw_loc_next)
- ;
-
- if (loc->dw_loc_opc != DW_OP_piece)
- loc->dw_loc_next = new_loc_descr (DW_OP_piece, size, 0);
- }
-}
-
/* Return the size of a location descriptor. */
static unsigned long
@@ -3996,6 +3973,7 @@ static dw_die_ref subrange_type_die (tre
static dw_die_ref modified_type_die (tree, int, int, dw_die_ref);
static int type_is_enum (tree);
static unsigned int dbx_reg_number (rtx);
+static void add_loc_descr_op_piece (dw_loc_descr_ref *, int);
static dw_loc_descr_ref reg_loc_descriptor (rtx);
static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int);
static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx);
@@ -8432,6 +8410,26 @@ dbx_reg_number (rtx rtl)
return DBX_REGISTER_NUMBER (regno);
}
+/* Optionally add a DW_OP_piece term to a location description expression.
+ DW_OP_piece is only added if the location description expression already
+ doesn't end with DW_OP_piece. */
+
+static void
+add_loc_descr_op_piece (dw_loc_descr_ref *list_head, int size)
+{
+ dw_loc_descr_ref loc;
+
+ if (*list_head != NULL)
+ {
+ /* Find the end of the chain. */
+ for (loc = *list_head; loc->dw_loc_next != NULL; loc = loc->dw_loc_next)
+ ;
+
+ if (loc->dw_loc_opc != DW_OP_piece)
+ loc->dw_loc_next = new_loc_descr (DW_OP_piece, size, 0);
+ }
+}
+
/* Return a location descriptor that designates a machine register or
zero if there is none. */