Blame SOURCES/gcc34-dwarf2-pr20268.patch

6693b3
2005-03-30  James E. Wilson  <wilson@specifixinc.com>
6693b3
6693b3
	PR debug/20268
6693b3
	* dwarf2out.c (add_high_low_attributes): New function, extracted from
6693b3
	gen_lexical_block_die.
6693b3
	(gen_lexical_block_die, gen_inlined_subroutine_die): Call it.
6693b3
6693b3
--- gcc/dwarf2out.c.orig	2005-11-17 18:30:11.000000000 -0200
6693b3
+++ gcc/dwarf2out.c	2005-11-17 18:31:51.000000000 -0200
6693b3
@@ -11509,41 +11509,49 @@
6693b3
     }
6693b3
 }
6693b3
 
6693b3
-/* Generate a DIE for a lexical block.  */
6693b3
+/* A helper function for gen_lexical_block_die and gen_inlined_subroutine_die.
6693b3
+   Add low_pc and high_pc attributes to the DIE for a block STMT.  */
6693b3
 
6693b3
-static void
6693b3
-gen_lexical_block_die (tree stmt, dw_die_ref context_die, int depth)
6693b3
+static inline void
6693b3
+add_high_low_attributes (tree stmt, dw_die_ref die)
6693b3
 {
6693b3
-  dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die, stmt);
6693b3
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
6693b3
 
6693b3
-  if (! BLOCK_ABSTRACT (stmt))
6693b3
+  if (BLOCK_FRAGMENT_CHAIN (stmt))
6693b3
     {
6693b3
-      if (BLOCK_FRAGMENT_CHAIN (stmt))
6693b3
-	{
6693b3
-	  tree chain;
6693b3
+      tree chain;
6693b3
 
6693b3
-	  add_AT_range_list (stmt_die, DW_AT_ranges, add_ranges (stmt));
6693b3
+      add_AT_range_list (die, DW_AT_ranges, add_ranges (stmt));
6693b3
 
6693b3
-	  chain = BLOCK_FRAGMENT_CHAIN (stmt);
6693b3
-	  do
6693b3
-	    {
6693b3
-	      add_ranges (chain);
6693b3
-	      chain = BLOCK_FRAGMENT_CHAIN (chain);
6693b3
-	    }
6693b3
-	  while (chain);
6693b3
-	  add_ranges (NULL);
6693b3
-	}
6693b3
-      else
6693b3
+      chain = BLOCK_FRAGMENT_CHAIN (stmt);
6693b3
+      do
6693b3
 	{
6693b3
-	  ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
6693b3
-				       BLOCK_NUMBER (stmt));
6693b3
-	  add_AT_lbl_id (stmt_die, DW_AT_low_pc, label);
6693b3
-	  ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
6693b3
-				       BLOCK_NUMBER (stmt));
6693b3
-	  add_AT_lbl_id (stmt_die, DW_AT_high_pc, label);
6693b3
+	  add_ranges (chain);
6693b3
+	  chain = BLOCK_FRAGMENT_CHAIN (chain);
6693b3
 	}
6693b3
+      while (chain);
6693b3
+      add_ranges (NULL);
6693b3
+    }
6693b3
+  else
6693b3
+    {
6693b3
+      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
6693b3
+				   BLOCK_NUMBER (stmt));
6693b3
+      add_AT_lbl_id (die, DW_AT_low_pc, label);
6693b3
+      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
6693b3
+				   BLOCK_NUMBER (stmt));
6693b3
+      add_AT_lbl_id (die, DW_AT_high_pc, label);
6693b3
     }
6693b3
+}
6693b3
+
6693b3
+/* Generate a DIE for a lexical block.  */
6693b3
+
6693b3
+static void
6693b3
+gen_lexical_block_die (tree stmt, dw_die_ref context_die, int depth)
6693b3
+{
6693b3
+  dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die, stmt);
6693b3
+
6693b3
+  if (! BLOCK_ABSTRACT (stmt))
6693b3
+    add_high_low_attributes (stmt, stmt_die);
6693b3
 
6693b3
   decls_for_scope (stmt, stmt_die, depth);
6693b3
 }
6693b3
@@ -11565,15 +11573,10 @@
6693b3
     {
6693b3
       dw_die_ref subr_die
6693b3
 	= new_die (DW_TAG_inlined_subroutine, context_die, stmt);
6693b3
-      char label[MAX_ARTIFICIAL_LABEL_BYTES];
6693b3
 
6693b3
       add_abstract_origin_attribute (subr_die, decl);
6693b3
-      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
6693b3
-				   BLOCK_NUMBER (stmt));
6693b3
-      add_AT_lbl_id (subr_die, DW_AT_low_pc, label);
6693b3
-      ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL,
6693b3
-				   BLOCK_NUMBER (stmt));
6693b3
-      add_AT_lbl_id (subr_die, DW_AT_high_pc, label);
6693b3
+      add_high_low_attributes (stmt, subr_die);
6693b3
+
6693b3
       decls_for_scope (stmt, subr_die, depth);
6693b3
       current_function_has_inlines = 1;
6693b3
     }