[google/gcc-4_7] Fix ICEs with -gfission.

Submitted by Cary Coutant on Aug. 21, 2012, 12:30 a.m.

Details

Message ID 20120821003032.CFE91E0433@ccoutant.mtv.corp.google.com
State New
Headers show

Commit Message

Cary Coutant Aug. 21, 2012, 12:30 a.m.
This patch is for the google/gcc-4_7 branch.

When a location list or location expression is removed from a DIE, we
need to remove entries in the .debug_addr table that were referenced
by those location expressions.  Except for one case, the existing code
checked only the first descriptor in each location expression instead
of looping through all the descriptors.  In cases where we don't
remove the .debug_addr table entries, an ICE occurs during assembly
output.

This patch also fixes an ICE in output_pubname with -ggnu-pubnames,
where we are asserting on TAGs that GDB doesn't care about.  Instead
of asserting, we should just be setting the flags to 0.


2012-08-20   Cary Coutant  <ccoutant@google.com>

gcc/
	* dwarf2out.c (remove_loc_list_addr_table_entries): Change
	parameter; update all calls.
	(output_pubname): Don't assert on unknown TAGs.
	(resolve_addr): Call remove_loc_list_addr_table_entries for all
	location expressions.

Comments

Sterling Augustine Aug. 21, 2012, 12:31 a.m.
On Mon, Aug 20, 2012 at 5:30 PM, Cary Coutant <ccoutant@google.com> wrote:
> This patch is for the google/gcc-4_7 branch.
>
> When a location list or location expression is removed from a DIE, we
> need to remove entries in the .debug_addr table that were referenced
> by those location expressions.  Except for one case, the existing code
> checked only the first descriptor in each location expression instead
> of looping through all the descriptors.  In cases where we don't
> remove the .debug_addr table entries, an ICE occurs during assembly
> output.
>
> This patch also fixes an ICE in output_pubname with -ggnu-pubnames,
> where we are asserting on TAGs that GDB doesn't care about.  Instead
> of asserting, we should just be setting the flags to 0.
>
>
> 2012-08-20   Cary Coutant  <ccoutant@google.com>
>
> gcc/
>         * dwarf2out.c (remove_loc_list_addr_table_entries): Change
>         parameter; update all calls.
>         (output_pubname): Don't assert on unknown TAGs.
>         (resolve_addr): Call remove_loc_list_addr_table_entries for all
>         location expressions.

OK for google 4.7.

Sterling
Cary Coutant Aug. 21, 2012, 12:53 a.m.
>> 2012-08-20   Cary Coutant  <ccoutant@google.com>
>>
>> gcc/
>>         * dwarf2out.c (remove_loc_list_addr_table_entries): Change
>>         parameter; update all calls.
>>         (output_pubname): Don't assert on unknown TAGs.
>>         (resolve_addr): Call remove_loc_list_addr_table_entries for all
>>         location expressions.
>
> OK for google 4.7.

Thanks, committed at r190553.

-cary

Patch hide | download patch | download mbox

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 190548)
+++ gcc/dwarf2out.c	(working copy)
@@ -4858,13 +4858,9 @@  remove_addr_table_entry (unsigned int i)
    address_table.  */
 
 static void
-remove_loc_list_addr_table_entries (dw_loc_list_ref loc)
+remove_loc_list_addr_table_entries (dw_loc_descr_ref descr)
 {
-  dw_loc_descr_ref descr;
-
-  gcc_assert (loc->replaced);
-
-  for (descr = loc->expr; descr; descr = descr->dw_loc_next)
+  for (; descr; descr = descr->dw_loc_next)
     if (descr->dw_loc_oprnd1.val_index != -1U)
       remove_addr_table_entry (descr->dw_loc_oprnd1.val_index);
 }
@@ -9468,7 +9464,8 @@  output_pubname (dw_offset die_offset, pu
           GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
           break;
         default:
-          gcc_unreachable ();
+	  /* For unrecognized TAGs, don't set the flags.  */
+          break;
       }
       dw2_asm_output_data (1, flags >> GDB_INDEX_CU_BITSIZE,
                            "GDB-index flags");
@@ -22875,8 +22872,8 @@  resolve_addr (dw_die_ref die)
 			gcc_assert (!next->ll_symbol);
 			next->ll_symbol = (*curr)->ll_symbol;
 		      }
-		    if (l->dw_loc_oprnd1.val_index != -1U)
-		      remove_addr_table_entry (l->dw_loc_oprnd1.val_index);
+		    if (dwarf_split_debug_info)
+		      remove_loc_list_addr_table_entries (l);
 		    *curr = next;
 		  }
 		else
@@ -22891,7 +22888,7 @@  resolve_addr (dw_die_ref die)
 	      {
 		loc->replaced = 1;
                 if (dwarf_split_debug_info)
-                  remove_loc_list_addr_table_entries (loc);
+                  remove_loc_list_addr_table_entries (loc->expr);
 		loc->dw_loc_next = *start;
 	      }
 	  }
@@ -22916,8 +22913,8 @@  resolve_addr (dw_die_ref die)
 	       || l->dw_loc_next != NULL)
 	      && !resolve_addr_in_expr (l))
 	    {
-	      if (l->dw_loc_oprnd1.val_index != -1U)
-		remove_addr_table_entry (l->dw_loc_oprnd1.val_index);
+	      if (dwarf_split_debug_info)
+		remove_loc_list_addr_table_entries (l);
 	      remove_AT (die, a->dw_attr);
 	      ix--;
 	    }