public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Two DW_OP_GNU_variable_value fixes / tweaks
@ 2017-05-15 12:47 Richard Biener
  2017-05-15 19:04 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2017-05-15 12:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek


While bringing early LTO debug up-to-speed I noticed the following two
issues.  The first patch avoids useless work in 
note_variable_value_in_expr and actually makes use of the DIE we
eventually create in resolve_variable_value_in_expr.

The second avoids generating a DW_OP_GNU_variable_value for a decl
we'll never have a DIE for -- this might be less obvious than the
other patch but I think we'll also never have any other debug info
we can resolve the decl with(?)

Bootstrapped and tested the first patch sofar
on x86_64-unknown-linux-gnu, 2nd is pending.

Ok?

Thanks,
Richard.

2017-05-15  Richard Biener  <rguenther@suse.de>

	* dwarf2out.c (resolve_variable_value_in_expr): Lookup DIE
	just generated.
	(note_variable_value_in_expr): If we resolved the decl ref
	do not push to the stack.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 248055)
+++ gcc/dwarf2out.c	(working copy)
@@ -30109,8 +30109,9 @@ resolve_variable_value_in_expr (dw_attr_
 	      break;
 	    }
 	  /* Create DW_TAG_variable that we can refer to.  */
-	  ref = gen_decl_die (decl, NULL_TREE, NULL,
-			      lookup_decl_die (current_function_decl));
+	  gen_decl_die (decl, NULL_TREE, NULL,
+			lookup_decl_die (current_function_decl));
+	  ref = lookup_decl_die (decl);
 	  if (ref)
 	    {
 	      loc->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
@@ -30203,6 +30204,7 @@ note_variable_value_in_expr (dw_die_ref
 	    loc->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
 	    loc->dw_loc_oprnd1.v.val_die_ref.die = ref;
 	    loc->dw_loc_oprnd1.v.val_die_ref.external = 0;
+	    continue;
 	  }
 	if (VAR_P (decl)
 	    && DECL_CONTEXT (decl)


2017-05-15  Richard Biener  <rguenther@suse.de>

	* dwarf2out.c (loc_list_from_tree_1): Do not create
	DW_OP_GNU_variable_value for DECL_IGNORED_P decls.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 248054)
+++ gcc/dwarf2out.c	(working copy)
@@ -17373,6 +17685,7 @@ loc_list_from_tree_1 (tree loc, int want
 		&& early_dwarf
 		&& current_function_decl
 		&& want_address != 1
+		&& ! DECL_IGNORED_P (loc)
 		&& (INTEGRAL_TYPE_P (TREE_TYPE (loc))
 		    || POINTER_TYPE_P (TREE_TYPE (loc)))
 		&& DECL_CONTEXT (loc) == current_function_decl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-16 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 12:47 [PATCH] Two DW_OP_GNU_variable_value fixes / tweaks Richard Biener
2017-05-15 19:04 ` Jakub Jelinek
2017-05-16 11:10   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).